1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-01 05:47:04 +03:00

63316 Commits

Author SHA1 Message Date
Lennart Poettering
fb61001341 cryptsetup: pass AskPasswordFlags down into pkcs11 module
The pkcs11 cryptsetup token module is a bit different from the tpm2 +
fido2 ones: it asks for the PIN itself, rather than bubbling up a
request to get a PIN. That's because it might need multiple, and because
we don't want to destroy a the pkcs11 session half-way and thus risk
increasing pin counters.

Hence, we sometimes ask for PINs from our code, rather than let the
libcryptsetup caller do that. So far we didn't pass the AskPasswordFlags
field down into the module though. Fix that.

Fixes: #28665
(cherry picked from commit a758a128709cbcd99eddd1de6ea0e9846b9ce2eb)
(cherry picked from commit d1e542ca9c2124fe6fa1f49f3d23b4d0336a442e)
2023-11-09 21:05:51 +00:00
Luca Boccassi
3b305e40f0 mkosi: explicitly disable KVM in GHA runs
mkosi detects whether /dev/kvm is available and uses it if it is. But
some GHA hosts have it, but it's broken and not supported, so we need
to explicitly disable it.

(cherry picked from commit c13e6c720d17a336021a8bd28c5ff5818e61deb6)
(cherry picked from commit b4b04547a73b2d90e33dfa78a2b5c12c05f6e851)
2023-11-09 21:05:51 +00:00
Lennart Poettering
bda936e151 resolved: make sure "resolvectl monitor" can properly deal with stub queries
If we receive a query via the two stubs we store the original packet
instead of just the question object. Hence when we send monitor info to
subscribed clients we need to extract its question and also include it
in the returned data.

Fixes: #29580
(cherry picked from commit ae55c9c0aed1578efd981a9fe79135112e643575)
(cherry picked from commit bb8f26f07d0828245b7987b3cb7b48ab6df3a9ee)
2023-11-09 21:05:51 +00:00
Lennart Poettering
2b0492f4a4 sort-util: make bsearch_safe() actually typesafe, by returning the right type
(cherry picked from commit 423e2400afbecd0254515209642089ddbf787249)
(cherry picked from commit c8b2999ae3b32bc7eaab71ca3a1ebf660461d57e)
2023-11-09 21:05:51 +00:00
Lennart Poettering
f912ef6dc1 proc-cmdline: use read_virtual_file() for /proc/cmdline
(cherry picked from commit 943aca96f77d0ed0bf20385bb3718475438105ce)
(cherry picked from commit 5f729e382afef2a6c96b32ea7e7e8544bbab5fbb)
2023-11-09 21:05:51 +00:00
Lennart Poettering
0bf2ccc4a0 cryptenroll: use erase_and_free() at two more places
(cherry picked from commit a3b46c6bf6ed2d0019e8f27531efd5998d71139d)
(cherry picked from commit bdae3baf6b290eb1c7ebd95b391d260e67043ae8)
2023-11-09 21:05:51 +00:00
Luca Boccassi
6f0357b138 tools: syscall tables moved to a subdirectory
(cherry picked from commit 4561c679bca6d4a016d4e9b5657fb5ffd7902093)
(cherry picked from commit 5ba1f99b0b8317d75965d242d6c6b9ac6193c5e9)
2023-11-09 21:05:51 +00:00
Yu Watanabe
225c0e6a79 sd-netlink: res_id is 16bit but serial is 32bit
The explicit value here is not so important.
Let's chop off the higher bits.

Fixes the issue reported at
https://github.com/systemd/systemd/pull/29802#issuecomment-1788637950.

(cherry picked from commit 4314abf6d4e612e33c53909339931f2bd4cc0c29)
(cherry picked from commit 0175e2ea6e5fc44c7e2953f3f50775a12dbd6b58)
2023-11-09 21:05:51 +00:00
André Paiusco
d387e5df1f man: Improve text for SystemMaxFileSize when not set
If one sets the SystemMaxUse=64G by the current documentation would expect that each files size would be around 1/8 of this value (8G), althought if the SystemMaxFileSize is not explicit set, it has a max of 128M per file.

