1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-12 21:57:27 +03:00

62966 Commits

Author SHA1 Message Date
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
Philipp Kern
a11a0011a8 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)
2023-07-07 19:30:52 +01:00
Lennart Poettering
f08c49b33e man: properly close XML tags
(cherry picked from commit cc8fdd5d307a620700d4729d74143ca434f0707c)
2023-07-07 19:30:52 +01:00
Lennart Poettering
ed87814cdf 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)
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
Lennart Poettering
a90ec12d82 man: rework BPFForeign= documentation a bit
Various assorted changes, among them make clear that a missing BPF
program is not reason to abort unit activation.

(cherry picked from commit a27e6fb71bf70f27347b0e1167b2de32c4dc6637)
2023-07-07 19:30:52 +01:00
Lennart Poettering
178fe97763 bpf-foreign: add an explicit, explanatory message when reference BPF program is not loaded yet
(cherry picked from commit 228459f5d7da200537895edf82260a79e6e99947)
2023-07-07 19:30:52 +01:00
Lennart Poettering
9e1e09066a bpf-foreign: if one program fails, still load the next
Let's make sure that if we load one program we don't prematurely fail,
and continue with the others still.

(cherry picked from commit f81450f2415f8fd77fc8edb3b4baab966aefa9fd)
2023-07-07 19:30:52 +01:00
Lennart Poettering
4592af1d77 bpf-foreign: remove duplicate various occasions of duplicate logging
(cherry picked from commit d512831a3ec93f6f29ccb21cb68f416114270840)
2023-07-07 19:30:52 +01:00
Yu Watanabe
750a0c01a2 test: skip if ldd command not found
Prompted by #28015.

(cherry picked from commit 9f4522591e4be076bf309e23b9cec9dddfc99e29)
2023-07-07 19:30:52 +01:00
François Rigault
134e55ef49 test: don't assume yum is a script
on Rawhide at the moment yum is a symlink to dnf5 which is a binary.

(cherry picked from commit 4b95d5effd788ae660691e01144130e432e2f021)
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
Antonio Alvarez Feijoo
69298e3b65 man: fix references to gethostname/sethostname
(cherry picked from commit 191b891bf1b01c1041509b951d9d797ceacb181d)
2023-07-07 19:30:52 +01:00
Frantisek Sumsal
b9990ee4a7 tree-wide: use https for the 0pointer.de doc links
(cherry picked from commit dc7e580e64a80e982619fb099ef736cd2379f92a)
2023-07-07 19:30:52 +01:00
Lennart Poettering
4e3ae43282 resolved: if ipv6 is off patch hostname→address query with unspec family to ipv4
If the client never specified the address family, and IPv6 is off in the
kernel, then look only for A, never for AAAA RRs.

Fixes: #23951
(cherry picked from commit 0438aa57751559295fee86d1c1f176486e518455)
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
Romain Geissler
d0b2fdd513 elf-util: check for overflow when computing end of core's PT_LOAD segments
(cherry picked from commit 3965f173eae4701a014113cfaf4a28a6bb63bed7)
2023-07-07 19:30:52 +01:00
Lennart Poettering
fa0ef8eaa6 coredump: use loop_read() for reading coredump into memory
Fixes: #26748
(cherry picked from commit a73c74db66a14540eb043bf9535c0d9c37804062)
2023-07-07 19:30:52 +01:00
Lennart Poettering
36cf2b76a5 userdbd: prefix parameters with their names more
(cherry picked from commit 3ef0103f2265a68e32847deaf84588c2fa711f3a)
2023-07-07 19:30:52 +01:00
Lennart Poettering
7906d46c5e userdbd: drastically raise ratelimit we apply on requests for more worker processes
These requests might come in during lookup floods very quickly, since
multiple worker processes might detect that things should be scaled up
at the same time. Hence, let's substantially raise the limit so that it
doesn't get hit in real-life scenarios and acts more like a safety net.

(cherry picked from commit c659d0f55ee5854e40dbaccc20ad0e8da176b271)
2023-07-07 19:30:52 +01:00
Daan De Meyer
c0dbec1c97 hwdb: Don't generate hwdb if no hwdb files are found
(cherry picked from commit 4638e18593bba844e063da1397e2d628c6ad469b)
2023-07-07 19:30:52 +01:00
Jan Luebbe
3c891618b7 man: correct reference to sd_id128_get_boot_app_specific
The function sd_id128_get_boot_app_specific is the app specific variant of
sd_id128_get_boot.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
(cherry picked from commit 173d47f7881137a5994a3e3b918169b6c759deaf)
2023-07-07 19:30:52 +01:00
Franck Bui
6b7970912b rpm: fix lua trigger priority for sysusers
Commit cd621954ed643c6ee0d869132293e26056a48826 probably forgot to fix the lua
implementation.

(cherry picked from commit e538927918fea3bae0cd1e78563d9b8983c56cea)
2023-07-07 19:30:52 +01:00
Romain Geissler
3be0f12277 elf-util: discard PT_LOAD segment early based on the start address.
Indeed when iterating over all the PT_LOAD segment of the core dump
while trying to look for the elf headers of a given module, we iterate
over them all and try to use the first one for which we can parse a
package metadata, but the start address is never taken into account,
so absolutely nothing guarantees we actually parse the right ELF header
of the right module we are currently iterating on.

