Commit Graph

1656 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek a18c7865be meson: do not install testdata when -Dinstall-tests=false
Fixes #16447.
2020-07-14 14:57:04 +02:00
gaoyi 0d3a8bc7eb test: add test case for multi matches when use "||"
Signed-off-by: gaoyi <ymuemc@163.com>
2020-07-12 03:27:45 -04:00
Yu Watanabe 5157d719f0
Merge pull request #16411 from ddstreet/bridge_without_carrier_fails
Bridge without carrier fails
2020-07-09 14:01:45 +09:00
Zbigniew Jędrzejewski-Szmek 55aacd502b
Merge pull request #15891 from bluca/host_os_release
Container Interface: expose the host's os-release metadata to nspawn and portable guests
2020-07-08 23:52:13 +02:00
Dan Streetman 001c07cfff test-netowrk: in test_bridge_configure_without_carrier, avoid strange test failures
For some reason the wait-online is failing intermittently; it's unclear
exactly why, but this hopefully avoids the failure for unrelated PR.

This is a workaround (not fix) for #16105
2020-07-08 17:05:03 -04:00
Zbigniew Jędrzejewski-Szmek 48c190822b Merge pull request #16405 from sipraga/master 2020-07-08 22:32:04 +02:00
Dan Streetman 4e3376d43a test-network: don't print networkctl output for passing subtests
This just clutters up the logs.
2020-07-08 16:13:14 -04:00
Frantisek Sumsal 2e7090e94d test: bump the TEST-47 sleeps once again
Several recent failed runs show that the test is still racy in two ways:

1) Sometimes it takes a while before the PID file is created, leading
   to:

```
[   10.950540] testsuite-47.sh[308]: ++ cat /leakedtestpid
[   10.959712] testsuite-47.sh[308]: cat: /leakedtestpid: No such file or directory
[   10.959824] testsuite-47.sh[298]: + leaked_pid=
```

2) Again, sometimes we check the leaked PID before the unit is actually
   stopped, leading to a false negative:

```
[   18.099599] testsuite-47.sh[346]: ++ cat /leakedtestpid
[   18.116462] testsuite-47.sh[333]: + leaked_pid=342
[   18.117101] testsuite-47.sh[333]: + systemctl stop testsuite-47-repro
...
[   20.033907] testsuite-47.sh[333]: + ps -p 342
[   20.080050] testsuite-47.sh[351]:     PID TTY          TIME CMD
[   20.080050] testsuite-47.sh[351]:     342 ?        00:00:00 sleep
[   20.082040] testsuite-47.sh[333]: + exit 42
```
2020-07-08 22:09:55 +02:00
Alvin Šipraga 0d0de133f0 network: add support for MACVLAN source mode
Add support for creating a MACVLAN interface in "source" mode by
specifying Mode=source in the [MACVLAN] section of a .netdev file.

A list of allowed MAC addresses for the corresponding MACVLAN can also
be specified with the SourceMACAddress= option of the [MACVLAN] section.

An example .netdev file:

    [NetDev]
    Name=macvlan0
    Kind=macvlan
    MACAddress=02:DE:AD:BE:EF:00

    [MACVLAN]
    Mode=source
    SourceMACAddress=02:AB:AB:AB:AB:01 02:CD:CD:CD:CD:01
    SourceMACAddress=02:EF:EF:EF:EF:01

The same keys can also be specified in [MACVTAP] for MACVTAP kinds of
interfaces, with the same semantics.
2020-07-08 18:01:52 +02:00
Zbigniew Jędrzejewski-Szmek 9870cfdf7f
Merge pull request #16388 from keszybz/xdg-desktop-fuzz-case
xdg-desktop fuzz case
2020-07-07 19:41:31 +02:00
Zbigniew Jędrzejewski-Szmek d1ca1f7c2a xdg-autostart: avoid quadratic behaviour in strv parsing
The fuzzer test case has a giant line with ";;;;;;;;;;;..." which is turned into
a strv of empty strings. Unfortunately, when pushing each string, strv_push() needs
to walk the whole array, which leads to quadratic behaviour. So let's use
greedy_allocation here and also keep location in the string to avoid iterating.

build/fuzz-xdg-desktop test/fuzz/fuzz-xdg-desktop/oss-fuzz-22812  51.10s user 0.01s system 99% cpu 51.295 total
↓
build/fuzz-xdg-desktop test/fuzz/fuzz-xdg-desktop/oss-fuzz-22812  0.07s user 0.01s system 96% cpu 0.083 total

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22812.

