1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-08 05:57:26 +03:00

63001 Commits

Author SHA1 Message Date
Dmitry V. Levin
f1c4da0414 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)
v253.7
2023-07-17 18:08:54 +02:00
Dmitry V. Levin
791dbff59b 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)
2023-07-17 18:08:53 +02:00
Dmitry V. Levin
920568b7e2 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)
2023-07-17 18:08:52 +02:00
Dmitry V. Levin
ebce7284fd 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)
2023-07-17 18:08:51 +02:00
Dmitry V. Levin
24256d039f 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)
2023-07-17 18:08:47 +02:00
Daan De Meyer
5d62126451 units: Add --graceful flag to pcrphase units
Some of the new units using systemd-pcrphase are missing the --graceful
flag which causes them to error if the tpm libraries are not installed.
Add --graceful just like in the other pcrphase units to make systemd-pcrphase
exit gracefully if the tpm libraries are missing.

(cherry picked from commit f2aaa14d37e4257dd2f1fdc66063dc08a66d7f8b)
2023-07-17 18:08:37 +02:00
David Tardon
d6b23dd062 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)
2023-07-17 16:53:33 +02:00
Mike Yuan
d7bb1f570a 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.
2023-07-17 16:49:42 +02:00
Zbigniew Jędrzejewski-Szmek
5b3affccde hwdb: update to d98037166929b87ed119a1560d398a9460113eb7
git restore -s origin/main hwdb.d/ test/hwdb.d test/hwdb-test.sh
2023-07-17 16:49:42 +02:00
Luca Boccassi
908463cafb sd-gpt: __mips__ is also defined when building __mips64
Follow-up for d75ec33ed2a1781a82f9e0d62a79244ecd1e1edc

(cherry picked from commit c26a01ac8be0a9ab2857cd2006d9f6705c77b9b3)
2023-07-17 16:49:42 +02:00
Luca Boccassi
9c66d0ce10 gpt: it's __mips64, not __mips64__
But it's __mips__ not __mips, obviously

Follow-up for d75ec33ed2a1781a82f9e0d62a79244ecd1e1edc

(cherry picked from commit 10ad311e7cdba862fd994a8b47576146a8e64efb)
2023-07-17 16:49:42 +02: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
Dmitry V. Levin
139cb31bf8 resolved: keep track of first names listed for each address in /etc/hosts
These names will be used later in responses as canonical names.

(cherry picked from commit 1bd76a6217c0cd81972cd50b360cd5b8aa27f0ff)
2023-07-17 16:49:41 +02:00
Yu Watanabe
3ce7c9756c 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)
2023-07-17 16:49:41 +02:00
Fuminobu TAKEYAMA
ead40508d7 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)
2023-07-17 16:49:41 +02:00
Yu Watanabe
ef5a65a41f man: move <varlistentry> in <variablelist>
(cherry picked from commit 16a07ffc64e6ab855d2d93f14b2aa5f32c6c47ac)
2023-07-17 16:49:41 +02:00
Yu Watanabe
6dd8e62712 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)
2023-07-17 16:49:41 +02:00
Luca Boccassi
cffc34c4a6 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)
2023-07-17 16:49:41 +02:00
Daan De Meyer
1e39026869 network-generator: Add missing umask(0022)
(cherry picked from commit c9d85c22066f690ab09f0298772bee43583b7d2b)
2023-07-17 16:49:41 +02:00
Daan De Meyer
ed9f4ef014 network-generator: Add missing log_setup()
(cherry picked from commit 8b24bcdfa8c5a4b32cf273d74dc5130626c44c22)
2023-07-17 16:16:23 +02:00
Xeonacid
a4d70c015b 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)
2023-07-17 16:15:36 +02:00
Luca Boccassi
47281053e4 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.
v253.6
2023-07-10 22:22:11 +01: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
Luca Boccassi
04e0ed93ee hwdb: update to 75a9122678e0cf852b6e9161db9a32e557213537
git restore -s origin/main hwdb.d/ test/hwdb.d test/hwdb-test.sh
2023-07-07 19:30:52 +01:00
Yu Watanabe
087b9a70b0 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)
2023-07-07 19:30:52 +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
234b51fb73 network/dhcp4: do not ignore the gateway even if the destination is in the same network
Fixes #28280.

(cherry picked from commit 77451f654a89d822cd288883edfac315949d1cb6)
2023-07-07 19:30:52 +01:00
Yu Watanabe
f9a8c8299c sd-device: do not read uevent file in device_clone_with_db()
Follow-up for 381f6d4ba5551898e7ff19189485072b94879281.

When the function is called, the device may be already removed, and
another device has the same syspath. Such situation can occur when a
partition removed and another is created. In that case, the sysfs paths
of the removed and newly created partitions can be same, but their
devnums are different, and thus the database files corresponding to the
devices are also different.

Fixes #27981.

(cherry picked from commit 35e49f2856dc7e80cfc6c9af3dca4e3aad9b8cb5)
2023-07-07 19:30:52 +01:00
Yu Watanabe
49fa7736f7 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)
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
Dmitry V. Levin
ff63a08d57 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)
2023-07-07 19:30:52 +01:00
Dmitry V. Levin
9ebacd3f72 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)
2023-07-07 19:30:52 +01:00
Dmitry V. Levin
ac531ec920 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)
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
Lennart Poettering
e8731c0ef8 hostname-setup: don't pass "true" to a flags parameter
(cherry picked from commit 983d621e11b94e705bb017e8cad5b7d1442c03e5)
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
2299ca13f9 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)
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
Lennart Poettering
ee3ed28f42 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)
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
Yu Watanabe
ea05cd2910 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)
2023-07-07 19:30:52 +01:00
Yu Watanabe
e1c54c81b4 network: constify several functions
(cherry picked from commit b088c3d3fc3a7a3a659ec0fe903a29cabd66dc49)
2023-07-07 19:30:52 +01:00
Daan De Meyer
72d6e8912c 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)
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
Yu Watanabe
c8c43dc3a7 test: add test for trailing invalid byte at the end
(cherry picked from commit 894f4417640286fa350203d70d858e11e261a3e0)
2023-07-07 19:30:52 +01:00