1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-06 17:18:12 +03:00
Commit Graph

74762 Commits

Author SHA1 Message Date
Daan De Meyer
d0e8b7cb19 mkosi: Install llvm
For llvm-symbolizer which is required to sanitize address sanitizer
reports.

(cherry picked from commit c022fcd80c)
2024-08-15 14:04:41 +01:00
Daan De Meyer
46d6146776 mkosi: Disable pagination in gdb
(cherry picked from commit 7628565604)
2024-08-15 14:04:41 +01:00
James Muir
817dcbe7a6 man/systemd-sysusers, man/systemd-tmpfiles: fix sentence fragments
add "are executed" so that those two sentences have a verb.

(cherry picked from commit c5903cde63)
2024-08-15 14:04:41 +01:00
Daan De Meyer
65eff444c4 docs: Mention the new mount API in the container interface doc
Let's mention that the new mount API may be used to establish new
mounts in a container without needing the /run/host/incoming directory.

(cherry picked from commit 74cc5e2041)
2024-08-15 14:04:41 +01:00
Mike Yuan
e608023bc8 edit-util: do not try to recreate temp file if missing
We initially read from temp file, then strip it, and write
back to it. If the file suddenly disappeared during the process,
it indicates someone else is touching our temp file
behind our back. Let's not silently continue.

(cherry picked from commit 3b5b2ff8fa)
2024-08-15 14:04:41 +01:00
Ivan Shapovalov
b628d4dfa6 core/exec-invoke: call setpriority() after sched_setattr()
The nice value is part of struct sched_attr, and consequently invoking
sched_setattr() after setpriority() would clobber the nice value with
the default (as we are not setting it in struct sched_attr).

It would be best to combine both calls, but for now simply invoke
setpriority() after sched_setattr() to make sure Nice= remains effective
when used together with CPUSchedulingPolicy=.

(cherry picked from commit 711a157738)
2024-08-15 14:04:41 +01:00
Nick Rosbrook
6f57f9b8aa core/unit: do not use unit path cache in unit_need_daemon_reload()
When unit_need_daemon_reload() calls unit_find_dropin_paths() to check
for new drop-in configs, the manager's unit path cache is used to limit
which directories are considered. If a new drop-in directory is created,
it may not be in the unit path cache, and hence unit_need_daemon_reload()
may return false, despite a new drop-in being present. However, if a
unit path cache is not given to unit_file_find_dropin_paths() at all,
then it behaves as if the target path was found in the unit path cache.

So, to fix this, adapt unit_find_dropin_paths() to take a boolean
argument indicating whether or not to pass along the unit path cache.
Set this to false in unit_need_daemon_reload().

Fixes #31752

(cherry picked from commit 82c482d573)
2024-08-15 14:04:41 +01:00
Luca Boccassi
195124fd1c test: note in README how to get full list of Ubuntu CI jobs
(cherry picked from commit 79488ac003)
2024-08-15 14:04:41 +01:00
Daan De Meyer
afcc3f39a3 mkosi: Disable debuginfod
We generally don't care about library debuginfo so let's just disable
debuginfod so it doesn't get in the way when debugging.

We use /root/.gdbinit as the systemwide gdbinit location is distribution
specific.

(cherry picked from commit 2561e2a356)
2024-08-15 14:04:41 +01:00
Yu Watanabe
772549666c meson: enable -Wunterminated-string-initialization
With af1a6db58f, now we can build with the
option.

(cherry picked from commit f548bc4011)
2024-08-15 14:04:41 +01:00
Cristian Rodríguez
ca09bc33e8 basic|boot: silence Wunterminated-string-initialization gcc15 warnings
gcc15 has -Wunterminated-string-initialization in -Wextra and
warns about string constants that are not null terminated even though
the functions do do out of bounds access.
Silence the warnings by simply not providing an explicit size.

(cherry picked from commit af1a6db58f)
2024-08-15 14:04:41 +01:00
Nick Rosbrook
edf52384c2 sysusers: check if requested group name matches user name in queue
When creating a user, check if the requested group name matches a user
name in the queue. If that matched user name is also going to be a group
name, then use it for the new user too. In other words, allow the
following:

 u foo -
 u bar -:foo

when both foo and bar are new users.

Fixes #33547

(cherry picked from commit 18a8f03e51)
2024-08-15 14:04:41 +01:00
Yu Watanabe
b50419e838 systemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry=help
This fixes the following assertion:
===
SYSTEMD_LOG_LEVEL=debug systemctl --user -H foo --boot-loader-entry=help
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Ignoring.
Failed to connect to bus: Operation not supported
===