(cherry picked from commit d397191b6d3001c2920e15e3ce3c9e7a31c66436)
(cherry picked from commit 83bc13e77ae5e27e420ca3e1e3b4da7c1c2e17cc)
2023-11-09 21:05:51 +00:00
Peter Hutterer
cc09085ac3 analyze: handle CAP_BPF support
(cherry picked from commit 4f7a629e6c11fb2f060f18a62d073410ffa5a0ca)
(cherry picked from commit f58b5ce7dc8232f2305b9c8ce2e73b626a9d0dd8)
2023-11-09 21:05:51 +00:00
Lennart Poettering
1d6c94b72b man: explicitly mention that environment.d/ cannot be used to set the service manager's own env block
Fixes: #29414
(cherry picked from commit bebf6fcf223c46f238184389befb2b05f4d2ff10)
(cherry picked from commit bb0a377c52cf23417c7af4601b7bef74beb7e990)
2023-11-09 21:05:51 +00:00
Lennart Poettering
72867431cc coredump: let's always drop privileges
Let's unconditionally drop privileges before submitting the coredump log
message.

Let's make the codepaths where we acquired a coredump and where we
didn't more alike: let's drop privs in both cases.

This is not only safer, but means that the coredump messages are always
accessible by the owner of the aborted process.

(cherry picked from commit c8e9476386fa9218720db0aada03c67dc89720b1)
(cherry picked from commit f0c9378e89025e83d860fe852ced3d657cd298de)
2023-11-09 21:05:51 +00:00
Lennart Poettering
4f66592293 coredump: tweak coredump log message
Let's not claim a process dumped core if that was disabled via resource
limits.

While we are at it, switch from stack to heap allocation for the log
message, as it includes a stack trace which can be arbitrarily large.

Fixes: #28559
(cherry picked from commit 6fea39bacc53de2b14f12b434d4a4907cbf554a2)
(cherry picked from commit 8e3ebafd05974e24d17f9aadded6fea75c043315)
2023-11-09 21:05:51 +00:00
Michal Sekletar
4b4ef92bad man: change title of the section to better reflect actual content
(cherry picked from commit 448a21abbd23d18c0ed50c894b9f73118112dc55)
(cherry picked from commit 29e61fbea5b90a61b20027407840ff2c40412c69)
2023-11-09 21:05:51 +00:00
Lennart Poettering
8d3d163c3f nspawn: fix barriers when wiping fully visible procfs/sysfs
Let's wait until the child is fully done with mounting it's own
instances of procfs/sysfs before we destroy our fully visible copies of
it.

This borrows heavily from Christian Brauners fix #29521, but splits the
place + sync into two steps so that the child payload is not started
before the parent has destroyed the procfs instance.

Alternative to: #29521
Fixes: #28157

(cherry picked from commit 1a8d781495c91c3bf62bf87190af4470a44ba8a5)
(cherry picked from commit 99d80a28eeb9943d0386934217c865441cc26c04)
2023-11-09 21:05:51 +00:00
Yu Watanabe
920f84a529 udev: fix device name shown in the log message on failure
Prompted by #29500.

(cherry picked from commit 2b43c5cb7a7771feff9556685925de0adf9414f2)
(cherry picked from commit 3e60339229f4843c4facf08092c8eca795de1b7b)
2023-11-09 21:05:51 +00:00
Michal Koutný
147ad7d0a3 man: Add remarks about StandardInput=socket and sd_listen_fds()
It confuses users when they cannot find respective environment variables
with config that is supposes for (x)inetd activated service only.

Fix: #29670
(cherry picked from commit 788b7e7630669a47c54c6f3299af14db26ca7fe0)
(cherry picked from commit 136dc1c818aab93301032664931765f6285d0ba8)
2023-11-09 21:05:51 +00:00
Michal Koutný
09fac9bc90 sysctl.d: Fix pid_max comment
The actual default is 2^15 and that is also 32b kernels default.
Fix the value, mention 32b and do not talk about default which may
depend on nr_cpus.

