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

61444 Commits

Author SHA1 Message Date
Frantisek Sumsal
85e77bdac1 core: free the strings in the set as well during unit cleanup
Spotted while fuzzing #27890.

=================================================================
==908098==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f4efe6d81f5 in __interceptor_realloc.part.0 (/lib64/libasan.so.8+0xd81f5) (BuildId: dc689b05ca2577037af24700212bb5cce1f91c8a)
    #1 0x7f4efb8e3ace in greedy_realloc ../src/basic/alloc-util.c:70
    #2 0x7f4efb93b713 in extract_first_word ../src/basic/extract-word.c:62
    #3 0x7f4efb970d50 in set_put_strsplit ../src/basic/hashmap.c:1902
    #4 0x7f4efd76c27e in exec_context_deserialize ../src/core/execute-serialize.c:3341
    #5 0x7f4efd778dcb in exec_deserialize ../src/core/execute-serialize.c:4122
    #6 0x4032c0 in LLVMFuzzerTestOneInput ../src/core/fuzz-execute-serialize.c:60
    #7 0x403c58 in main ../src/fuzz/fuzz-main.c:50
    #8 0x7f4efecccb49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #9 0x7f4efecccc0a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #10 0x402344 in _start (/home/mrc0mmand/repos/@systemd/systemd/build-san/fuzz-execute-serialize+0x402344) (BuildId: 195f382cf1e39b9ba48d6dcf5a90f786d72837a8)

SUMMARY: AddressSanitizer: 64 byte(s) leaked in 1 allocation(s).
Aborted (core dumped)

==911550==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 17 byte(s) in 1 object(s) allocated from:
    #0 0x4df281 in strdup (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x4df281) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #1 0x7fe4ae2b38fc in _set_put_strndup_full /home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/../src/basic/hashmap.c:1868:21
    #2 0x7fe4b0bad897 in exec_context_deserialize /home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/../src/core/execute-serialize.c:3914:29
    #3 0x7fe4b0b80592 in exec_deserialize /home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/../src/core/execute-serialize.c:4109:13
    #4 0x531d0f in LLVMFuzzerTestOneInput /home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/../src/core/fuzz-execute-serialize.c:59:16
    #5 0x440594 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x440594) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #6 0x43f9b9 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x43f9b9) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #7 0x440fd5 in fuzzer::Fuzzer::MutateAndTestOne() (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x440fd5) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #8 0x441955 in fuzzer::Fuzzer::Loop(std::vector<fuzzer::SizedFile, std::allocator<fuzzer::SizedFile>>&) (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x441955) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #9 0x42e151 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x42e151) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #10 0x45a916 in main (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x45a916) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
    #11 0x7fe4ac449b49 in __libc_start_call_main (/lib64/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #12 0x7fe4ac449c0a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #13 0x422b74 in _start (/home/mrc0mmand/repos/@systemd/systemd/build-libfuzz/fuzz-execute-serialize+0x422b74) (BuildId: 4e58706e607b8be7972d83c421bc0b625d509ec6)
SUMMARY: AddressSanitizer: 17 byte(s) leaked in 1 allocation(s).

(cherry picked from commit 9b412709f21a4868e1bc0bb3252a4d26e862633b)
(cherry picked from commit 7bd680bc62c3d071ae6b4b4a834f79b4eceff0d8)
(cherry picked from commit b97ec522397d66d7df7c32f010f383e1e817c771)
2023-08-10 09:43:05 +01:00
Luca Boccassi
475d2dd975 bus: add some minimal bounds check on signatures
CID#1491292
CID#1491291
CID#1491290
CID#1491289
CID#1491284
CID#1491281
CID#1491280
CID#1491278