Fixes a bug introduced by 97af80c5a7.
Fixes #33661.
Fixes oss-fuzz#70153.

(cherry picked from commit 1056457d11)
2024-08-15 14:04:41 +01:00
Arnaud Patard
74f830e048 src/pcrlock/pcrlock.c: Handle empty pcrlock.d directories
Running the following commands:

  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock predict --pcr=1+2+3+4+5+16

Will result in:

...
Floating point exception

Running the following commands:
  # mkdir -p /var/lib/pcrlock.d/123-empty.pcrlock.d
  # /usr/lib/systemd/systemd-pcrlock make-policy --pcr=1+2+3+4+5+16

Will result to this (partial) log:
...
Predicted future PCRs in 133us.
[]
...
Written policy digest 0000000000000000000000000000000000000000000000000000000000000000 to NV index 0x1921da6
...

So, add missing checks to handle gracefully cases where there's no variant
inside the component.

Signed-off-by: Arnaud Patard <arnaud.patard@collabora.com>
(cherry picked from commit e7a93e7521)
2024-08-15 14:04:41 +01:00
Daan De Meyer
4ba2973515 mkosi: Prevent busybox from getting pulled into opensuse images
OpenSUSE's busybox has a bunch of Provides for basic tools that cause
it to get pulled into images unless the corresponding tool is explicitly
installed so let's add explicit tools to make sure we don't get busybox.

(cherry picked from commit 857e4528f5)
2024-08-15 14:04:41 +01:00
Daan De Meyer
df3736d149 test: Add a way to quickly iterate on an integration test
Rebuilding the integration test every time is very slow. Let's
introduce a way to iterate on an integration test without rebuilding
the image every time. By making a btrfs snapshot before we run the
integration test, we can then systemctl soft-reboot after running
the test to restore the rootfs to a pristine state before running
the test again.

As /run/nextroot will get nuked on reboot or soft-reboot, we introduce
a tmpfiles snippet to make sure it is recreated every (soft-)reboot
and adapt the existing tests to deal with this new symlink.

(cherry picked from commit af153e36ae)
2024-08-15 14:04:41 +01:00
Daan De Meyer
8c61438bd5 mkosi: Switch back to btrfs
The next commit will introduce a way to iterate on integration
tests which depends on btrfs specific features.

We leave CentOS on ext4 as its kernel does not support btrfs.

(cherry picked from commit edc6592e53)
2024-08-15 14:04:41 +01:00
Daan De Meyer
8424539cdf mkosi: Enable Autologin= again on Debian
Debian uses /usr/bin/login from the shadow package instead of util-linux
which doesn't support credentials. Let's enable autologin the old
fashioned way for now.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833256
(cherry picked from commit ea696c5f53)
2024-08-15 14:04:41 +01:00
Daan De Meyer
ad43f87ae8 test: Implement TEST_SHELL for mkosi based test runner
TEST_SHELL can be used to get a shell in the integration test
environment without actually immediately starting the test.

(cherry picked from commit dd1c01b20f)
2024-08-15 14:04:41 +01:00
Daan De Meyer
039af94fb5 test: Rename INTERACTIVE_DEBUG to TEST_SHELL
(cherry picked from commit 33f400a9e0)
2024-08-15 14:04:41 +01:00
Daan De Meyer
52897cf6a4 docs: Update upgrade commands in HACKING.md
- Add the required options to make the package managers non interactive
- Use apt-get instead of apt
- Remove --reinstall from apt-get command so we only install newer packages
- Add --needed to pacman command so we only install newer packages

(cherry picked from commit 5f5b6fa901)
2024-08-15 14:04:41 +01:00
Daan De Meyer
ea52a7cdc4 mkosi: Drop locale tmpfiles snippet
Not required anymore as we don't do /usr only anymore and the symlink
will be created by the debian systemd package.

(cherry picked from commit 63bafef12b)
2024-08-15 14:04:41 +01:00
Yu Watanabe
c0d45f8ec6 journal: set flushed flag even if we fail to open runtime journals
As at this stage, a persistent journal file has been already opened, and
saved seqnum has been reset, and any later journal entries will be stored
to the file. Hence we should not open the runtime journal file by
server_system_journal_open() again.

