Yu Watanabe [Tue, 4 Jun 2019 05:25:09 +0000 (14:25 +0900)]
network: fix double free on error path
Yu Watanabe [Mon, 3 Jun 2019 14:29:07 +0000 (23:29 +0900)]
network: fix UBSAN issue
Closes #12724.
Yu Watanabe [Tue, 4 Jun 2019 05:00:51 +0000 (14:00 +0900)]
networkctl: re-cast value stored in Set with INT_TO_PTR()
Michal Sekletar [Mon, 3 Jun 2019 08:12:35 +0000 (10:12 +0200)]
cpu-set-util: use %d-%d format in cpu_set_to_range_string() only for actual ranges
Zbigniew Jędrzejewski-Szmek [Wed, 29 May 2019 14:08:47 +0000 (16:08 +0200)]
test-sleep: also print parsed modes and states
This allows the parser to be verified against on-disk config.
Yu Watanabe [Mon, 3 Jun 2019 18:58:47 +0000 (03:58 +0900)]
Merge pull request #12708 from yuwata/test-network-networkctl-tests
udevadm: add --wait-for-initialization option and use it in systemd-networkd-tests.py
Yu Watanabe [Sat, 1 Jun 2019 06:55:16 +0000 (15:55 +0900)]
test-network: disable SystemCallFilter= when *SAN is enabled
Yu Watanabe [Sat, 1 Jun 2019 06:44:04 +0000 (15:44 +0900)]
test-network: add test for MTU field of 'networkctl status'
Yu Watanabe [Fri, 31 May 2019 07:11:53 +0000 (16:11 +0900)]
test-network: add tests for "networkctl delete"
Yu Watanabe [Sat, 1 Jun 2019 01:29:08 +0000 (10:29 +0900)]
test-network: move networkctl related tests to NetworkctlTests class
Yu Watanabe [Sat, 1 Jun 2019 16:02:09 +0000 (01:02 +0900)]
udevadm: add --wait-for-initialization option to "udevadm info"
Yu Watanabe [Sat, 1 Jun 2019 16:01:31 +0000 (01:01 +0900)]
util: make device_wait_for_initialization() optionally takes timeout value
Yu Watanabe [Sat, 1 Jun 2019 15:44:02 +0000 (00:44 +0900)]
util: make argument "subsystem" in device_wait_for_initialization() optional
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jun 2019 15:30:05 +0000 (17:30 +0200)]
Merge pull request #12619 from zachsmith/refactor-parse-sleep-config
systemd-sleep: refactor sleep conf parsing
Joe Richey [Fri, 31 May 2019 18:24:20 +0000 (11:24 -0700)]
sd-boot: Remove unnecessary call to GetEventLog
This PR reverts #4302 and part of #7568, as the call to GetEventLog
isn't necessary to get the logs from the OS runtime.
This has already been reverted in shim, see:
https://github.com/rhboot/shim/commit/
fd7c3bd920ba39082cb7c619afb7203d150a4cd3
The reasoning for the change that added this is wrong, explained below:
> According to TCG EFI Protocol Specification for TPM 2.0 family,
> all events generated after the invocation of EFI_TCG2_GET_EVENT_LOG
> shall be stored in an instance of an EFI_CONFIGURATION_TABLE aka
> EFI TCG 2.0 final events table.
This is correct and a valid reading of the TCG spec.
> Hence, it is necessary to trigger the internal switch through calling
> get_event_log() in order to allow to retrieve the logs from OS runtime.
However, this reasoning is incorrect. The "EFI TCG 2.0 final events
table" exists to allow the OS Runtime to get TCG events created during
or after the call to ExitBootServices. If systemd-boot didn't call
trigger_tcg2_final_events_table(), the call to HashLogExtendEvent will
write the event to the normal events table (i.e. the same place the
PCR 0 - 7 related events are written). Then the OS can obtain these
systemd-boot events in the same way it obtains normal events, via a
call to GetEventLog().
Tested on amd64 w/ TPM2 using the newest Linux kernel patches that
get the TPM2 formatted log:
https://www.lkml.org/lkml/2019/5/20/1590
I confirmed that this change still lets the OS runtime obtain the log
entries created by systemd-boot.
Signed-off-by: Joe Richey <joerichey@google.com>
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jun 2019 13:38:49 +0000 (15:38 +0200)]
Merge pull request #12666 from yuwata/networkctl-show-stats
networkctl: show stats
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jun 2019 13:29:40 +0000 (15:29 +0200)]
Merge pull request #12700 from yuwata/udev-propagate-critical-errors
udev: modernize code and propagate critical errors
Michal Sekletar [Fri, 31 May 2019 16:02:20 +0000 (18:02 +0200)]
execute: dump CPUAffinity as a range string instead of a list of CPUs
We do this already when printing the property in systemctl so be
consistent and do the same for systemd-analyze dump.
Yu Watanabe [Mon, 3 Jun 2019 07:04:16 +0000 (16:04 +0900)]
networkctl: drop unnecessary use of table_add_cell_full()
Yu Watanabe [Tue, 30 Apr 2019 20:22:19 +0000 (22:22 +0200)]
udev: check formatting of attribute or value earlier
Yu Watanabe [Mon, 29 Apr 2019 20:24:25 +0000 (22:24 +0200)]
udev: evaluate formatting in RUN= key earlier
Closes #12291.
Yu Watanabe [Tue, 30 Apr 2019 19:01:44 +0000 (21:01 +0200)]
udev: use delete_trailing_chars() at one more place
Yu Watanabe [Tue, 30 Apr 2019 18:35:08 +0000 (20:35 +0200)]
udev: replace xsprintf() + strpcpy() by strpcpyf()
Yu Watanabe [Tue, 30 Apr 2019 18:30:49 +0000 (20:30 +0200)]
udev: make parser for attribute of $result harder
Yu Watanabe [Tue, 30 Apr 2019 18:09:49 +0000 (20:09 +0200)]
udev: split udev_event_apply_format() into small pieces
Also, this makes the function refuse invalid formatting and
propagate error in substituing variable.
Yu Watanabe [Tue, 30 Apr 2019 17:23:44 +0000 (19:23 +0200)]
udev: comment that $tempnode and $sysfs formats are deprecated
Yu Watanabe [Tue, 30 Apr 2019 17:18:33 +0000 (19:18 +0200)]
udev: pass format type to udev_event_subst_format()
Yu Watanabe [Tue, 30 Apr 2019 17:13:58 +0000 (19:13 +0200)]
udev: rename enum subst_type -> FormatSubstitutionType
Yu Watanabe [Wed, 24 Apr 2019 23:21:11 +0000 (01:21 +0200)]
udev: modernize udev-rules.c
This does the following:
- rename enum udev_builtin_cmd -> UdevBuiltinCmd
- rename struct udev_builtin -> UdevBuiltin
- move type definitions to udev-rules.h
- move prototypes of functions defined in udev-rules.c to udev-rules.h
- drop to use strbuf
- propagate critical errors in applying rules,
- drop limitation for number of tokens per line.
Yu Watanabe [Sat, 25 May 2019 15:22:05 +0000 (00:22 +0900)]
networkctl: show link bit rates
Yu Watanabe [Fri, 24 May 2019 20:08:13 +0000 (05:08 +0900)]
network: monitor link bit rates
Yu Watanabe [Fri, 24 May 2019 15:40:38 +0000 (00:40 +0900)]
bash-completion: support --stats/-s option of networkctl
Yu Watanabe [Fri, 24 May 2019 15:37:48 +0000 (00:37 +0900)]
networkctl: optionally show link statistics
Yu Watanabe [Fri, 24 May 2019 15:37:00 +0000 (00:37 +0900)]
netlink: set attribute size of IFLA_STATS and IFLA_STATS64
Zbigniew Jędrzejewski-Szmek [Fri, 31 May 2019 08:56:45 +0000 (10:56 +0200)]
networkctl: shorten Minimum/Maximum to min/max
This makes the output slightly "lighter" visually. min/max are well-established
forms, so there's no risk of misunderstanding. Also, not using title-case looks
a bit better.
Follow-up for
c06ff86e25db4fdb4e962baf812ed28d8d0c1050.
$ build/networkctl status '*'|grep MTU
MTU: 65536
MTU: 1500 (min: 68, max: 9000)
MTU: 1500 (max: 2048)
MTU: 1500 (min: 256, max: 2304)
MTU: 1500 (min: 68, max: 65535)
MTU: 1500 (min: 68, max: 65521)
MTU: 1500 (min: 68, max: 65535)
MTU: 1500 (max: 65535)
MTU: 1360 (min: 68, max: 65535)
Michal Sekletar [Fri, 31 May 2019 13:23:23 +0000 (15:23 +0200)]
dbus-execute: make transfer of CPUAffinity endian safe (#12711)
We store the affinity mask in the native endian. However, over D-Bus we
must transfer the mask in little endian byte order.
This is the second part of
c367f996f5f091a63f812f0140b304c649be77fc.
Krayushkin Konstantin [Fri, 31 May 2019 08:16:17 +0000 (11:16 +0300)]
coredump: fixed bug - some coredump temp files could be lost
If the machine was suddenly shutted down (hard reboot for example) while
processing core dump, temp files created manually (not with a O_TEMPFILE flag)
stay in the system. After reboot systemd-coredump treat them as usual files, so
they wouldn't be rotated and shall pollute the filesystem.
Solution is to simply add those temp files to systemd-tmpfiles configs.
Zbigniew Jędrzejewski-Szmek [Fri, 31 May 2019 09:38:18 +0000 (11:38 +0200)]
Merge pull request #12707 from yuwata/test-network-lsan-options
test-network: add --lsan-options option
Yu Watanabe [Thu, 30 May 2019 18:30:31 +0000 (03:30 +0900)]
networkctl: do not show zero maximum MTU
Yu Watanabe [Fri, 31 May 2019 04:54:08 +0000 (13:54 +0900)]
test-network: show systemd-networkd.service
As there may exist some other drop-in configs.
Yu Watanabe [Fri, 31 May 2019 00:52:27 +0000 (09:52 +0900)]
test-network: stop service before editing unit file
Yu Watanabe [Thu, 30 May 2019 23:49:48 +0000 (08:49 +0900)]
test-network: add --lsan-options option
Yu Watanabe [Thu, 30 May 2019 23:28:37 +0000 (08:28 +0900)]
Merge pull request #12705 from keszybz/varlink-json-fix-and-two-cleanups
Varlink json fix and two cleanups
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 21:05:31 +0000 (23:05 +0200)]
sd-journal: voidify call
To appease coverity, CID#1400674.
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 20:56:03 +0000 (22:56 +0200)]
networkd: shorter two error statements a bit
Also let's not use a cast if we don't have to.
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 20:49:00 +0000 (22:49 +0200)]
basic/memory-util: do not "return" anything from memzero() macro
The macro is not used in expressions, so we don't need the ternary statement.
Frantisek Sumsal [Thu, 11 Apr 2019 12:34:32 +0000 (14:34 +0200)]
systemctl: process all units matched by a glob in the cat verb by default
Originally, `systemctl cat` would match only active units, for example:
$ systemctl cat sshd.service
would cat the sshd.service unit file even if the service was inactive.
However:
$ systemctl cat ssh*
would show it only if it was active.
Let's unify the behavior and cat all unit files regardless of a state,
if no state was given explicitly to filter.
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 18:36:54 +0000 (20:36 +0200)]
shared/varlink: add missing va_end()
Coverity CID#1401347.
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 17:39:05 +0000 (19:39 +0200)]
Revert "varlink: initialize Varlink with 0"
This reverts commit
8688c29b5aece49805a244676cba5bba0196f509, but leaves the
reproducer. Structured assignment should be enough to fully initialize the
variable and new0 is not necessary.
Yu Watanabe [Thu, 30 May 2019 17:33:10 +0000 (02:33 +0900)]
Merge pull request #12699 from yuwata/test-network-argparse
test-network: make path to networkd or friends configurable
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 16:35:22 +0000 (18:35 +0200)]
shared/varlink: add missing terminator in json strings
Should finally fix oss-fuzz-14688.
8688c29b5aece49805a244676cba5bba0196f509 wasn't enough.
The buffer retrieved from memstream has the size that the same as the written
data. When we write do write(f, s, strlen(s)), then no terminating NUL is written,
and the buffer is not (necessarilly) a proper C string.
Zbigniew Jędrzejewski-Szmek [Tue, 28 May 2019 14:11:55 +0000 (16:11 +0200)]
networkd: rewrite condition to make it easier to understand
Zbigniew Jędrzejewski-Szmek [Tue, 28 May 2019 12:35:20 +0000 (14:35 +0200)]
test-user-util: add simple test for make_salt()
Zach Smith [Thu, 30 May 2019 13:06:51 +0000 (06:06 -0700)]
systemd-sleep: (bug) honor s2h and hybrid_sleep disable settings
Zach Smith [Mon, 20 May 2019 05:43:29 +0000 (22:43 -0700)]
systemd-sleep: refactor sleep config parsing
remove verb from parse
refactor required fields checks
refactor allow settings
Frantisek Sumsal [Thu, 25 Apr 2019 10:33:25 +0000 (12:33 +0200)]
bash-completion: correctly react to an unescaped unit name
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 12:27:22 +0000 (14:27 +0200)]
Merge pull request #12636 from mbroz/master
Cryptsetup: call crypt_load() once for LUKS and support LUKS2 tokens
Yu Watanabe [Tue, 30 Apr 2019 16:56:33 +0000 (18:56 +0200)]
util: introduce strnpcpy() and strnscpy()
Yu Watanabe [Wed, 24 Apr 2019 23:19:07 +0000 (01:19 +0200)]
util: introduce PTR_TO_MODE and MODE_TO_PTR macros
Yu Watanabe [Thu, 30 May 2019 11:58:33 +0000 (20:58 +0900)]
networkctl: fix memleak
Closes #12701.
Yu Watanabe [Thu, 30 May 2019 06:49:11 +0000 (15:49 +0900)]
test-network: make the test take ASAN and UBSAN options
Yu Watanabe [Thu, 30 May 2019 03:33:57 +0000 (12:33 +0900)]
test-network: make path to networkd or friends configurable
Michal Sekletar [Thu, 30 May 2019 10:32:53 +0000 (12:32 +0200)]
Merge pull request #12628 from keszybz/dbus-execute
Rework cpu affinity parsing
Yu Watanabe [Thu, 30 May 2019 01:22:18 +0000 (10:22 +0900)]
nspawn: also support ifindex when specifying network interface
Zbigniew Jędrzejewski-Szmek [Thu, 30 May 2019 09:02:03 +0000 (11:02 +0200)]
Merge pull request #12646 from yuwata/networkctl-use-table
networkctl: use Table
Yu Watanabe [Thu, 30 May 2019 01:32:36 +0000 (10:32 +0900)]
dhcp4: use memdup_suffix0() instead of strndup() for binary data
C.f.
ac0a94f7438b49a0890d9806db1fa211a5bca10a.
Fixes #12693.
Felix Riemann [Wed, 29 May 2019 19:17:42 +0000 (21:17 +0200)]
pager: Fix deadlock when using built-in pager
The parent is waiting for an EOF on the pipe transmitting the pager name
before starting to send data. With external pagers this happens due to
execlp() CLOEXEC'ing the pipe, so the internal pager needs to close it
manually.
Roberto Santalla [Sun, 26 May 2019 11:55:30 +0000 (13:55 +0200)]
cryptsetup: Add dependency for detached header
Fixes #12650
cryptsetup: Extract dependency check to a separate function
cryptsetup: style improvements, error checking
Return early on failure/nothing to do
Removed braces from single-line ifs
Check return value of fstab_filter_options
cryptsetup: code style
Evgeny Vereshchagin [Thu, 30 May 2019 01:29:50 +0000 (03:29 +0200)]
tests: skip test-bpf only when we're 100% sure it's run in containers
This is just a follow-up to https://github.com/systemd/systemd/pull/12617.
Evgeny Vereshchagin [Wed, 29 May 2019 20:11:01 +0000 (23:11 +0300)]
Merge pull request #12617 from mbiebl/skip-test-bpf-containers
test-bpf: skip test when run inside containers
Zbigniew Jędrzejewski-Szmek [Wed, 29 May 2019 08:17:43 +0000 (10:17 +0200)]
shared/cpu-set-util: only force range printing one time
The idea is to have at least one range to make the new format clearly
distinguishable from the old. But it is enough to just do it once.
In particular, in case the affinity would be specified like 0, 2, 4, 6…,
this gives much shorter output.
Michal Sekletar [Wed, 22 May 2019 15:14:21 +0000 (17:14 +0200)]
systemctl: present CPUAffinity mask as a list of CPU index ranges
Michal Sekletar [Thu, 23 May 2019 12:27:18 +0000 (14:27 +0200)]
shared/cpu-set-util: introduce cpu_set_to_range()
Zbigniew Jędrzejewski-Szmek [Wed, 29 May 2019 07:44:16 +0000 (09:44 +0200)]
test-cpu-set-util: add test for dbus conversions
Michal Sekletar [Wed, 22 May 2019 11:55:49 +0000 (13:55 +0200)]
shared/cpu-set-util: make transfer of cpu_set_t over bus endian safe
Zbigniew Jędrzejewski-Szmek [Wed, 29 May 2019 10:39:58 +0000 (12:39 +0200)]
Merge pull request #12690 from yuwata/test-network-and-man-netdev
test-network,man: trivial cleanups
Feldwor [Wed, 29 May 2019 08:38:56 +0000 (11:38 +0300)]
hwdb: add axis range corrections for the Asus N53SV
Yu Watanabe [Wed, 29 May 2019 03:07:36 +0000 (12:07 +0900)]
test-network: bump time limit for wait_address()
Maximum time interval of DHCPv4 request is 63sec.
So, setting 100sec is enough.
Lennart Poettering [Wed, 29 May 2019 10:23:13 +0000 (12:23 +0200)]
Merge pull request #12449 from ljmf00/hwdb-accel-location-patch
hwdb: Add support for Teclast F6 Pro base sensor
Zbigniew Jędrzejewski-Szmek [Tue, 28 May 2019 19:40:10 +0000 (21:40 +0200)]
shared/cpu-set-util: drop now-unused cleanup function
Zbigniew Jędrzejewski-Szmek [Tue, 28 May 2019 19:38:41 +0000 (21:38 +0200)]
test-execute: use CPUSet too
cpu_set_malloc() was the last user. It doesn't seem useful to keep
it just to save the allocation of a few hundred bytes in a test, so
it is dropped and a fixed maximum is allocated (1024 bytes).
Zbigniew Jędrzejewski-Szmek [Fri, 24 May 2019 07:41:44 +0000 (09:41 +0200)]
pid1: when reloading configuration, forget old settings
If we had a configuration setting from a configuration file, and it was
removed, we'd still remember the old value, because there's was no mechanism to
"reset" everything, just to assign new values.
Note that the effect of this is limited. For settings that have an "ongoing" effect,
like systemd.confirm_spawn, the new value is simply used. But some settings can only
be set at start.
In particular, CPUAffinity= will be updated if set to a new value, but if
CPUAffinity= is fully removed, it will not be reset, simply because we don't
know what to reset it to. We might have inherited a setting, or we might have
set it ourselves. In principle we could remember the "original" value that was
set when we were executed, but propagate this over reloads and reexecs, but
that would be a lot of work for little gain. So this corner case of removal of
CPUAffinity= is not handled fully, and a reboot is needed to execute the
change. As a work-around, a full mask of CPUAffinity=0-8191 can be specified.
Zbigniew Jędrzejewski-Szmek [Fri, 24 May 2019 06:59:23 +0000 (08:59 +0200)]
pid1: don't reset setting from /proc/cmdline upon restart
We have settings which may be set on the kernel command line, and also
in /proc/cmdline (for pid1). The settings in /proc/cmdline have higher priority
of course. When a reload was done, we'd reload just the configuration file,
losing the overrides.
So read /proc/cmdline again during reload.
Also, when initially reading the configuration file when program starts,
don't treat any errors as fatal. The configuration done in there doesn't
seem important enough to refuse boot.
Zbigniew Jędrzejewski-Szmek [Fri, 24 May 2019 06:35:51 +0000 (08:35 +0200)]
pid1: parse CPUAffinity= in incremental fashion
This makes the handling of this option match what we do in unit files. I think
consistency is important here. (As it happens, it is the only option in
system.conf that is "non-atomic", i.e. where there's a list of things which can
be split over multiple assignments. All other options are single-valued, so
there's no issue of how to handle multiple assignments.)
Zbigniew Jędrzejewski-Szmek [Fri, 24 May 2019 06:50:41 +0000 (08:50 +0200)]
test-cpu-set-util: add a smoke test for test_parse_cpu_set_extend()
Zbigniew Jędrzejewski-Szmek [Tue, 21 May 2019 07:01:34 +0000 (09:01 +0200)]
test-cpu-set-util: add simple test for cpus_in_affinity_mask()
Zbigniew Jędrzejewski-Szmek [Tue, 28 May 2019 19:28:31 +0000 (21:28 +0200)]
Move cpus_in_affinity_mask() to cpu-set-util.[ch]
It just seems to fit better there and it's always better to have things
in shared/ rather than basic/.
Zbigniew Jędrzejewski-Szmek [Tue, 21 May 2019 06:45:19 +0000 (08:45 +0200)]
Rework cpu affinity parsing
The CPU_SET_S api is pretty bad. In particular, it has a parameter for the size
of the array, but operations which take two (CPU_EQUAL_S) or even three arrays
(CPU_{AND,OR,XOR}_S) still take just one size. This means that all arrays must
be of the same size, or buffer overruns will occur. This is exactly what our
code would do, if it received an array of unexpected size over the network.
("Unexpected" here means anything different from what cpu_set_malloc() detects
as the "right" size.)
Let's rework this, and store the size in bytes of the allocated storage area.
The code will now parse any number up to 8191, independently of what the current
kernel supports. This matches the kernel maximum setting for any architecture,
to make things more portable.
Fixes #12605.
Yu Watanabe [Wed, 29 May 2019 08:17:08 +0000 (17:17 +0900)]
man: re-indent systemd.netdev.xml
Yu Watanabe [Wed, 29 May 2019 07:38:08 +0000 (16:38 +0900)]
test-network: drop 25-nlmon.network
Franz Pletz [Thu, 23 May 2019 14:14:10 +0000 (16:14 +0200)]
man: add vrf section
Yu Watanabe [Wed, 29 May 2019 05:18:41 +0000 (14:18 +0900)]
tree-wide: replace if_indextoname() with format_ifname()
Yu Watanabe [Wed, 29 May 2019 05:03:18 +0000 (14:03 +0900)]
util: introduce format_ifname()
Yu Watanabe [Wed, 22 May 2019 20:13:13 +0000 (05:13 +0900)]
networkctl: use Table for 'lldp' command
Yu Watanabe [Wed, 22 May 2019 20:03:42 +0000 (05:03 +0900)]
networkctl: use Table for 'label' command
Yu Watanabe [Wed, 22 May 2019 16:43:21 +0000 (01:43 +0900)]
networkctl: use Table for 'status' command
Yu Watanabe [Wed, 22 May 2019 17:21:17 +0000 (02:21 +0900)]
networkctl: use Table for 'list' command
Yu Watanabe [Fri, 24 May 2019 09:11:13 +0000 (18:11 +0900)]
table: add TABLE_IFINDEX type
Yu Watanabe [Fri, 24 May 2019 09:01:04 +0000 (18:01 +0900)]
table: add more basic types
Yu Watanabe [Thu, 23 May 2019 10:59:06 +0000 (19:59 +0900)]
table: add teble_add_string_cell()