1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-21 18:03:41 +03:00

3325 Commits

Author SHA1 Message Date
Yu Watanabe
0531c47e96 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)
(cherry picked from commit abbd24e8a51d9b6ffcf99c8cfe89d9faba23ebdb)
2023-09-08 16:35:10 +01:00
Yu Watanabe
5ad5807106 test-network: add testcase for no managed interface
(cherry picked from commit 56dfde0d5451380bfc119742cd8f6d8aed2bc9d0)
2023-09-08 16:35:10 +01:00
Yu Watanabe
8c9b36f1be test-network: split out wait-online related test case
(cherry picked from commit b09ec84700d4a645e047e156284ada54fe8b6d7d)
2023-09-08 16:35:10 +01:00
Luca Boccassi
5090681624 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)
(cherry picked from commit 8f3ec30c467947b7d5e28c70a3bb8bd70eb229b3)
2023-08-10 09:43:05 +01:00
Yu Watanabe
0efa20c2ee 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)
(cherry picked from commit 2c2b89aeded6aa34526a7d1a59232e7bd7495f40)
2023-08-10 09:43:05 +01:00
Franck Bui
f33be2e66b test: install systemd-homed for openSUSE
This new sub-package has been recently introduced.

(cherry picked from commit 33ce0a899258ed8dfb4a234a9f67e678127d41f9)
(cherry picked from commit 65d5b3561c2692e947327e9a77d3b1b4d932c828)
(cherry picked from commit 8541307b23b7ecef25bc7cb2c7aa86d0075b962a)
2023-08-10 09:43:05 +01:00
Franck Bui
d1f141dbff test: console fonts are located in /usr/share on openSUSE
(cherry picked from commit ba0ff9fc0fa657024edd7a4a0aab01aa95b39ff5)
(cherry picked from commit ca0c8adf9d6d348cd59e12282e1effab4a39c5f3)
(cherry picked from commit c65270ef5fd525e2353e02c7a1e5b029f52bab82)
2023-08-10 09:43:05 +01:00
Luca Boccassi
d55810e027 Revert "test-network: drop ExecReload= in networkd.service and udevd.service"
The required change is in v253 but not in any older releases, so this
test change needs to be reverted.

This reverts commit 27c9d9bf3dc030a5e3048ceec7e7348e694b3870.
2023-07-09 14:32:26 +01:00
Frantisek Sumsal
6700231d52 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)
(cherry picked from commit 7dc6cccc4b3b699ba36da31a410af91badd0f13a)
2023-07-08 10:42:52 +01:00
Yu Watanabe
7cf1bc00b0 test-network: add one more testcase for DHCPv4 classless route
For issue #28280.

(cherry picked from commit 86f6760038477e9e27ccea580f1b3b27328a98a7)
(cherry picked from commit f74337b7565348a9bd44baae27917b2a202dcf1a)
2023-07-08 10:42:52 +01:00
Yu Watanabe
27c9d9bf3d test-network: drop ExecReload= in networkd.service and udevd.service
Follow-up for 0e07cdb0e77d0322bc866b5e13abbe38e988059d and
f84331539deae28fbeb42d45ad0c8d583b3372a3.