Fix: #29607
(cherry picked from commit 761791bcf83219f44fc799a2e4326121486817b4)
(cherry picked from commit 02eb3ed7059fb2ee1c7e45bbc62dedbc6cb805aa)
2023-11-09 21:05:51 +00:00
Yu Watanabe
e4480c319e tests: use log_tests_skipped() and friend more
(cherry picked from commit 84a594f4b34627b2121f6231270b169cff095323)
(cherry picked from commit c1c14c207a8ac8b8ffa62bab32e7ddfb17bc91ee)
2023-11-09 21:05:51 +00:00
Yu Watanabe
8d2f850682 tests: make log_tests_skipped() and friend accept format string
(cherry picked from commit 678fbf7eef9e6ef9865c7845ab4b9983f754e208)
(cherry picked from commit 37e6e8b78a00154ed70136f506b237fc338f40f6)
2023-11-09 21:05:51 +00:00
Frantisek Sumsal
aefe546793 test-network: copy rules from source & build trees if needed
When running with --build-dir= we need to copy over udev rules from
$BUILD_DIR/udev.d/ and $SOURCE_TREE/udev.d/ to make stuff work as
expected.

(cherry picked from commit 33b0e0c09a438fd565b6c4d059bd14cc9651c40b)
(cherry picked from commit 359fed84eea82238a7ccdf5eb76d635afefdcaa4)
2023-11-09 21:05:51 +00:00
Raito Bezarius
32af667a50 secure-boot: print just before cold-resetting to help diagnose hangs
When testing the secureboot enroll feature, it can be hard to distinguish without
using the QMP API of QEMU whether we are in a hang situation of the UEFI firmware.

Making it clear that we reached the `ResetSystem` can be helpful towards that need.

(cherry picked from commit b9a0a13f7ad71896c8382968e492a94922b0d744)
(cherry picked from commit 2962ffd0b2a21c1603ccab266830f1fd402e806f)
2023-11-09 21:05:51 +00:00
Lennart Poettering
d5879d30c2 doc: document explicitly when we require specific top-level mounts to be established
(cherry picked from commit df586a49bb05f94925687ef71953b4a3b1bdb3e6)
(cherry picked from commit 214a827fbac6756266b1acfeaa09387b4b009df8)
2023-11-09 21:05:51 +00:00
Alex Hudspith
271026144d man: revise wording of cgtop -k and -P
Resolves: #29753
(cherry picked from commit ade790006b20e0788e8fa7cef2ae92cfd666d068)
(cherry picked from commit 8649d06cfe8882ea5129677aa5134feff2212b63)
2023-11-09 21:05:51 +00:00
Frantisek Sumsal
ff41e235af core: don't insert an extra space before each SocketBind{Allow,Deny}= item
The extra space was actually screwing up deserialization:

~# systemd-run --wait --pipe -p SocketBindAllow=any true
Running as unit: run-u167.service
Finished with result: exit-code
Main processes terminated with: code=exited/status=234
Service runtime: 1ms
CPU time consumed: 0
~# journalctl -b -p err
...
Oct 27 16:39:15 arch systemd-executor[5983]: Failed to deserialize: Invalid argument

Let's not do that by default and introduce a simple wrapper which
inserts the space after each item only when necessary.

(cherry picked from commit b0bb3be130e241178646df0b5c5f02ed661651d4)
(cherry picked from commit 14fbb396eecfcd120329e4cd74edc1bc009c1837)
2023-11-09 21:05:51 +00:00
xinpeng wang
f0d75d8d3d logind: fix abnormal switching causing the screen to go black
After logind receives the SIGRTMIN signal from the kernel, it will execute
manager_vt_switch---session_leave_vt---session_device_pause_all,The device
permissions of the session are removed here;under normal circumstances, the
tty value read from /sys/class/tty/tty0/active changes and switchesto a new
session,give the new session resume device permissions.
But under abnormal circumstances (such as switching quickly on a device using
wayland; and sometimes the kernel will suddenly send a SIGRTMIN signal, but
nothing changes),In these cases, logind does not give session resume device
permission, causing the device to have a black screen and suspended animation.