Other minor changes:
- say "was already defined" instead of "defined multiple times" to make it
  clear that we're ignoring this second definition, and not all definitions
  of the key
- unescaping needs to be done also for the last entry
2020-07-07 12:20:43 +02:00
Zbigniew Jędrzejewski-Szmek 9ecf5d9340 fuzz: add test case that should already be resolved 2020-07-07 10:26:28 +02:00
Luca Boccassi cda667722c core: refresh unit cache when building a transaction if UNIT_NOT_FOUND
When a command asks to load a unit directly and it is in state
UNIT_NOT_FOUND, and the cache is outdated, we refresh it and
attempto to load again.
Use the same logic when building up a transaction and a dependency in
UNIT_NOT_FOUND state is encountered.
Update the unit test to exercise this code path.
2020-07-07 10:09:24 +02:00
Susant Sahani 98ebef62c7 DHCPv4: client add support for DHCP server allow list 2020-07-06 22:28:54 +02:00
Vito Caputo e26538dd04 network: tc: fix n_prio bounds check
Looks like a simple copy and paste error

Fixes https://github.com/systemd/systemd/issues/16367
2020-07-06 15:52:17 +02:00
Frantisek Sumsal bf795c47bc test: use KILL instead of SIGKILL in TEST-52-HONORFIRSTSHUTDOWN
SIG-prefixed signals for `kill` are not POSIX compliant, so on Ubuntu CI
(which defaults to dash instead of bash) the TEST-52 contains following
error:

[ 9693.549638] sh[51]: + systemctl poweroff --no-block
[ 9693.553130] systemd-logind[26]: System is powering down.
[ 9693.608911] sh[54]: /bin/sh: 1: kill: Illegal option -S

This can be reproduced manually as well, either by running dash, or bash
in POSIX mode:

$ dash -c 'kill -SIGKILL 123'
dash: 1: kill: Illegal option -S

$ bash --posix -c 'kill -SIGKILL 123'
bash: line 0: kill: SIGKILL: invalid signal specification
2020-07-05 11:00:57 +01:00
Yu Watanabe c03ef420fa network: tc: rename several settings which take size in bytes 2020-07-02 16:51:11 +02:00
Yu Watanabe 3d2c26925f test-network: add tests for SR-IOV
This also adjusts test_sysctl_disable_ipv6(), as rt_trap flag may be
added to routes on some environments.
2020-07-01 13:51:35 +09:00
Yu Watanabe c3a5025dc6 network: add MACAddress= setting in [SR-IOV] section 2020-07-01 13:51:35 +09:00
Yu Watanabe e64b31c848 network: add VLANProtocol= setting in [SR-IOV] section 2020-07-01 13:51:35 +09:00
Susant Sahani 518cd6b527 network: Introduce SR-IOV
SR-IOV provides the ability to partition a single physical PCI
resource into virtual PCI functions which can then be injected in
to a VM. In the case of network VFs, SR-IOV improves north-south n
etwork performance (that is, traffic with endpoints outside the
host machine) by allowing traffic to bypass the host machine’s network stack.
2020-07-01 13:51:33 +09:00
Zbigniew Jędrzejewski-Szmek 6c3a19d5b3
Merge pull request #16313 from yuwata/network-move-ipv6ll-gen-mode
network: move IPv6LinkLocalAddressGenerationMode= to [Network] section
2020-06-30 17:13:02 +02:00
Luca Boccassi 7233e91af0 core: store timestamps of unit load attempts
When the system is under heavy load, it can happen that the unit cache
is refreshed for an unrelated reason (in the test I simulate this by
attempting to start a non-existing unit). The new unit is found and
accounted for in the cache, but it's ignored since we are loading
something else.
When we actually look for it, by attempting to start it, the cache is
up to date so no refresh happens, and starting fails although we have
it loaded in the cache.

When the unit state is set to UNIT_NOT_FOUND, mark the timestamp in
u->fragment_loadtime. Then when attempting to load again we can check
both if the cache itself needs a refresh, OR if it was refreshed AFTER
the last failed attempt that resulted in the state being
UNIT_NOT_FOUND.