(cherry picked from commit 62eaf8d039a14e7bc4e682fa3ad4b3bfe366c29a)
(cherry picked from commit 21181e2e1c1648b163213d6371f1592710220b93)
2023-07-08 10:42:52 +01:00
Yu Watanabe
bf8ffee6ec test: update test for free area calculation in repart
(cherry picked from commit 937625c7c72e503d03b406de3e1859d7f00dbdcf)
(cherry picked from commit f03f365dc134c4dcbc375f431f0ead321b02dfe1)
2023-07-08 10:42:52 +01:00
Yu Watanabe
68fba1a7ef test: add reproducer for issue #28225
(cherry picked from commit beba8f2e1e5f08041d2a9955398a64d92dcc75a0)
(cherry picked from commit 2cda7651ac9013f870b8b2853e229f672dba4a47)
2023-07-08 10:42:52 +01:00
Yu Watanabe
9aab5b81a5 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)
(cherry picked from commit 16ddaafe3e061752787df0cff097d8bcf4e72625)
2023-07-08 10:42:52 +01:00
Yu Watanabe
d4147bd6bc test-network: check route more strictly
(cherry picked from commit 7e30527806956b7240ca7bf8d92038170fda44d0)
(cherry picked from commit a8db4fcac4cfe372df7fb3444eff76223dcde6b1)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
0e2a4bb013 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)
(cherry picked from commit 67aaab3381e8304993a0d33d25e2fdbe49373dd5)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
163be31d38 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)
(cherry picked from commit 884ab38057dca70b8779c85884f4646057e80921)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
7d667e5341 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)
(cherry picked from commit 5a29fbba6cdfdb098a9b1ed1ce60ecdbd62f12ac)
2023-07-08 10:42:52 +01:00
Luca Boccassi
79bfbb0163 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)
(cherry picked from commit 39459a5d8065ea5ce45dbca39561bd078d801aa0)
2023-07-08 10:42:52 +01:00
Luca Boccassi
cad0dba2f8 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)
(cherry picked from commit 9654140f342df74b8572da1fa4d5969f3d9b4617)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
4ac2071192 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)
(cherry picked from commit fdc6ce1d00387320b81e1a27d9bb8d5dea0171f9)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
e58874f2e3 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)
(cherry picked from commit 68c7905d9ca67548961be83812f76973995aaa0a)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
54afbbe343 test: wrap curl when running with ASan
Necessary (unfortunately) for curl on C8S.

(cherry picked from commit 033601b79ae00784bfaab9ea91fe70ecff83d645)
(cherry picked from commit aaa436c2d7dd9f35b030df46afd48482460ec50a)
2023-07-08 10:42:52 +01:00
Luca Boccassi
d0bdac53cb TEST-55-OOMD: improve ephemeral configuration readability
(cherry picked from commit 6acbb3f2fb234d9903c15571472d95afee9d08c1)
(cherry picked from commit 3cbc30f3096aa880d57fd7f7a8960fa7f7958085)
2023-07-08 10:42:52 +01:00
Luca Boccassi
38677da700 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)
(cherry picked from commit 622c1774508f3f1434b0b732860f76972460030f)
2023-07-08 10:42:52 +01:00
Yu Watanabe
6ad5e86ff1 networkd-test.py: disable global DNS= setting
Otherwise, queries may be passed to unexpected DNS servers.

(cherry picked from commit 5063f027ef669a934133465b875fd68f0b4d6794)
(cherry picked from commit a1ea2159afd3f2c0cdd1f9edad8cbee9fffe1abe)
2023-07-08 10:42:52 +01:00
Yu Watanabe
3068157e3a 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)
(cherry picked from commit eff4610088526ead6a448195156d86033335755e)
2023-07-08 10:42:52 +01:00
Yu Watanabe
a59a4bf79a networkd-test.py: replace deprecated option IPv6AcceptRouterAdvertisements=
Also, use 'yes' or 'no' for boolean options.

(cherry picked from commit 77725adedddf079bd5b9b68d7597a3644e0b8ebe)
(cherry picked from commit 67a4b8a53016d7fdb8c2f2e229decde488184add)
2023-07-08 10:42:52 +01:00
Yu Watanabe
0e951a2ce6 networkd-test.py: show more debugging logs on failure
(cherry picked from commit eeb88ea41d7f3c62a7cc72224a3aebb9e03565ad)
(cherry picked from commit 11d575859ca2f9f8bfebbc5e15ef38147f1f9d92)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
051eb9db38 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)
(cherry picked from commit c35624663b8f332c81fd0f712dec60966340f435)
2023-07-08 10:42:52 +01:00
Henrik Holst
84887588c3 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)
(cherry picked from commit 20607d7e0c7ff730bcd461344f3a861f660039ca)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
4a2a58c72a test: re-enable TEST-02 on ppc64le
(cherry picked from commit fb310ba9ebb1a4f2b6fc76c75b3bb9a99f1a2a9a)
(cherry picked from commit 323744b0c35744bfb4bb3601e6ea34da60136838)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
eb914ee546 test: make sure ping works for unprivileged users
(cherry picked from commit f087837c46d77745425fd9b84f1de9e5703836af)
(cherry picked from commit bcd2cf893281c927c33c3d0ff5ea04aab22b16c8)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
73ae7033b6 test: copy file xattrs (if any) as well
(cherry picked from commit a6695a431fec4291c956bbbecda19c468ccccb1d)
(cherry picked from commit 984104ce2979193303bd306e2c2aab4d8ab3ae14)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
cd2080fc13 test: wrap agetty & getfacl when running with sanitizers
The list is getting slightly ridiculous.

