1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-04 13:51:24 +03:00
Commit Graph

39056 Commits

Author SHA1 Message Date
Yu Watanabe
96db641250 test: make network_verify() public and use it in test-networkd-conf 2019-03-13 11:59:18 +09:00
Yu Watanabe
fcbf4cb727 network: drop sections contain invalid settings in network_verify()
If e.g., an [Address] section has an invalid setting, then
previously assigned settings in the section is freed, and
only later settings are stored. That may cause partially broken
section stored in Network object.

This makes if an invalid setting is found, then set 'invalid' flag
instead of freeing it. And invalid sections are dropped later by
network_verify().
2019-03-13 11:59:18 +09:00
Yu Watanabe
9560e5b323 network: make all xxx_new_static() static
These functions are called from only config parsers, and the parsers are
in the same files. So, let's make them static.
2019-03-13 11:59:18 +09:00
Yu Watanabe
fa7cd7117f network: add IPv4LL route right after .network file is parsed
Previously, the route is added when the .network config is assigned
to a Link. So, if multiple links match the .network file, the route
entry becomes duplicated in the corresponding Network object.
2019-03-13 11:59:18 +09:00
Yu Watanabe
48315d3dca network: move NetworkConfigSection and related functions to networkd-util.[ch] 2019-03-13 11:59:18 +09:00
Yu Watanabe
95dba43542 network: use ltype to determine netdev kind in config_parse_stacked_netdev() 2019-03-13 11:59:18 +09:00
Yu Watanabe
7e46b29bd3 test: add a testcase for ProtectHome=tmpfs vs ProtectSystem=strict 2019-03-13 11:53:59 +09:00
Yu Watanabe
5beb8688e0 core/namespace: logs mount mode when the entry is dropped 2019-03-13 11:53:22 +09:00
Yu Watanabe
1e05071d27 core/namespace: introduce new mount mode READWRITE_IMPLICIT
ProtectSystem=strict or ProtectKernelTunable=yes create implicit
read-write mounts, but they are not overridable by TemporaryFileSystem=.
This makes such implicit read-write mounts use the new mount mode.
So, they can be override by TemproraryFileSystem= now.
A typical usecase is that ProtectSystem=strict and ProtectHome=tmpfs.

Fixes #11276.
2019-03-13 11:51:09 +09:00
Zbigniew Jędrzejewski-Szmek
0fb729282b fuzz: limit the maximum size of test inputs for a few parsers
We have a few cases or reported issues which are about a timeout to parse
the input in 25 s. In all cases, the input is a few hundred kb. We don't really
care if the config parsers are super efficent, so let's set a limit on the input
size to avoid triggering such issues. The parsers often contain quadratic
algorithms. This is OK, because the numbers of elements are almost always very
small in real use. Rewriting the code to use more complicated data structures
to speed this up would not only complicate the code, but also pessimize behaviour
for the overwhelmingly common case of small samples. Note that in all those
cases, the input data is trusted. We care about memory correctness, and not
not so much about efficiency.

The size checks are done twice: using options for libfuzzer, and using an
internal check for afl. Those should be changed together. I didn't use a define,
because there is no easy mechanism to share the define between the two files.
2019-03-12 19:30:05 +01:00
Lennart Poettering
fbaefc3ff9
Merge pull request #11919 from poettering/login-simplify
various fixes to $HOME and $SHELL validation
2019-03-12 18:33:14 +01:00
Zbigniew Jędrzejewski-Szmek
6d632d00ed nspawn: fix memleak uncovered by fuzzer
This is almost the same as 0e636bf51a. I looked through the code,
and I don't see any more instances of this pattern, so hopefully this
will be the last one.

https://oss-fuzz.com/issue/5660094128193536/13691.
2019-03-12 17:44:01 +01:00
Lennart Poettering
f3ae265f5c update TODO 2019-03-12 16:10:55 +01:00
Lennart Poettering
f3b5c814ab login: drop redundant newline 2019-03-12 16:10:55 +01:00
Lennart Poettering
b2a3953f81 user-util: extra paranoia, make sure $SHELL can't be fucked with in suid programs
It's better to be safe than sorry, let's not allow overriding of the
user shell in suid binaries. Similar for $USER.
2019-03-12 16:10:55 +01:00
Lennart Poettering
9e73208afc execute: no need to synthesize $HOME for uid==0 again, get_home_dir() already does that 2019-03-12 16:10:55 +01:00
Lennart Poettering
7bbead1d0b execute: simplify paths we set as HOME/SHELL for invoked programs 2019-03-12 16:10:55 +01:00
Lennart Poettering
db246781a0 user-util: simplify paths retrieved from $HOME and $SHELL
Let's add some extra paranoia, after #11910
2019-03-12 16:10:55 +01:00
Lennart Poettering
d575f88bbe user-util: be more strict when reading $HOME and $SHELL 2019-03-12 16:10:55 +01:00
Lennart Poettering
47436d30bb user-util: paranoia — add overflow check on ERANGE loop 2019-03-12 16:10:55 +01:00
Lennart Poettering
11de56b9fa user-util: use SYNTHETIC_ERRNO() where we can 2019-03-12 16:08:57 +01:00
Lennart Poettering
0b78b1370c path-util: minimize variable scope 2019-03-12 16:08:57 +01:00
Lennart Poettering
458e60b3a9 path-util: check validity before normalization in path_simplify_and_warn()
As the normalization check includes a validation check the order
matters.
2019-03-12 16:08:57 +01:00
Lennart Poettering
71ae7b576c user-util: filter out invalid user record data a bit more thorougly 2019-03-12 16:08:57 +01:00
Lennart Poettering
cd13d971dc logind: normalize home path when creating user object
Triggered by: #11910
2019-03-12 16:08:57 +01:00
Zbigniew Jędrzejewski-Szmek
f5164dfebc
Merge pull request #11964 from mrc0mmand/even-more-fuzzers
fuzz: add fuzzers for calendar & time expressions
2019-03-12 15:08:20 +01:00
Davide Cavalca
1485aacb16 meson: scope more git invocations with current_source_dir() 2019-03-12 15:01:47 +01:00
Zbigniew Jędrzejewski-Szmek
fb6692ed33
Merge pull request #11927 from poettering/network-namespace-path
Add NetworkNamespacePath= to unit files
2019-03-12 14:29:14 +01:00
Sylvain Plantefève
461c92f5ab po: update French translation 2019-03-12 13:54:29 +01:00
Zbigniew Jędrzejewski-Szmek
388d2993ec shared/bootspec: avoid going through -1 when calculating array index
Coverity was complaining in CID#1399407 that config->entries might be used
while NULL. Let's add an assert to make sure it's not.