(cherry picked from commit b55027efe4)
2024-08-15 14:04:41 +01:00
Yu Watanabe
8d5806b1e2 journal: comment the default value in journald.conf
(cherry picked from commit 0d113f8e70)
2024-08-15 14:04:41 +01:00
Yu Watanabe
837c219e2d journal: do not rotate journal when MaxRetentionSec= is set
The setting is about vacuuming archived journal files. It is not
necessary to rotate the current journal. Note, journal file rotation is
controlled by MaxFileSec=.

Fixes #31315.

(cherry picked from commit b63c18db03)
2024-08-15 14:04:41 +01:00
Yu Watanabe
0195db6e91 resolve: refuse invalid service without type field
Fixes Fixes #33935.

(cherry picked from commit b48ab08732)
2024-08-15 14:04:41 +01:00
Yu Watanabe
90b1b2a500 systemctl: refuse --capsule=foo with --system
Fixes the following assertion:
===
systemctl --capsule=hoge --system reboot
Assertion 'runtime_scope == RUNTIME_SCOPE_USER' failed at src/shared/bus-util.c:479, function bus_connect_transport(). Aborting.
Aborted (core dumped)
===

Follow-up for 56cb74c3cd.

(cherry picked from commit bcf982223c)
2024-08-15 14:04:41 +01:00
Luca Boccassi
38caeac768 base-filesystem: do not attempt to create a /lib64 -> /usr/lib/<tuple> symlink
In multi-arch distributions (debian and derivatives) multiarch tuples under
/usr/lib are used, such as /usr/lib/x86_64-linux-gnu/ but the /lib64 symlink
should never point there, it should always point to /usr/lib64, as that's
how they are set up by distribution-specific tools.

https://packages.debian.org/bookworm/amd64/libc6-i386/filelist
https://packages.debian.org/bookworm/mipsel/libc6-mips64/filelist
https://salsa.debian.org/md/usrmerge/-/blob/master/convert-usrmerge?ref_type=heads#L295
https://salsa.debian.org/md/usrmerge/-/blob/master/convert-usrmerge?ref_type=heads#L517
http://bugs.debian.org/1076491

Fixes https://github.com/systemd/systemd/issues/33919

(cherry picked from commit b75c13731e)
2024-08-15 14:04:41 +01:00
Daan De Meyer
2925fc2c6f meson: Use -fstrict-flex-arrays=3
Let's explicitly pass the value to -fstrict-flex-arrays. This does
not change behavior but it does (selfishly) make my error not bug
out with an error saying -fstrict-flex-arrays does not exist.

(cherry picked from commit ad723ca3e5)
2024-08-15 14:04:41 +01:00
Mike Yuan
c3ede0cfe7 core/execute-serialize: use serialize_item_escaped() for external paths
Otherwise, read_stripped_line() would spuriously drop trailing spaces.

Fixes #33924

(cherry picked from commit 9be46b1da8)
2024-08-15 14:04:41 +01:00
Mike Yuan
8beae81123 core/execute-serialize: drop extraneous '=' in ip-{in,e}gress serialization
(cherry picked from commit f0fdd13c2f)
2024-08-15 14:04:41 +01:00
Yu Watanabe
ce940b62ac man/net-naming-scheme: mention that NAMING_BRIDGE_MULTIFUNCTION_SLOT is reverted
Follow-up for af7417ac7b.
Closes #33596.

(cherry picked from commit 1c0130e8dc)
2024-08-15 14:04:41 +01:00
Yu Watanabe
ab4e1faca6 man: extend explanation for ConfigureWithoutCarrier= in systemd.network(5)
Prompted by #33702.

(cherry picked from commit 347c8822d1)
2024-08-15 14:04:41 +01:00
Daniel P. Berrangé
037510812f man/systemd-detect-virt: list known CVM technologies
Add a section which lists the known confidential virtual machine
technologies.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit a8fb5d21fd)
2024-08-15 14:04:41 +01:00
Daniel P. Berrangé
7a6d4cdc48 confidential-virt: add detection for s390x target
The s390x platform provides confidential VMs using the "Secure Execution"
technology, which is also referred to as "Protected Virtualization" or
just "prot virt" in Linux / QEMU.