Update the test so that this issue reproduces more often.
2020-06-30 16:50:00 +02:00
Yu Watanabe 6f6296b93f network: move IPv6LinkLocalAddressGenerationMode= to [Network] section
This also moves and renames variables and functions.

Follow-ups for a6f1848a23.
2020-06-30 18:58:52 +09:00
Frantisek Sumsal 8f843190ff test: bump the timeout for systemd-hwdb-update.service under ASan
Since the hwdb update from a79be2f807
the systemd-hwdb-update service started timing out under ASan when
compiled with gcc, as we started tripping over the 3 minutes timeout.

This affects only gcc runs, since the current gcc on Arch still suffers
from the detect_stack_use_after_return performance penalty[0]. Until
the fixed gcc is present in the respective repositories, let's bump
the timeout to 4 minutes, as we might not be able to upgrade right
away, due to systemd/systemd#16199.

Before the hwdb update:
[ 7958.292540] systemd[63]: systemd-hwdb-update.service: Executing: /usr/bin/time systemd-hwdb update
[ 7958.304005] systemd[1]: systemd-journald.service: Got notification message from PID 44 (FDSTORE=1)
[ 7958.314434] systemd[1]: systemd-journald.service: Added fd 3 (n/a) to fd store.
[ 8008.520082] systemd[1]: systemd-journald.service: Got notification message from PID 44 (WATCHDOG=1)
[ 8068.520151] systemd[1]: systemd-journald.service: Got notification message from PID 44 (WATCHDOG=1)
[ 8125.682843] time[63]: 84.47user 82.92system 2:47.50elapsed 99%CPU (0avgtext+0avgdata 811512maxresident)k
[ 8125.682843] time[63]: 0inputs+19680outputs (0major+25000853minor)pagefaults 0swaps

After the hwdb update:
[ 6215.491958] systemd[63]: systemd-hwdb-update.service: Executing: /usr/bin/time systemd-hwdb update
[ 6215.503380] systemd[1]: systemd-journald.service: Got notification message from PID 44 (FDSTORE=1)
[ 6215.514172] systemd[1]: systemd-journald.service: Added fd 3 (n/a) to fd store.
[ 6329.392918] systemd[1]: systemd-journald.service: Got notification message from PID 44 (WATCHDOG=1)
[ 6394.920205] time[63]: 89.48user 89.98system 2:59.55elapsed 99%CPU (0avgtext+0avgdata 812764maxresident)k
[ 6394.920205] time[63]: 0inputs+20568outputs (0major+27318354minor)pagefaults 0swaps