(cherry picked from commit 8e81885531b23b3f6787cfe29d952469b31976ed)
(cherry picked from commit 622311c25b8d43e75ef027b0f95ce78e54042cbe)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
b8583d48e9 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)
(cherry picked from commit 7405e06205f3646ff8ca2e59a2147533e04d9bca)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
eb2bce667a test: rebuild the ldconfig cache after changing its configuration
Follow-up to ba79e8c2cc.

(cherry picked from commit 25bc4697275ba5ef395160c716ca3e7f63d3eaba)
(cherry picked from commit 3909cb2133b2237d020b564a2c8518e7be7076c3)
2023-07-08 10:42:52 +01:00
Luca Boccassi
4033768faf tests: fix shellcheck warnings
(cherry picked from commit 6aea5ce814c0723474e0741df45dbf2c202ba739)
(cherry picked from commit 2cdc1686c87f23890a6507137327edae90b5b17d)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
a07a4b728c test: add a reasoning why we don't use the SELinux-provided units
(cherry picked from commit 8c0ace5739789a971b8591f53eb94200aeec2c66)
(cherry picked from commit 49a356f9d69f75cd6d6adedf7bd78be9efa631c5)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
00b3deebdd test: make sure we unmount /var late during shutdown
To avoid the "mountpoint is busy" error.

(cherry picked from commit d7c1df84d9e9da81889e44836b054a1af94620e5)
(cherry picked from commit d452dd7a3726ca1b0ca2a99478fe6449472317be)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
20026f9971 test: add a couple more tests for systemd-cryptsetup
(cherry picked from commit eb26f34a0951f994fe3c1e6d1bc97db12db26844)
(cherry picked from commit a1ef8dbd1533a23309ba7adeff4e9caf26387199)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
598318e513 test: make check_result_*() set -e friendly
(cherry picked from commit 71d7f02cc7dc1bf5b8506c90571cb980ec706def)
(cherry picked from commit c608d7ca8541dfdd50f2a1b18beb34f58995fa7a)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
a255d3ac06 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)
(cherry picked from commit f2283f6c62e0358c029da308849564e744a73170)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
57cd31ec1b test: clean up the test cleanup a bit
(cherry picked from commit 168ccb879f48b0051c2abd184c78154ab17af0fd)
(cherry picked from commit 5321f67a63562e18a3008b08e92bfc891e8a2116)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
4ae66f3831 test: minor cleanup
No functional change.

(cherry picked from commit 00c2676972b62edff09ae612286e814bf9d4a574)
(cherry picked from commit 1194822aa2396c48cc0b719c107939c6eb7f5b2a)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
3932ebb674 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)
(cherry picked from commit 033d8ab57e9708205518f9495427a14f0e7df896)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
3e3e9049df test: introduce test_require_bin() and use it
No functional change.

(cherry picked from commit 70bdf6e661f67dfbfd6a198f7d1ebc6fdf0dce62)
(cherry picked from commit b02be950c48abf987c3718df18539d30075b18b3)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
1927a4356d test: fix indentation
(cherry picked from commit 97d7af86b5fa718dcabe5073c0874cb1a8bcf927)
(cherry picked from commit 14b9ea4dd305024c60b7cf2742f36be428028593)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
0cd4e68929 test: move TPM2-related setup stuff into test-functions
And hide it all behind $TEST_SETUP_SWTPM.

(cherry picked from commit 18fa5c8283528253a9a4d8af42ceac61cd23c42b)
(cherry picked from commit 4dad36bca8b775791e28695c5f8340e848183e9a)
2023-07-08 10:42:52 +01:00
Frantisek Sumsal
d934e0d097 test: drop the --recursive=no test
As the outcome also depends on availability of the PID namespace, so
the test might (and does) unexpectedly pass in some environments.

(cherry picked from commit d99e099fb45ad71988e22d3a0d081725d1b6e653)
(cherry picked from commit 398cb5005bfdb41ae2f8f8031505b6511279b6c4)
2023-07-08 10:42:52 +01:00