(cherry picked from commit 2f1d1140101268e69204ec62dd9abb8ead4b48c8)
(cherry picked from commit ca4f72f46009ce249d6c265b2a0fba67e7b72ad8)
2023-11-09 21:05:51 +00:00
Richard Maw
d9ed234b92 test: Skip test-recurse-dir on overlayfs
(cherry picked from commit 31cfcf50088b69c973b9335a2383fa6502d90419)
(cherry picked from commit 6f6fb0178dc536fe04aa175a585cd2bd22656240)
2023-11-09 21:05:51 +00:00
Malte Poll
3718afbe43 mkfs-util: set timezone to UTC when copying files into fat partition
mcopy will set the modification time of created directories to the mtime
of the source directories but converts it to the timezone of the host.
This behavior is identical to Windows / DOS:

>  The FAT file system stores time values based on the local time of the computer.

-- https://learn.microsoft.com/en-us/windows/win32/sysinfo/file-times

To achieve reproducible builds, mcopy should be invoked with TZ=UTC.

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
(cherry picked from commit b2942c76adc5bb6a3e073aa5cee57834ee3a9813)
(cherry picked from commit a79a2997ecfdd271d8845c762764469bb553519f)
2023-11-09 21:05:51 +00:00
Malte Poll
c693475fbc mkfs-util: propagate SOURCE_DATE_EPOCH to mcopy
Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
(cherry picked from commit 4947de275a5553399854cc748f4f13e4ae2ba069)
(cherry picked from commit 6b9297be80c4d98f014cf8d2d2fb3db644b16d5e)
2023-11-09 21:05:51 +00:00
Daniel P. Berrangé
95cbb9e857 test-systemd-tmpfiles: skip when /tmp has unexpected ownership
The systemd-tmpfiles binary will report a fatal error if /tmp is not owned
either by root, or by the current user:

  Detected unsafe path transition /tmp (owned by nobody) →
    /tmp/test-systemd-tmpfiles.a8qc6n18 (owned by berrange)
    during canonicalization of
    tmp/test-systemd-tmpfiles.a8qc6n18/test-content.7chd7rdi

When doing development inside a 'toolbox' container (which is required
on a Fedora SilverBlue distro), /tmp is owned by 'nobody', because it
has been passed through from the host and host UID 0 gets mapped to
UID 65536 by usernamespaces. This triggers the unsafe path transition
error message.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 8473ece90e53040931c880bcbff623f1a5c037cd)
(cherry picked from commit c7482035e3cefbfae2a1cc4b4529ebb705d67531)
2023-11-09 21:05:51 +00:00
Daniel P. Berrangé
303b9e36ab test-blockdev-util: avoid abort when /home is a symlink
On rpm-ostree distributions like Fedora SilverBlue /home (and various
other well known locations) are symlinks to somewhere beneath /var.

The path_is_encrypted() method uses O_NOFOLLOW and as a result will
return ELOOP on /home. This causes test-blockdev-util to abort.
Add ELOOP to the ignorable set of errnos for testing.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 6aa77f9284070229f73063e15cb4b4aa59cb6020)
(cherry picked from commit 1fcf8b5c8d217621d080fb41005f49e0608fa014)
2023-11-09 21:05:51 +00:00
Yu Watanabe
240190e01f inotify-util: drop to use pointer outside of the buffer
Hopefully fixes many Coverity issues.

(cherry picked from commit 9e15e24bdbc695fe4fb65155b4e3bf73db34152b)
(cherry picked from commit c63cd5d55ed95bdda1512baf67d549d8a5d7d91f)
2023-11-09 21:05:51 +00:00
Frantisek Sumsal
bd8c10706d random-seed: terminate the option array
So we don't crash on invalid options:

$ build/systemd-random-seed --foo
Segmentation fault (core dumped)

(cherry picked from commit dd741b8893f28ec75fae9648c9e26c2fc887a781)
(cherry picked from commit b83e9fdf7cc8c925c5c7dcfd44ae8b2d6ace9bc8)
2023-11-09 21:05:51 +00:00
Mike Yuan
de771adb6b man/systemd.unit: add PropagatesStopTo= to reverse property table
(cherry picked from commit 8c29f6a572318fc4de63b084e2ee94021d52459a)
(cherry picked from commit 0c2e0082e23977da1112ce7d22024808d3795f5a)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
1303c2782e shared/copy: rewind dir fd before using it for cleanup
This seems to be the only place where rm_rf_children() is called with a
possibly used fd, which is then passed through to rm_rf_children_impl().

This also fixes #29606.
(Tested on Fedora rawhide with kernel 6.5.6-300.fc39.x86_64.)

(cherry picked from commit e3b84b105e632731352776fd619bbbea4d223b35)
(cherry picked from commit 02b14e74b79cff5f37a8b9984215829bb2837b21)
2023-11-09 21:05:51 +00:00
Martin Wilck
6d5eba0814 units: modprobe@.service: don't unescape instance name
modprobe treats "-" and "_" interchangeably, thereby avoiding frequent
errors because some module names contain dashes and others underscores.

Because modprobe@.service unescapes the instance name, an attempt to
start "modprobe@dm-crypt.service" will run "modprobe -abq dm/crypt",
which is doomed to fail. "modprobe@dm_crypt.service" will work as
expected. Thus unescaping the instance name has surprising side effects.
Use "%i" instead.

(cherry picked from commit bf25cf6c49253e922524dfa0e7960f554838f18b)
(cherry picked from commit c98d0130dc8efd826cd85020337353cdbe644bb4)
2023-11-09 21:05:51 +00:00
Franck Bui
0a48f8ac7b test: install af_packet kernel module on openSUSE
Currently needed by test-dhcp-server unit test, af_packet is not built-in on
openSUSE distributions.

(cherry picked from commit a1af99df8e29ffb55b0c698eeda2c9bf795fc0e1)
(cherry picked from commit db2193609e554732c0288ccf27d5e58083f9219c)
2023-11-09 21:05:51 +00:00
Yu Watanabe
be72aa0bf2 fuzz: include library headers first
(cherry picked from commit f3d84e20c9f1d8892f4f8d336041cacf0b6936c7)
(cherry picked from commit 2fedbd12768f32a5b081258fbeb00003b02edd42)
2023-11-09 21:05:51 +00:00
Joerg Behrmann
e31805d26a credentials: document that their path is stable for system services
(cherry picked from commit cf37171890bdaec1dc0cd56828047f4eb899fc3a)
(cherry picked from commit 823216d61f6291d7fc13c271bfda368513440a4c)
2023-11-09 21:05:51 +00:00
Lennart Poettering
b5e10fd566 man: document the order in which we talk to DNS servers
(cherry picked from commit 612a91c11ae2c3183cb27fa0841a997eefb71fbb)
(cherry picked from commit 259a6a3f51f425c08688c56c2cf23d37bb0aa2df)
2023-11-09 21:05:51 +00:00
Zbigniew Jędrzejewski-Szmek
e483b89165 test-recurse-dir: work around nftw() ignoring symlinks()
We have a test where we compare the results from nftw() and our own
resurce_dit_at(). nftw() skips a dangling symlink when running under mkosi and
the test fails. I don't understand why nftw() does that, but in our code we
don't need to test and care about the details of nftw(), which we don't use,
outside of the one test, so let's just skip symlinks in the test.

Closes #29603.