This can be detected through a simple sysfs attribute.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 6c35e0a51c)
2024-08-15 14:04:41 +01:00
Daniel P. Berrangé
a1359ac940 confidential-virt: split caching of CVM detection into separate method
We have different impls of detect_confidential_virtualization per
architecture. The detection is cached in the x86_64 impl, and as we
add support for more targets, we want to use caching for all. It thus
makes sense to split caching out into an architecture independent
method.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 1c4bd7adcc)
2024-08-15 14:04:41 +01:00
Frantisek Sumsal
86d89f4a10 test: don't use /skipped for subtests
Since, at least the old framework, checks for the presence of the file
at the end and marks the whole test as skipped if it exists.

Resolves: systemd/systemd-centos-ci#728
(cherry picked from commit 4d1fbe53c1)
2024-08-15 14:04:41 +01:00
Ronan Pigott
f5376fea7d resolved: don't treat conn reset as packet loss
tcp reset / icmp port-unreachable are markedly different conditions than
packet loss. It doesn't make much sense to retry in this case. It's
actually not clear if there is any benefit at all retrying tcp
connections, which were presumably already retried as necessary by the
tcp stack.

(cherry picked from commit ddd710a355)
2024-08-15 14:04:41 +01:00
Yu Watanabe
11c15905cd import: check overflow
Fixes CID#1548022 and CID#1548075.

(cherry picked from commit f7012a93a7)
2024-08-15 14:04:41 +01:00
Frantisek Sumsal
2e2371c5b5 test: attempt to install sshd-session from multiple places
On Fedora the sshd-session binary is under /usr/libexec/openssh/ so
cover this path as well in the old framework.

Follow-up for aaa7b36bd1.

(cherry picked from commit ce2344bbee)
2024-08-15 14:04:41 +01:00
Daan De Meyer
913ef12103 mkosi: Beef up testuser a bit
Give it a password and add it to some common groups.

(cherry picked from commit 3fe25d4530)
2024-08-15 14:04:41 +01:00
Michal Sekletar
1a3d8368bc socket: fix socket activation of stopped services with pinned FD store
(cherry picked from commit 941a12dcba)
2024-08-15 14:04:41 +01:00
Daan De Meyer
091c4820c4 exec-credential: Skip duplicate credentials in load_credential_glob()
We document that when multiple credentials of the same name are found,
we use the first one found so let's actually implement that behavior.

(cherry picked from commit 3de13e6148)
2024-08-15 14:04:41 +01:00
Daan De Meyer
ee85ef4ffa exec-credential: Log if we skip duplicate credential
(cherry picked from commit 590348e2bf)
2024-08-15 14:04:41 +01:00
Daan De Meyer
181ee8b30d Drop EEXIST handling in load_credential_glob()
Credentials are written to a temporary file and renamed to the
destination with renameat() which will replace existing files so
EEXIST should not happen so drop the handling for EEXIST.

(cherry picked from commit 2c2ed3272b)
2024-08-15 14:04:41 +01:00
Daan De Meyer
f1d4e79eff cgroup-util: Don't try to open pidfd for kernel threads
The kernel might start returning -EINVAL when trying to open pidfd's
for kernel threads so let's not try to open pidfd's for kernel threads.

(cherry picked from commit ead48ec35c)
2024-08-15 14:04:41 +01:00
Daan De Meyer
f2edebce25 log: Fix size calculation for number of iovecs
Each log context field can expand to up to three iovecs (key, value
and newline) so let's fix the size calculation to take this into
account.

(cherry picked from commit fc83ff3f55)
2024-08-15 14:04:41 +01:00
Daan De Meyer
4fd349953e execute: Drop log level to unit log level in exec_spawn()
All messages logged from exec_spawn() are attributed to the unit
and as such we should set the log level to the unit's max log level
for the duration of the function.

(cherry picked from commit 7881f485c9)
2024-08-15 14:04:41 +01:00
Dan Nicholson
b5448c16f8 firstboot: fix root params with creds and prompting disabled
Remove an early return that prevents --prompt-root-password or
--prompt-root-shell and systemd.firstboot=off using credentials. In that case,
arg_prompt_root_password and arg_prompt_root_shell will be false, but the
prompt helpers still need to be called to read the credentials. Furthermore, if
only the root shell has been set, don't overwrite the root password.

(cherry picked from commit 35bc4c3424)
2024-08-15 14:04:41 +01:00
Dan Nicholson
847dd914d0 firstboot: handle missing root password entries
If /etc/passwd and/or /etc/shadow exist but don't have an existing root entry,
one needs to be added. Previously this only worked if the files didn't exist.

(cherry picked from commit 2319154a6b)
2024-08-15 14:04:41 +01:00