This was tested like this:
 - Create a core dump using sleep on a fedora 37 container, with an
   explicit LD_PRELOAD of a library having a valid package metadata:

    podman run -t -i --rm -v $(pwd):$(pwd) -w $(pwd) fedora:37 bash -x -c \
        'LD_PRELOAD=libreadline.so.8 sleep 1000 & SLEEP_PID="$!" && sleep 1 && kill -11 "${SLEEP_PID}" && mv "core.${SLEEP_PID}" the-core'

 - Then from a fedora 38 container with systemd installed, the resulting
   core dump has been passed to systemd-coredump with and without this
   patch. Without this patch, we get:

       Module /usr/bin/sleep from rpm bash-5.2.15-3.fc38.x86_64
       Module /usr/lib64/libtinfo.so.6.3 from rpm coreutils-9.1-8.fc37.x86_64
       Module /usr/lib64/libc.so.6 from rpm coreutils-9.1-8.fc37.x86_64
       Module /usr/lib64/libreadline.so.8.2 from rpm coreutils-9.1-8.fc37.x86_64
       Module /usr/lib64/ld-linux-x86-64.so.2 from rpm coreutils-9.1-8.fc37.x86_64

   While with this patch we get:

       Module /usr/bin/sleep from rpm bash-5.2.15-3.fc38.x86_64
       Module /usr/lib64/libtinfo.so.6.3 from rpm ncurses-6.3-5.20220501.fc37.x86_64
       Module /usr/lib64/libreadline.so.8.2 from rpm readline-8.2-2.fc37.x86_64

So the parsed package metadata reported by systemd-coredump when the module
files are not found on the host (ie the case of crash inside a container) are
now correct. The inconsistency of the first module in the above example
(sleep is indeed not provided by the bash package) can be ignored as it
is a consequence of how this was tested.

In addition to this, this also fixes the performance issue of
systemd-coredump in case of the crashing process uses a large number of
shared libraries and having no package metadata, as reported in
https://sourceware.org/pipermail/elfutils-devel/2023q2/006225.html.

(cherry picked from commit 21a2c735e2bfdc3bfdc42f894d6e3d00f4a38dcd)
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
msizanoen
f29f0877c5 Revert "core/service: when resetting PID also reset known flag"
This reverts commit ff32060f2ed37b68dc26256b05e2e69013b0ecfe.

This change is incorrect as we don't want to mark the PID as invalid but
only mark it as dead.

The change in question also breaks user level socket activation for
`podman.service` as the termination of the main `podman system service`
process is not properly handled, causing any application accessing the
socket to hang.

This is because the user-level `podman.service` unit also hosts two
non-main processes: `rootlessport` and `rootlessport-child` which causes
the `cgroup_good` check to still succeed.

The original submitter of this commit is recommended to find another
more correct way to fix the cgroupsv1 issue on CentOS 8.
2023-07-07 19:30:52 +01:00
Lennart Poettering
0625ef75b6 man: place options in a some limited form of subsections
Let's visually separate the options associated with cpu, io, memory, …
in subsections

This patch tries to be minimal. It just adds the section titles, and
does minimal reordering to make sure the options on the same kind of
resource are placed close to each other.

(cherry picked from commit 5cbfbf2aaac66111584798fdb38f243f8593444e)
2023-07-07 19:30:52 +01:00
Zbigniew Jędrzejewski-Szmek
620cab2d4c machinectl: fix message
bus_wait_for_jobs_new() can fail for various reasons.

(cherry picked from commit b2544bb6e851dabdde106539ba14b86cf4cfa5cb)
2023-07-07 19:30:52 +01:00
Zbigniew Jędrzejewski-Szmek
b16d01b484 man/systemd-nspawn: fix indentation and parenthesis location
(cherry picked from commit 730bdfed8173d508d4202b0bee957ab70b1e16a1)
2023-07-07 19:30:52 +01:00
Zbigniew Jędrzejewski-Szmek
07523a0ea4 docs/CREDENTIALS: fix confusion of i.e. and e.g.
(cherry picked from commit 5811490a3f3802c3e4980efe0b7e2d3105d3c505)
2023-07-07 19:30:52 +01:00
Gibeom Gwon
d682e0975f homework: resize to maximum disk space if disk size is not specified
If the backing storage is LUKS2 on a block device, auto resize mode
is enabled, and disk size is not specified, resize the partition to
the maximum expandable size.

Fixes: #22255, #23967
(cherry picked from commit 5bfc4de6343905743d973834554b49cb60183481)
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
228bfcf041 journal: avoid infinite recursion when closing bad journal FD
When trying to log, if we fail we try to close the journal FD. If
it is bad, safe_close() will fail and assert, which will try to log,
which will fail, which will try to close the journal FD...
Infinite recursion looks very pretty live in gdb, but let's avoid
that by immediately invalidating the journal FD before closing it.

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