(cherry picked from commit d80cc39558ec7e596d594d1aadc4df81262611f8)
(cherry picked from commit a518ea9ff1fe55c7bb5e4f391858a57d66b779d0)
(cherry picked from commit b7531639dc75261de8957b2ddac6012d8fe2559f)
2023-08-10 09:43:05 +01:00
наб
d97da29b98 find-esp: fix XBOOTLDR stx_dev_major=0 and not btrfs fix
The original commit is fully correct in its analysis, description, and
mechanics, but the patch changes an identical condition around line 500
(find_esp_and_warn()), instead of line 800 (find_xbootldr_and_warn()).

The internal patch I distributed to testers was correct (L800), and
neither the reviewers, nor me, caught that I wrote the wrong line for
upstream submission. I've re-checked that this patch applied to
systemd 252.11-1 fixes the issue.

Keep the -ENOTTY condition for find_esp_and_warn(), since the conditions
are clearly supposed to be the same and similar semantics apply.

Fixes: commit ed89819f8fd7bfe99cd652082076e85e1417e4e9 ("find-esp: don't
 silently error bootctl install if presumed XBOOTLDR part is
 stx_dev_major=0 but not btrfs")
(cherry picked from commit f26c794308975a875a98faf22a6650d7134f17c1)
(cherry picked from commit ca7787a9f29ff836a300b782a73f9c5926ee0d14)
2023-07-20 10:59:16 +02:00
Jan Janssen
b5ac1d45ea boot: Read files in small chunks on broken firmware
Fixes: #25911
(cherry picked from commit f70f992273a7add1ec98a894ffadb1f1e43c0c31)
(cherry picked from commit 1a0f2c5c57325b95749267943d43680ac54919ed)
v252.13
2023-07-18 10:11:33 +01:00
Dmitry V. Levin
3c7f7cb974 test: fix use of ERRNO_IS_PRIVILEGE()
Given that ERRNO_IS_PRIVILEGE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the arguments passed to ERRNO_IS_PRIVILEGE() are the values
returned by read_one_line_file() which can legitimately return positive
values without errno semantics, so fix this by moving ERRNO_IS_PRIVILEGE()
invocations to the branches where the return values are known to be negative.

(cherry picked from commit fce846e0ace95920155088a7e70dac914e437e68)
(cherry picked from commit f1c4da0414640cf201147144f558e1af31a3ae80)
2023-07-18 10:11:33 +01:00
Dmitry V. Levin
a6eca1755c resolved: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by manager_recv() which can legitimately return 1 without errno
semantics, so fix this by moving ERRNO_IS_DISCONNECT() invocation to the
branch where the return value is known to be negative.

(cherry picked from commit 0bdea17c0aa37c4cdf586c072a7b35f8d0598cc3)
(cherry picked from commit 791dbff59b073ce049801319c58218c5f1063220)
2023-07-18 10:11:33 +01:00
Dmitry V. Levin
d4d356c6c2 sd-bus: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by bus_socket_process_watch_bind(), bus_socket_process_opening(),
and bus_socket_process_authenticating() which can legitimately return
positive values without errno semantics, so fix this by moving the
ERRNO_IS_DISCONNECT() invocation to the branch where the return value
is known to be negative.

(cherry picked from commit bb228f0ebc9b691ee2a871bffbf949936568f3ea)
(cherry picked from commit 920568b7e213162babcbe0c0cdd4e2fe28882ebd)
2023-07-18 10:11:33 +01:00
Dmitry V. Levin
6306373d92 socket: fix use of ERRNO_IS_DISCONNECT()
Given that ERRNO_IS_DISCONNECT() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_DISCONNECT() is the value
returned by socket_acquire_peer() which can legitimately return 1
without errno semantics, so fix this by moving ERRNO_IS_DISCONNECT()
invocation to the branch where the return value is known to be negative.

(cherry picked from commit d5f8890bbf375075c7042b31ff6e79ad491df04c)
(cherry picked from commit ebce7284fd515cc43ec90d231aadc342af5ea2d9)
2023-07-18 10:11:33 +01:00
Dmitry V. Levin
338ef2b9f3 kbd-util: fix use of ERRNO_IS_RESOURCE()
Given that ERRNO_IS_RESOURCE() also matches positive values,
make sure this macro is not called with arguments that do not have
errno semantics.

In this case the argument passed to ERRNO_IS_RESOURCE() is the value
returned by recurse_dir_at() which can legitimately return positive
values without errno semantics, so fix this by moving the ERRNO_IS_RESOURCE()
invocation to the branch where the return value is known to be negative.

(cherry picked from commit ed3745b51cd823d4a651e250050b2b674f055585)
(cherry picked from commit 24256d039f80c0d3fcdf10a5e4a0e0bfd60ac414)
2023-07-18 10:11:33 +01:00
David Tardon
6e798f74d7 pam_systemd_home: suppress LOG_DEBUG msgs if debugging is off
This is a "sequel" to commit 2675747f3cdd6f1e6236bbb2f79abfa53fb307f1 .

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2210770
(cherry picked from commit f71b55b51075e7ce42fa0ad4ae5569ba1aea6ee2)
(cherry picked from commit d6b23dd062de111475f9cc00d3c65841d1e20d8c)
2023-07-18 10:11:33 +01:00
Mike Yuan
e7ff82f1d1 journalctl: fix when --grep is used with --follow
Follow-up for #25147 (db4691961ca52759fe6645d0fddb659ee4299ac2)

--follow sets arg_lines to 10, which breaks
--grep as the latter implies --reverse.
So let's not set --reverse if --follow is used.

(cherry picked from commit c673fd52e048138a6786fb9114c1ddbf0057d6fb)

Should fix https://bugzilla.redhat.com/show_bug.cgi?id=2215304.

(cherry picked from commit d7bb1f570a3a32fec6d154cbc83e6bc43585bebb)
2023-07-18 10:11:33 +01:00
Zbigniew Jędrzejewski-Szmek
a43f101cf8 hwdb: update to d98037166929b87ed119a1560d398a9460113eb7
git restore -s origin/main hwdb.d/ test/hwdb.d test/hwdb-test.sh

(cherry picked from commit 5b3affccdeb7c97b514be451023876c802fb81ce)
2023-07-18 10:11:33 +01:00
Luca Boccassi
c0a4e714ce sd-gpt: __mips__ is also defined when building __mips64
Follow-up for d75ec33ed2a1781a82f9e0d62a79244ecd1e1edc

(cherry picked from commit c26a01ac8be0a9ab2857cd2006d9f6705c77b9b3)
(cherry picked from commit 908463cafba08e364cffa04373f9a9dac7660e68)
2023-07-18 10:11:33 +01:00
Luca Boccassi
a80d2a56b0 gpt: it's __mips64, not __mips64__
But it's __mips__ not __mips, obviously

Follow-up for d75ec33ed2a1781a82f9e0d62a79244ecd1e1edc

(cherry picked from commit 10ad311e7cdba862fd994a8b47576146a8e64efb)
(cherry picked from commit 9c66d0ce10b12afd25f6264c410a100ef6c29bbb)
2023-07-18 10:11:33 +01:00
Yu Watanabe
b3ce39bbac network: check lifetime of address and route before configure
Otherwise, we may configure a route that depends on the existence
of an address or another route, and may fail when lifetime of one
of them are already zero.

Hopefully fixes #28358.

(cherry picked from commit dc32de392466c3cadab313abbc636e341047049b)
(cherry picked from commit 3ce7c9756c126910b374c9ad111e048786c593fe)
2023-07-18 10:11:33 +01:00
Fuminobu TAKEYAMA
789d978b38 core: fix race condition during startup of a service with ExitType=cgroup
This commit allows service_sigchld_event() is executed before
service_dispatch_exec_io(), which might happen when a main process exits
very quickly.

Also do not check PID for service goodness because the main process have
already been exited in this case.

Fix: #27919
(cherry picked from commit ef4300654e70e76ed74f7d544e0f44c5d92fb698)
(cherry picked from commit ead40508d7a1f27dc3adf745ede0842f325af767)
2023-07-18 10:11:33 +01:00
Yu Watanabe
6f042e541c man: move <varlistentry> in <variablelist>
(cherry picked from commit 16a07ffc64e6ab855d2d93f14b2aa5f32c6c47ac)
(cherry picked from commit ef5a65a41f8166079568e61aac36bbd5fb1726e1)
2023-07-18 10:11:33 +01:00
Yu Watanabe
57dbd6968c seccomp: add arm_fadvise64_64 to system-service group
fadvise64 and fadvise64_64 are already in the group, but arm_ version
was not.

Fixes #28350.

(cherry picked from commit 26b682e81692fa637c1d23e827069f31385d3f7c)
(cherry picked from commit 6dd8e627121e77c06f57b2b7ba82cd5eccb276d3)
2023-07-18 10:11:33 +01:00
Luca Boccassi
4c24d51938 sd-gpt: add missing SD_GPT_*NATIVE* defines for mips/mips64/parisc
We already had the arch-specific UUIDs defined, but they were not wired up

(cherry picked from commit d75ec33ed2a1781a82f9e0d62a79244ecd1e1edc)
(cherry picked from commit cffc34c4a608de47a1ca1eed7945862dd30cd993)
2023-07-18 10:11:33 +01:00
Daan De Meyer
cab6d72dd5 network-generator: Add missing umask(0022)
(cherry picked from commit c9d85c22066f690ab09f0298772bee43583b7d2b)
(cherry picked from commit 1e39026869577bbd579018360fa7195a4565918f)
2023-07-18 10:11:33 +01:00
Daan De Meyer
51a70dbdd8 network-generator: Add missing log_setup()
(cherry picked from commit 8b24bcdfa8c5a4b32cf273d74dc5130626c44c22)
(cherry picked from commit ed9f4ef0140289fd70f94dd71bd410548b28149c)
2023-07-18 10:11:33 +01:00
Xeonacid
9eb11a4ae5 seccomp: add riscv_hwprobe to @default
This syscall is for probing hardware capabilities from userspace and should do no harm.
Added in ea3de9ce8a

(cherry picked from commit ca15fc4820ad1ef2d54c695699de949974dc5bbc)
(cherry picked from commit a4d70c015b987577fb989ba55326d9e68459fb39)
2023-07-18 10:11:33 +01:00
Luca Boccassi
7c50f5bd16 Revert "unit: add ordering dep relative to credentials dir"
Causes a cycle at shutdown, undo the backport.

Jul 10 22:13:21 H systemd[1]: poweroff.target: Trying to enqueue job poweroff.target/start/replace-irreversibly
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Found ordering cycle on run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount/stop
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Found dependency on systemd-tmpfiles-setup-dev.service/stop
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Found dependency on local-fs-pre.target/stop
Jul 10 22:13:21 H systemd[1]: local-fs-pre.target: Job run-credentials-systemd\x2dtmpfiles\x2dsetup\x2ddev.service.mount/stop deleted to break ordering cycle starting with local-fs-pre.target/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found ordering cycle on systemd-tmpfiles-setup-dev.service/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found dependency on local-fs-pre.target/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found dependency on run-credentials-systemd\x2dsysusers.service.mount/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Found dependency on systemd-sysusers.service/stop
Jul 10 22:13:21 H systemd[1]: systemd-sysusers.service: Job systemd-tmpfiles-setup-dev.service/stop deleted to break ordering cycle starting with systemd-sysusers.service/stop

This reverts commit ad10ffe6a9dfe5244ffe0626bed0c0edd802388f.

(cherry picked from commit 47281053e4a9e56a78669effff1695cb26f55160)
v252.12
2023-07-10 22:24: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
Luca Boccassi
ff39d01c65 hwdb: update to 75a9122678e0cf852b6e9161db9a32e557213537
git restore -s origin/main hwdb.d/ test/hwdb.d test/hwdb-test.sh

(cherry picked from commit 04e0ed93eef2a866ac1b6a9f8872258382314c2e)
2023-07-08 10:42:52 +01:00
Yu Watanabe
6f7b7b661e meson: allow to fallback to use libxcrypt.pc or glibc's libcrypt
Some distributions still use glibc's libcrypt. In that case, libcrypt.pc
does not exist and dependency() will fail.
Also, even if libxcrypt is used, there may not be a symlink
from libcrypt.pc to libxcrypt.pc. So, let's add a secondary name.

Follow-up for d625f717db6e151fd78742593c35eaba4cd2841d.

Fixes #28289.

[ fixed to fallback to extra dependency() call as multiple deps require meson 0.60 ]

(cherry picked from commit 555737878f66e64dea50dd7bf6f0b12cc54d2963)
(cherry picked from commit 087b9a70b0376b2b7ea0f6037485cee7fdbfa9d4)
2023-07-08 10:42:52 +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
2ed8067242 network/dhcp4: do not ignore the gateway even if the destination is in the same network
Fixes #28280.

(cherry picked from commit 77451f654a89d822cd288883edfac315949d1cb6)
(cherry picked from commit 234b51fb730d1b36ebcc32fc26725a12b08cd818)
2023-07-08 10:42:52 +01:00
Yu Watanabe
07b7b5a87e meson: first try dependency(), then fallback to find_library()
This also drops the fallback for libacl, libcap, libcrypt, and libgcrypt,
as recent Ubuntu (at least, 20.04 LTS and newer) and Debian (at least, buster
and newer) have relevant .pc files.

Fixes #28161.

(cherry picked from commit d625f717db6e151fd78742593c35eaba4cd2841d)
(cherry picked from commit 49fa7736f7b9dd5518b96c7b4f072dccfc63abd6)
2023-07-08 10:42:52 +01:00
Dmitry V. Levin
f433a2829b pwquality: do not log password suggestions
As logging password suggestions might leak sensitive information,
print it instead.

Suggested-by: Yu Watanabe <watanabe.yu+github@gmail.com>
(cherry picked from commit 0351d560a25cb7caf94c1f9c1af1f5e9b6b6a01a)
(cherry picked from commit ff63a08d572f2db263c3cb64777208c26959eb01)
2023-07-08 10:42:52 +01:00
Dmitry V. Levin
74b60f1238 pwquality: fix quality_check_password return value
quality_check_password() used to return the same value 0 in two
different cases: when pwq_allocate_context() failed with a
ERRNO_IS_NOT_SUPPORTED() code, and when pwquality_check() rejected the
password.  As result, users of quality_check_password() used to report
password weakness also in case when the underlying library was not
available.

Fix this by changing quality_check_password() to forward the
ERRNO_IS_NOT_SUPPORTED() code to its callers, and change the callers
to handle this case gracefully.

(cherry picked from commit 7fc3f9c032cad0690c08fcdee190d83f1c7a6d53)
(cherry picked from commit 9ebacd3f726e0d34afc1fe0d53d82d463aefc9b3)
2023-07-08 10:42:52 +01:00
Dmitry V. Levin
c43fef1041 pwquality: fix use of ERRNO_IS_NOT_SUPPORTED
Given that ERRNO_IS_*() also match positive values, call
ERRNO_IS_NOT_SUPPORTED() only if the value returned by
pwq_allocate_context() is negative.

(cherry picked from commit 29dd2e253c74c7ab2fed6fb6a67a87089197253f)
(cherry picked from commit ac531ec920275e4a655809cec530ef83cd8db2cc)
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
Lennart Poettering
bf159bbdf2 hostname-setup: don't pass "true" to a flags parameter
(cherry picked from commit 983d621e11b94e705bb017e8cad5b7d1442c03e5)
(cherry picked from commit e8731c0ef899bbc38aff2c4b92c9b62463685e31)
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
b797bd189c repart: fix free area calculation
Like fdisk_get_last_lba(), fdisk_partition_get_end() return the last
sector in the partition.

Fixes #28225.

(cherry picked from commit d2eb1f8145dee61c6bddfdcc5dac3591fa03f744)
(cherry picked from commit 2299ca13f9f95659dcd9476bb1138de6c8e5774b)
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
Lennart Poettering
ef943b27cf execute: fix credential dir handling for fs which support ACLs
When the credential dir is backed by an fs that supports ACLs we must be
more careful with adjusting the 'x' bit of the directory, as any chmod()
call on the dir will reset the mask entry of the ACL entirely which we
don't want. Hence, do a manual set of ACL changes, that only add/drop
the 'x' bit but otherwise leave the ACL as it is.

This matters if we use tmpfs rather than ramfs to store credentials.

(cherry picked from commit f76ce81b91db1dac0d0a012e1cc903639002dd0a)
(cherry picked from commit ee3ed28f42605402873ca2169cfb4e6f3cbfbdf9)
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
Yu Watanabe
f336e7177c network: delay to configure address until it is removed on reconfigure
When we request an address that already exists and is under removing,
we need to wait for the address being removed. Otherwise, configuration
of a route whose preferred source is the address will fail.

Fixes #28009.
Replaces #28088.

(cherry picked from commit 6e8477edd3a988357ad5f5fa6610904d44ec402c)
(cherry picked from commit ea05cd2910918934370f05febccecdd4ffea84e5)
2023-07-08 10:42:52 +01:00
Yu Watanabe
177409a81d network: constify several functions
(cherry picked from commit b088c3d3fc3a7a3a659ec0fe903a29cabd66dc49)
(cherry picked from commit e1c54c81b44a3698c62f6f2a4fe7d86ecd56d89e)
2023-07-08 10:42:52 +01:00
Daan De Meyer
4d2506a184 dbus-cgroup: Make sure we overwrite cpuset properties in drop-in
The DBUS property setter overwrites the value of the property but
writes a drop-in that extends the value. Let's make sure the drop-in
overwrites the property value as well by assigning the empty string
first.

(cherry picked from commit 1dbccd6d342d9f8dd8d4a1617e0081b61a553ca8)
(cherry picked from commit 72d6e8912c6ac31297c7dd73e1377556bf6f866d)
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
Yu Watanabe
6ec548485d test: add test for trailing invalid byte at the end
(cherry picked from commit 894f4417640286fa350203d70d858e11e261a3e0)
(cherry picked from commit c8c43dc3a73f3a183821b49a47cd259782629b80)
2023-07-08 10:42:52 +01:00
Philipp Kern
983f418d98 sd-dhcp6-lease: ignore invalid byte(s) at the end of the packet
Oracle Cloud sends malformed DHCPv6 replies that have an invalid
byte at the end, which cannot be parsed as an option code.

networkd currently can cope with the invalid option (it is ignored),
but the whole packet is ignored altogether because of the additional
null at the end.

It's better to be liberal in what we accept and actually assign an
address, given that the reply contains a valid IA_NA.

Fixes #28183.

(cherry picked from commit 81b7335912ce901c61b923218bcdf06a4fdcea07)
(cherry picked from commit a11a0011a8dea392f157407c144a2a54d8e1c223)
2023-07-08 10:42:52 +01:00
Lennart Poettering
75d007b618 man: properly close XML tags
(cherry picked from commit cc8fdd5d307a620700d4729d74143ca434f0707c)
(cherry picked from commit f08c49b33e3ecba9f034dfd3e045b1ef455845a6)
2023-07-08 10:42:52 +01:00
Lennart Poettering
4a54e90a12 man: rebreak lines in file-hierarchy(7) a bit
(Does not change a single word, just rebreaks a bunch of paragraphs
matching our current line breaking rules)

(cherry picked from commit fa1d34825a9b410275e716b9b70f4fca02c71ba9)
(cherry picked from commit ed87814cdf10581728ad56c8012a1141f5fda289)
2023-07-08 10:42:52 +01:00