1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-14 16:58:22 +03:00

3488 Commits

Author SHA1 Message Date
Luca Boccassi
8f3ec30c46 portablectl: fix regression when using --force without extension parameters
c18f4eb9e96836a made it possible to use --force with various verbs, by
going through the newer D-Bus methods. Except it didn't, as it regressed
during PR review refactorings, and nobody noticed because there were no
tests for it. Fix it, and add tests.

Follow-up for c18f4eb9e96836a6a8285ec42fd8a34c8909f6d9

(cherry picked from commit bdfa3f3a5c6d16d56d432e7bc52be0c03a5ce6ad)
(cherry picked from commit 0f27d7b9f9cda1aa4e0d56cabd517e9a95026cf2)
2023-08-09 23:04:43 +01:00
Yu Watanabe
2c2b89aede network-generator: make network file generated from ip=dhcp matches only physical interfaces
Otherwise, it also matches later created virtual devices, and that
breaks networks generated and managed by container management services,
like docker.

Closes #28626.

(cherry picked from commit c25aa6c8acc6d95eaacae7858a7057907d61a25e)
(cherry picked from commit d39bfd26d47793fc95aabfd9ff4f32e8d63d1021)
2023-08-09 23:04:43 +01:00
Franck Bui
8541307b23 test: install systemd-homed for openSUSE
This new sub-package has been recently introduced.

(cherry picked from commit 33ce0a899258ed8dfb4a234a9f67e678127d41f9)
(cherry picked from commit 65d5b3561c2692e947327e9a77d3b1b4d932c828)
2023-08-09 23:04:43 +01:00
Franck Bui
c65270ef5f test: console fonts are located in /usr/share on openSUSE
(cherry picked from commit ba0ff9fc0fa657024edd7a4a0aab01aa95b39ff5)
(cherry picked from commit ca0c8adf9d6d348cd59e12282e1effab4a39c5f3)
2023-08-09 23:04:43 +01:00
Dmitry V. Levin
95d651666a resolved: fix the canonical name returned by hosts lookup by name
In etc_hosts_lookup_by_name(), return the canonical name of the resolved
address instead of the name used to obtain that address.

Resolves: #20158
(cherry picked from commit 1ddc2f7fbceea4fb051eeb50d356285c7ef9519b)
2023-07-17 16:49:42 +02:00
Dmitry V. Levin
51884ccbca resolved: fix the canonical name returned by hosts lookup by address
In etc_hosts_lookup_by_address(), make sure the canonical name of the given
address is returned first in the list of names that address resolves to.

Resolves: #25088
(cherry picked from commit 0ff8f2a33a8f7c225860388faf43fa83f106cfe3)
2023-07-17 16:49:41 +02:00
Frantisek Sumsal
7977cbd830 test: make the root/data partition size configurable per test
(cherry picked from commit 0334afe4d01b0f24d06995bb3ee4f5c2ff7d58c6)
2023-07-09 20:41:50 +01:00
Frantisek Sumsal
7dc6cccc4b test: replace readfp() with read_file()
ConfigParser.readfp() has been deprecated since Python 3.2 and was
dropped completely in Python 3.11.

(cherry picked from commit ba4a1cd8a863f65ff016be72e520c323aa1e1a6f)
2023-07-07 19:30:52 +01:00
Yu Watanabe
f74337b756 test-network: add one more testcase for DHCPv4 classless route
For issue #28280.

(cherry picked from commit 86f6760038477e9e27ccea580f1b3b27328a98a7)
2023-07-07 19:30:52 +01:00
Yu Watanabe
abbd24e8a5 wait-online: request that at least one managed online interface exists
Fixes a regression caused by ab3aed4a0349bbaa26f53340770c1b59b463e05d.

I thought the commit does not cause any severe regression. However,
drivers for network interfaces may be loaded later. So, we should wait
if no network interface is found.

Fixes #27822.

(cherry picked from commit 2f96a29c2c55bdd67cdd8e0b0cfd6971968e4bca)
2023-07-07 19:30:52 +01:00
Yu Watanabe
21181e2e1c test-network: drop ExecReload= in networkd.service and udevd.service
Follow-up for 0e07cdb0e77d0322bc866b5e13abbe38e988059d and
f84331539deae28fbeb42d45ad0c8d583b3372a3.

(cherry picked from commit 62eaf8d039a14e7bc4e682fa3ad4b3bfe366c29a)
2023-07-07 19:30:52 +01:00
Yu Watanabe
f03f365dc1 test: update test for free area calculation in repart
(cherry picked from commit 937625c7c72e503d03b406de3e1859d7f00dbdcf)
2023-07-07 19:30:52 +01:00
Yu Watanabe
2cda7651ac test: add reproducer for issue #28225
(cherry picked from commit beba8f2e1e5f08041d2a9955398a64d92dcc75a0)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
1793682d98 test: wait for the interface to become routable after reconfiguring
Since 6e8477edd3 TEST-75 started failing with:

[  571.468298] testsuite-75.sh[46]: + for addr in "${DNS_ADDRESSES[@]}"
[  571.468298] testsuite-75.sh[46]: + run delv @fd00:dead:beef:cafe::1 -t A mail.signed.test
[  571.468899] testsuite-75.sh[562]: + tee /tmp/tmp.qKlHPbCCJZ
[  571.469317] testsuite-75.sh[561]: + delv @fd00:dead:beef:cafe::1 -t A mail.signed.test
[  571.501381] testsuite-75.sh[562]: ;; network unreachable resolving 'mail.signed.test/A/IN': fd00:dead:beef:cafe::1#53
[  571.501564] testsuite-75.sh[562]: ;; resolution failed: SERVFAIL
[  571.515457] testsuite-75.sh[46]: + grep -qF '; fully validated' /tmp/tmp.qKlHPbCCJZ

Let's wait for the dns0 interface to become routable again after
re-enabling IPv6 to, hopefully, mitigate this.

(cherry picked from commit f2492d39baa71748a20e774e7c95aec04571698a)
2023-07-07 19:30:52 +01:00
Yu Watanabe
16ddaafe3e test-network: add test for static route with preferred source
This adds possible reproducer for issue #28009 (though, the issue is
highly racy, hence this may not trigger the issue reliably).

(cherry picked from commit e4948bb2cdd1c8d1b6fc357e5b817170612aae33)
2023-07-07 19:30:52 +01:00
Yu Watanabe
a8db4fcac4 test-network: check route more strictly
(cherry picked from commit 7e30527806956b7240ca7bf8d92038170fda44d0)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
67aaab3381 test: fix test_vxlan with the latest iproute2
Some options were renamed and some options with default values are not
shown unless -d(etails) is repeated.

See: https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=1215e9d3862387353d8672296cb4c6c16e8cbb72
(cherry picked from commit a5e478b24c7c6bcb210a2fa7d3ccce1d381a19b7)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
884ab38057 core: reorder systemd arguments on reexec
When reexecuting system let's put our arguments carrying deserialization
info first followed by any existing arguments to make sure they get
parsed in case we get weird stuff from the kernel cmdline (like --).

See: https://github.com/systemd/systemd/issues/28184
(cherry picked from commit 06afda6b38d5d730fca3c65449096425933272bc)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
5a29fbba6c test: enable LSan for certain wrapped binaries
So we're able to detect memory leaks in our NSS modules.

An example after introducing a memory leak in nss-myhostname.c:

testsuite-71.sh[2881]: =================================================================
testsuite-71.sh[2881]: ==2880==ERROR: LeakSanitizer: detected memory leaks
testsuite-71.sh[2881]: Direct leak of 2 byte(s) in 1 object(s) allocated from:
testsuite-71.sh[2881]:     #0 0x7fa28907243b in strdup (/usr/lib64/libasan.so.8.0.0+0x7243b)
testsuite-71.sh[2881]:     #1 0x7fa286a7bc10 in gethostname_full ../src/basic/hostname-util.c:67
testsuite-71.sh[2881]:     #2 0x7fa286a74af9 in gethostname_malloc ../src/basic/hostname-util.h:24
testsuite-71.sh[2881]:     #3 0x7fa286a756f4 in _nss_myhostname_gethostbyname4_r ../src/nss-myhostname/nss-myhostname.c:79
testsuite-71.sh[2881]:     #4 0x7fa288f17588 in getaddrinfo (/lib64/libc.so.6+0xf4588)
testsuite-71.sh[2881]:     #5 0x7fa2890a4d93 in __interceptor_getaddrinfo.part.0 (/usr/lib64/libasan.so.8.0.0+0xa4d93)
testsuite-71.sh[2881]:     #6 0x55a54b2b7159 in ahosts_keys_int.part.0 (/usr/bin/getent.orig+0x4159)
testsuite-71.sh[2881]: SUMMARY: AddressSanitizer: 2 byte(s) leaked in 1 allocation(s).

(cherry picked from commit 2b5e786005d8854600bb43335fd0c4067ce8da08)
2023-07-07 19:30:52 +01:00
Luca Boccassi
39459a5d80 TEST-55-OOMD: use swap file instead of partition
The partition seems not to work on Ubuntu for some reason, use a
swap file instead

(cherry picked from commit f434f182ccfd17a214e4b07cec033318e6c4f7b2)
2023-07-07 19:30:52 +01:00
Luca Boccassi
9654140f34 TEST-55-OOMD: use 'stress' to create high pressure
The test fails on my machine, running Debian stable, because
testsuite-55-testbloat.service just swaps and never goes over the
limit, so it's not killed. Use 'stress' instead which seems to be
able to overwhelm the swap too.