Also, let's quit early if we have no entries to loop through. The code was
not incorrect, but it's cleaner to avoid any negative indices.
2019-03-12 13:32:45 +01:00
Zbigniew Jędrzejewski-Szmek
7a2cb0228c boot: avoid 32-bit calculation for a 64-bit lvalue
Coverity CID#1399116:
> Potentially overflowing expression
> gpt_header_buffer.gpt_header.SizeOfPartitionEntry * gpt_header_buffer.gpt_header.NumberOfPartitionEntries
> with type unsigned int (32 bits, unsigned) is evaluated using 32-bit
> arithmetic, and then used in a context that expects an expression of type
> UINTN (64 bits, unsigned).

Let's import the ALIGN_TO macro to sd-boot and use it to avoid the issue.
2019-03-12 13:32:45 +01:00
Zbigniew Jędrzejewski-Szmek
ec637f309f
Merge pull request #11943 from yuwata/device-action-seqnum-cleanups
sd-device: store parsed SEQNUM and ACTION string
2019-03-12 13:17:33 +01:00
Frantisek Sumsal
55a365cb74 fuzz: add a fuzzer for time utils 2019-03-12 12:04:25 +01:00
Frantisek Sumsal
415b3f0bb2 fuzz: add a fuzzer for calendarspec 2019-03-12 11:57:09 +01:00
Yu Watanabe
ca66b69d5b bash-completion: also suggest units in reloading or activating
Closes #11942.
2019-03-12 11:25:26 +01:00
Zbigniew Jędrzejewski-Szmek
a729e42d4b
Merge pull request #11897 from mrc0mmand/parallelize-TEST-24-UNIT-TESTS
test: parallelize tasks in TEST-24-UNIT-TESTS
2019-03-12 11:21:06 +01:00
Evgeny Vereshchagin
7ba5ded9db lgtm: replace the query used for looking for fgets with a more general query
to make it easier to comlain about `strtok` :-)

Inspired by https://github.com/systemd/systemd/pull/11963, which, in turn,
was prompted by https://github.com/systemd/systemd/pull/11555.
2019-03-12 10:08:23 +01:00
Zbigniew Jędrzejewski-Szmek
694fe6daf5 man: say $BOOT not /boot in kernel-install(8) 2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek
cf73f65089 kernel-install: create the entry directory only if $BOOT/$MACHINE_ID exists
Things are currently fairly ugly in Fedora: we create $BOOT/$MACHINE_ID/$KERNEL_VERSION/,
and then 20-grub.install that is installed by grub2-common.rpm wants to remove that
directory before 50-dracut.install get a chance to run. 50-dracut.install
checks for the presence of that directory to decide where to install the
kernel. So let's make the creation of the directory conditional. Previous
commit changes bootctl install to create $BOOT/$MACHINE_ID, and this commit
makes kernel-install not create it. In effect, the entry directory will only be
created if 'bootctl install' or something else created the parent directory.

https://bugzilla.redhat.com/show_bug.cgi?id=1648907
2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek
341890de86 bootctl: create $BOOT/<machine-id> when installing sd-boot 2019-03-12 09:45:16 +01:00
Zbigniew Jędrzejewski-Szmek
d271c5d345 kernel-install: rename $BOOT_DIR[_ABS] to $ENTRY_DIR[_ABS]
"BOOT" is misleading, because it sounds like this refers to /boot or $BOOT,
when in fact it refers to some subdirectory. Those variable names are purely
interal, so we can change them. $BOOT_DIR_ABS was used in NEWS, but it should
not be (because it is an internal detail), so the old NEWS entry is reworded to
use "entry directory".
2019-03-12 09:45:16 +01:00
Yu Watanabe
1f682e243f udev: fix memleak in 'udevadm trigger --settle'
Fixes #11966.
2019-03-12 09:15:02 +01:00
Yu Watanabe
7905e6d70e test: wait for a while active state of .device is updated 2019-03-12 09:49:58 +09:00
Lennart Poettering
995cbd72b2 efivars: make sure efi_loader_entry_name_valid() is always compiled in
The string validation should always be done correctly, and not fail just
because EFI is turned off. After all an EFI loader entry name string
remains properly formatted regardless if EFI is on or off...

Fixes: #11948
2019-03-11 21:12:23 +01:00
Yu Watanabe
40769ccc73 libudev: use device_get_seqnum() and device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
91bd2c349b login: use device_is_in_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a7f95575b1 network: use device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a7395c867e core/device: use device_get_action() 2019-03-12 03:49:53 +09:00
Yu Watanabe
a12b87f59c udevadm-test: check action string earlier
The string will be checked later in device_new_from_synthetic_event(),
but let's check it earlier in parse_argv().
2019-03-12 03:49:53 +09:00
Yu Watanabe
2c18a85400 udevadm: use device_get_action() 2019-03-12 03:49:53 +09:00