[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94910
2020-06-29 16:07:11 +02:00
Gaoyi 0090b551e6 Add quotes for -n
According to SC2070, -n doesn't work with unquoted arguments
https://github.com/koalaman/shellcheck/wiki/SC2070

Signed-off-by: Gaoyi <ymuemc@163.com>
2020-06-26 15:12:29 +02:00
Zbigniew Jędrzejewski-Szmek 3f11426f52
Merge pull request #16275 from yuwata/network-deprecate-netdevsim
network: deprecate netdevsim support
2020-06-25 18:41:49 +02:00
Zbigniew Jędrzejewski-Szmek 98506a41fe
Merge pull request #15697 from OhNoMoreGit/fix-path-units
Recheck PathExists=, PathExistsGlob=, DirectoryNotEmpty= when triggered unit terminates
2020-06-25 18:23:47 +02:00
Lennart Poettering f49bead3b0
Merge pull request #16257 from keszybz/two-fuzzer-issues
Two fuzzer issues
2020-06-25 14:40:35 +02:00
Yu Watanabe 440988666c test-network: remove unused config 2020-06-25 17:30:19 +09:00
Luca Boccassi d4d55b0d13 core: add RootHashSignature service parameter
Allow to explicitly pass root hash signature as a unit option. Takes precedence
over implicit checks.
2020-06-25 08:45:21 +01:00
Lennart Poettering 6b000af4f2 tree-wide: avoid some loaded terms
https://tools.ietf.org/html/draft-knodel-terminology-02
https://lwn.net/Articles/823224/

This gets rid of most but not occasions of these loaded terms:

1. scsi_id and friends are something that is supposed to be removed from
   our tree (see #7594)

2. The test suite defines an API used by the ubuntu CI. We can remove
   this too later, but this needs to be done in sync with the ubuntu CI.

3. In some cases the terms are part of APIs we call or where we expose
   concepts the kernel names the way it names them. (In particular all
   remaining uses of the word "slave" in our codebase are like this,
   it's used by the POSIX PTY layer, by the network subsystem, the mount
   API and the block device subsystem). Getting rid of the term in these
   contexts would mean doing some major fixes of the kernel ABI first.

Regarding the replacements: when whitelist/blacklist is used as noun we
replace with with allow list/deny list, and when used as verb with
allow-list/deny-list.
2020-06-25 09:00:19 +02:00
Zbigniew Jędrzejewski-Szmek f23810da20 fuzz-udev-rules: -ENOBUFS should be accepted too
In udev_rules_load(), add a debug message. Otherwise there'd be no indication
that parsing was aborted.
2020-06-25 08:51:21 +02:00
Zbigniew Jędrzejewski-Szmek 85fbebe61a journal: fix buffer overrun when urlifying
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21122.

message is only valid until message_len, and we need to make sure we're not
reading pass that. Bug introduced in 2108b56749.
2020-06-25 08:51:21 +02:00
Lennart Poettering c4e90266db
Merge pull request #16093 from yuwata/network-htb-add-settings-15213
network: tc: add several settings for HTB
2020-06-24 19:07:41 +02:00
Lennart Poettering f9044b74c5
Merge pull request #16106 from yuwata/network-tc-ets
network: tc: introduce ETS
2020-06-24 19:04:43 +02:00
Zbigniew Jędrzejewski-Szmek f83803a649
Merge pull request #16238 from keszybz/set-handling-more
Fix handling of cases where a duplicate item is added to a set and related cleanups
2020-06-24 17:42:13 +02:00
Zbigniew Jędrzejewski-Szmek fcc1d0315d basic/set: add set_ensure_consume()
This combines set_ensure_allocated() with set_consume(). The cool thing is that
because we know the hash ops, we can correctly free the item if appropriate.
Similarly to set_consume(), the goal is to simplify handling of the case where
the item needs to be freed on error and if already present in the set.
2020-06-24 10:38:15 +02:00
Jay Burger a1ba8c5b71 feature to honor first shutdown request to completion
Create unit tests per established norm at position 52

check in_set first before getting unit
2020-06-24 09:42:01 +02:00
Luca Boccassi e1bb4b0d1d nspawn: implement container host os-release interface 2020-06-23 12:58:21 +01:00
Luca Boccassi 0389f4fa81 core: add RootHash and RootVerity service parameters
Allow to explicitly pass root hash (explicitly or as a file) and verity
device/file as unit options. Take precedence over implicit checks.
2020-06-23 10:50:09 +02:00
Elisei Roca 9e1732924d
test-functions: read /usr/etc/nsswitch.conf if /etc/nsswitch.conf does not exist (#16195)
See this for more info why and since when this change is needed: https://build.opensuse.org/request/show/807179.
2020-06-23 07:42:15 +02:00
Zbigniew Jędrzejewski-Szmek 2edc494216
Merge pull request #16237 from keszybz/revert-message-type-check
Revert "bus-message: immediately reject messages with invalid type"
2020-06-22 22:46:13 +02:00
Zbigniew Jędrzejewski-Szmek b17af3e503 bus-message: avoid dereferencing a NULL pointer
We'd try to map a zero-byte buffer from a NULL pointer, which is undefined behaviour.

src/systemd/src/libsystemd/sd-bus/bus-message.c:3161:60: runtime error: applying zero offset to null pointer
    #0 0x7f6ff064e691 in find_part /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3161:60
    #1 0x7f6ff0640788 in message_peek_body /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3283:16
    #2 0x7f6ff064e8db in enter_struct_or_dict_entry /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:3967:21
    #3 0x7f6ff06444ac in bus_message_enter_struct /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:4009:13
    #4 0x7f6ff0641dde in sd_bus_message_enter_container /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-message.c:4136:21
    #5 0x7f6ff0619874 in sd_bus_message_dump /work/build/../../src/systemd/src/libsystemd/sd-bus/bus-dump.c:178:29
    #6 0x4293d9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/fuzz/fuzz-bus-message.c:39:9
    #7 0x441986 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:558:15
    #8 0x44121e in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:470:3
    #9 0x443164 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:770:7
    #10 0x4434bc in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:799:3
    #11 0x42d2bc in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:846:6
    #12 0x42978a in main /src/libfuzzer/FuzzerMain.cpp:19:10
    #13 0x7f6fef13c82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #14 0x407808 in _start (out/fuzz-bus-message+0x407808)
2020-06-22 17:09:49 +02:00
Zbigniew Jędrzejewski-Szmek 804a436582 fuzz-netdev-parser: add test case for earlier version of preceding patches
AddressSanitizer:DEADLYSIGNAL
=================================================================
==12==ERROR: AddressSanitizer: ABRT on unknown address 0x00000000000c (pc 0x7f0a518b3428 bp 0x7fffa463bfd0 sp 0x7fffa463be68 T0)
SCARINESS: 10 (signal)
    #0 0x7f0a518b3428 in raise (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
    #1 0x7f0a518b5029 in abort (/lib/x86_64-linux-gnu/libc.so.6+0x37029)
    #2 0x7f0a52ca635a in log_assert_failed_realm /work/build/../../src/systemd/src/basic/log.c:819:9
    #3 0x4eea92 in config_parse_wireguard_endpoint /work/build/../../src/systemd/src/network/netdev/wireguard.c:808:9
    #4 0x7f0a52b2f74e in next_assignment /work/build/../../src/systemd/src/shared/conf-parser.c:133:32
    #5 0x7f0a52b2954e in parse_line /work/build/../../src/systemd/src/shared/conf-parser.c:242:16
    #6 0x7f0a52b28911 in config_parse /work/build/../../src/systemd/src/shared/conf-parser.c:377:21
    #7 0x7f0a52b29ec6 in config_parse_many_files /work/build/../../src/systemd/src/shared/conf-parser.c:439:21
    #8 0x7f0a52b2a5a6 in config_parse_many /work/build/../../src/systemd/src/shared/conf-parser.c:507:16
    #9 0x4d8d6c in netdev_load_one /work/build/../../src/systemd/src/network/netdev/netdev.c:732:13
    #10 0x4d3e2b in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/network/fuzz-netdev-parser.c:23:16
    #11 0x6b3266 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/libfuzzer/FuzzerLoop.cpp:558:15
    #12 0x6af860 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/libfuzzer/FuzzerLoop.cpp:470:3
    #13 0x6b6970 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:770:7
    #14 0x6b7376 in fuzzer::Fuzzer::Loop(std::__1::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/libfuzzer/FuzzerLoop.cpp:799:3
    #15 0x67573f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/libfuzzer/FuzzerDriver.cpp:846:6
    #16 0x667097 in main /src/libfuzzer/FuzzerMain.cpp:19:10
    #17 0x7f0a5189e82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #18 0x4295a8 in _start (out/fuzz-netdev-parser+0x4295a8)

DEDUP_TOKEN: raise--abort--log_assert_failed_realm
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: ABRT (/lib/x86_64-linux-gnu/libc.so.6+0x35428) in raise
==12==ABORTING
2020-06-22 16:32:37 +02:00
Daan De Meyer bc694c06e6 log: Prefer logging to CLI unless JOURNAL_STREAM is set 2020-06-22 14:23:48 +02:00
Yu Watanabe b753e8358c test-network: add tests for ETS 2020-06-19 01:10:51 +09:00
Yu Watanabe d474aa51bf network: tc: introduce Enhanced Transmission Selection (ETS)
Closes #15264.
2020-06-19 01:07:45 +09:00
Lennart Poettering 2a71d57f4e network: clean-up DHCP lease server data configuration
This is an attempt to clean up the POP3/SMTP/LPR/… DHCP lease server
data logic in networkd. This reduces code duplication and fixes a number
of bugs.

This removes any support for collecting POP3/SMPT/LPR servers acquired
via local DHCP client releases since noone uses that, and given how old
these protocols are I doubt this will change. It keeps support for
configuring them for the dhcp server however.

The differences between the DNS/NTP/SIP/POP3/SMTP/LPR configuration
logics are minimized.

This removes the relevant symbols from sd-network.h (which is an
internal API only at this point after all).

This is unfortunately not well test, given the old code for this had
barely any tests. But the new code should not perform worse at least,
and allow us to release, since it corrects some interfaces visible in
the .network configuration format.

Fixes: #15943
2020-06-18 13:08:18 +09:00
Yu Watanabe 2ee7e54b9e test-network: add tests for HTB settings 2020-06-17 16:52:03 +09:00