(cherry picked from commit 937e82cb7d82dbdbd287d82f4708f15d6032eb9f)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
fdc6ce1d00 test: test transactions with cycles
Provides coverage for systemd/systemd#26872.

With systemd/systemd#26875 reverted:

[16444.287652] testsuite-03.sh[71]: + for i in {0..19}
[16444.287652] testsuite-03.sh[71]: + systemctl start transaction-cycle0.service
[16444.359503] systemd[1]: =================================================================
[16444.360321] systemd[1]: ==1==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6180002e578e at pc 0x7f73b25ec7a6 bp 0x7ffc5531c6f0 sp 0x7ffc5531be68
[16444.360798] systemd[1]:
[16444.361044] systemd[1]: READ of size 783 at 0x6180002e578e thread T0 (systemd)
[16444.391684] systemd[1]:     #0 0x7f73b25ec7a5  (/lib64/libasan.so.5+0x557a5)
[16444.392167] systemd[1]:     #1 0x7f73b260a1d5 in __interceptor_vasprintf (/lib64/libasan.so.5+0x731d5)
[16444.392442] systemd[1]:     #2 0x7f73afa1d1e1 in log_format_iovec ../src/basic/log.c:996
[16444.392750] systemd[1]:     #3 0x7f73afa1e7b6 in log_struct_internal ../src/basic/log.c:1058
[16444.393101] systemd[1]:     #4 0x7f73b1979136 in transaction_verify_order_one ../src/core/transaction.c:392
[16444.393540] systemd[1]:     #5 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.393946] systemd[1]:     #6 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.394262] systemd[1]:     #7 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.394532] systemd[1]:     #8 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
[16444.394812] systemd[1]:     #9 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463
...

(cherry picked from commit 0651e717496aed30bcec7740286d719860995625)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
68c7905d9c test: make sure we get PID1's stack trace on ASan/UBSan errors
As hitting an ASan/UBSan error in PID1 results in a crash (and a kernel
panic when running under qemu), we usually lose the stack trace which
makes debugging quite painful. Let's mitigate this by forwarding the
stack trace to multiple places - namely to a file and the syslog.

(cherry picked from commit 88c98cb2614a2893ec2ae7197a1f234b579da7a7)
2023-07-07 19:30:52 +01:00
Lennart Poettering
85401466ea hostnamed: when parsing day/month of firmware date, force decimal parsing
safe_atou() by default determines the base from the prefix 0x, 0b, 0o
and for compat with just 0 for octal. This is not what we want here,
since the date components are padded with zeroes yet still decimal.
Hence force decimal parsing (and while we are at it, prohibit a couple
of unexpected decorations).

WIthout this we'd fail to parse any the 8th and 9th day of each months, as
well aus aug and september of every year, because these look like octal
numbers but cannot actually parsed as such.

Let's change the testcase to check for a date that exposes this
bheaviour.

(cherry picked from commit 7dad6de158cbc280988efa9e52e6d2b9c840ea9f)
2023-07-07 19:30:52 +01:00
Lennart Poettering
75e96639a6 hostnamed: don't read DMI data within a container
If we run in a container we should show info about the container, not
the host.

(cherry picked from commit e7932afe1bb91412c8ff26dba46513605199196e)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
aaa436c2d7 test: wrap curl when running with ASan
Necessary (unfortunately) for curl on C8S.

(cherry picked from commit 033601b79ae00784bfaab9ea91fe70ecff83d645)
2023-07-07 19:30:52 +01:00
Luca Boccassi
3cbc30f309 TEST-55-OOMD: improve ephemeral configuration readability
(cherry picked from commit 6acbb3f2fb234d9903c15571472d95afee9d08c1)
2023-07-07 19:30:52 +01:00
Luca Boccassi
622c177450 TEST-55-OOMD: use /run/ for configuration instead of /etc/
Make sure configuration is ephemeral if the image is reused

(cherry picked from commit 565b13f8b2895a2656fac677fe4ed3f6344e66b2)
2023-07-07 19:30:52 +01:00
Yu Watanabe
a1ea2159af networkd-test.py: disable global DNS= setting
Otherwise, queries may be passed to unexpected DNS servers.

(cherry picked from commit 5063f027ef669a934133465b875fd68f0b4d6794)
2023-07-07 19:30:52 +01:00
Yu Watanabe
eff4610088 networkd-test.py: do not query IPv6 address
From changelog of dnsmasq v2.87:
====
Note in manpage the change in behaviour of -address. This behaviour
actually changed in v2.86, but was undocumented there. From 2.86 on,
(eg) --address=/example.com/1.2.3.4 ONLY applies to A queries. All other
types of query will be sent upstream. Pre 2.86, that would catch the
whole example.com domain and queries for other types would get
a local NODATA answer. The pre-2.86 behaviour is still available,
by configuring --address=/example.com/1.2.3.4 --local=/example.com/
====