(cherry picked from commit 974959e6f6352b76355b76ab550c0e729b2a8c21)
(cherry picked from commit 7db0b4c8df422fafa245f7ab0833b0ec764174ad)
2023-11-09 21:05:51 +00:00
Lennart Poettering
45931776bf test-cgroup: make test case a bit more robust towards previous aborted runs
(cherry picked from commit d0547385d9da980ca752e1f5df959280a053fdb4)
(cherry picked from commit bcc8f8a96431ef51591a08f78d4e2b365241c36a)
2023-11-09 21:05:51 +00:00
Lennart Poettering
4cf18fce15 run: pin the unit we invoke continously while we are running
We read properties of the unit, hence it shouldn't be GC'ed as long as
we run. Hence, let's just set AddRef unconditionally for the units we
create.

(cherry picked from commit 49a510eba29c78f4b7dc1c39391314a48eb8833b)
(cherry picked from commit 8326f9e378333ae01f686086bb1fd4d300d7c99b)
2023-11-09 21:05:51 +00:00
Priit Laes
3ac8834559 systemd-journal-upload: Increase failure tolerance (#19426, #2877)
As systemd-journal-upload deals mostly with remote servers, add
some failsafes to its unit to restart on failures.

```
[Service]
Restart=on-failure
RestartSteps=10
RestartMaxDelaySec=60
```

(cherry picked from commit c08bec1587e102dd0435969e422288d69431e92c)
(cherry picked from commit fe0bf9f61913d70739359268134cbd10e375fe93)
2023-11-09 21:05:51 +00:00
Yu Watanabe
9033f481f2 network: do not trigger assertion by forcerenew command
When DHCP server is not running, sending force-renew command triggers
assertion.

(cherry picked from commit d311f5e277ae3609e661415b6c429fe3cd25e40b)
(cherry picked from commit 2cd9de1bbd76fc8a4f8cc0b10ea7cbb78fe0db1d)
2023-11-09 21:05:51 +00:00
Yu Watanabe
1da2d9301c sd-dhcp-server: make sd_dhcp_server_is_running() silently work with NULL
We already do in the same way for sd-dhcp-client and friends.

(cherry picked from commit 39ba10f19e7d384ad48aaad9ff6c0b3c3e6bbef1)
(cherry picked from commit a7117e29f59fa6a81eb7025ec446b95c6b35f91a)
2023-11-09 21:05:51 +00:00
Yu Watanabe
073d2db589 network: restart dhcp4 client when renewing lease is requested but the client is stopped
Follow-up for fc35a9f8d1632c4e7a279228f869bfc77d8f5b9c.

Fixes the issue https://github.com/systemd/systemd/pull/29472#issuecomment-1759092138.

(cherry picked from commit 9bd91e34aaf7c759617d4763853e55f419c06ffe)
(cherry picked from commit f453cbc5162eca42c415b8dc2325a7d734aca3e5)
2023-11-09 21:05:51 +00:00
Yu Watanabe
ca1a43c56b core/execute: suppress logs if LogLevelMax= is specified
Fixes #29532.

(cherry picked from commit 3bb424c837eca2d8041f9e000a268a6a2b582981)
(cherry picked from commit 053e120636f031e0b7d185b4136ad3e10c13d8de)
2023-11-09 21:05:51 +00:00
Lennart Poettering
f7022ac612 bpf-lsm: suppress noisy debug log message if we remove a unit from the bpf-lsm table where it was never added
There's really no point in logging about one of the most common cases we
have: that no BPF-LSM policy was installed for a specific unit.

(cherry picked from commit 58f1bd9b4ab889d0378a236d759649d4b45395f9)
(cherry picked from commit 86a85cb2b56f582c3a1e09d17a7f544bad0c23a7)
2023-11-09 21:05:51 +00:00
Lennart Poettering
062e3032e2 fdset: improve debug logging for left-over fds
Let's show which fds are closed as part of the left-over fd set logic on
daemon reload/reexec cycles.

This is useful to debug accidentally unclaimed fds.

(cherry picked from commit 91a6447607635802ac2278b7997cde687e2549a4)
(cherry picked from commit b4cdf320554f122700e9d12c81dccf2c7565860b)
2023-11-09 21:05:51 +00:00