(cherry picked from commit 55f9d72a5daa3d6f707878c0a50f856543c7de27)
2023-07-07 19:30:52 +01:00
Yu Watanabe
67a4b8a530 networkd-test.py: replace deprecated option IPv6AcceptRouterAdvertisements=
Also, use 'yes' or 'no' for boolean options.

(cherry picked from commit 77725adedddf079bd5b9b68d7597a3644e0b8ebe)
2023-07-07 19:30:52 +01:00
Yu Watanabe
11d575859c networkd-test.py: show more debugging logs on failure
(cherry picked from commit eeb88ea41d7f3c62a7cc72224a3aebb9e03565ad)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
c35624663b test: set $PATH to something predictable in the ASan wrapper
This is still necessary when running with clang's ASan, as it uses an
external binary to symbolize the stack traces.

Follow-up to ba79e8c2ccd.

(cherry picked from commit 3bba91ef44f58ed98ed46c76fbf16db21cef5c25)
2023-07-07 19:30:52 +01:00
Henrik Holst
20607d7e0c network: make degraded-carrier bond/bridge as routable (#27776)
This makes a bond or bridge interface in the degraded-carrier state but has a routable address
handled as routable operational state.

If the carrier is degraded but the address state is routable then the operational state should be
seen as routable and not degraded because that may be the case for bonds if some of the links are down,
but when that happens the bond as whole is still routable.

This also makes operational state to degraded if address state is degraded even if the link state is
degraded-carrier.

Fixes #22713.

(cherry picked from commit cf4dbd84ac31bbfcab905bc02bf03f67acca7413)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
323744b0c3 test: re-enable TEST-02 on ppc64le
(cherry picked from commit fb310ba9ebb1a4f2b6fc76c75b3bb9a99f1a2a9a)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
bcd2cf8932 test: make sure ping works for unprivileged users
(cherry picked from commit f087837c46d77745425fd9b84f1de9e5703836af)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
984104ce29 test: copy file xattrs (if any) as well
(cherry picked from commit a6695a431fec4291c956bbbecda19c468ccccb1d)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
622311c25b test: wrap agetty & getfacl when running with sanitizers
The list is getting slightly ridiculous.

(cherry picked from commit 8e81885531b23b3f6787cfe29d952469b31976ed)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
7405e06205 test: drop $SKIP_INITRD
It's pointless nowadays, since we always need an initrd for the test VMs
as we require modules that are usually not compiled in the kernel.

(cherry picked from commit 93b896e90e6da99c0436ab69dfaf384784358605)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
3909cb2133 test: rebuild the ldconfig cache after changing its configuration
Follow-up to ba79e8c2cc.

(cherry picked from commit 25bc4697275ba5ef395160c716ca3e7f63d3eaba)
2023-07-07 19:30:52 +01:00
Luca Boccassi
2cdc1686c8 tests: fix shellcheck warnings
(cherry picked from commit 6aea5ce814c0723474e0741df45dbf2c202ba739)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
49a356f9d6 test: add a reasoning why we don't use the SELinux-provided units
(cherry picked from commit 8c0ace5739789a971b8591f53eb94200aeec2c66)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
d452dd7a37 test: make sure we unmount /var late during shutdown
To avoid the "mountpoint is busy" error.

(cherry picked from commit d7c1df84d9e9da81889e44836b054a1af94620e5)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
a1ef8dbd15 test: add a couple more tests for systemd-cryptsetup
(cherry picked from commit eb26f34a0951f994fe3c1e6d1bc97db12db26844)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
c608d7ca85 test: make check_result_*() set -e friendly
(cherry picked from commit 71d7f02cc7dc1bf5b8506c90571cb980ec706def)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
f2283f6c62 test: use check_result_common()
The TEST-24 has been silently timing out for quite a while in the C8S
job, as the check_result_qemu() override lacked some error checks,
whoopsie.

(cherry picked from commit e6faf0ee22cb7a449f1462f5a032110b46be31d5)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
5321f67a63 test: clean up the test cleanup a bit
(cherry picked from commit 168ccb879f48b0051c2abd184c78154ab17af0fd)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
1194822aa2 test: minor cleanup
No functional change.

(cherry picked from commit 00c2676972b62edff09ae612286e814bf9d4a574)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
033d8ab57e test: make the data partition larger for the cryptsetup test
As we use it for /var and with the default 100 MiB there's not enough
space for the journal.

(cherry picked from commit b7e913841b1136dc4f15415df27f95fe67923b08)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
b02be950c4 test: introduce test_require_bin() and use it
No functional change.

(cherry picked from commit 70bdf6e661f67dfbfd6a198f7d1ebc6fdf0dce62)
2023-07-07 19:30:52 +01:00