1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

68266 Commits

Author SHA1 Message Date
Mike Yuan
ba2f3ec832
fstab-generator: use RET_GATHER more 2023-10-27 17:51:18 +08:00
xinpeng wang
2f1d114010 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.
2023-10-27 10:19:58 +01:00
janana
2b4cdac91a udev: fix typo for persistent flag
The 'parsistent' adjective is misspelt.
2023-10-27 10:19:15 +01:00
Luca Boccassi
6cd1f6546c
Merge pull request #29332 from esposem/ukify_simplify
ukify: automatically infer --signtool from the parameters given
2023-10-27 00:10:28 +01:00
Michal Sekletar
1e9b2e4fdd fstab-generator: drop nofail and noauto options for critical mounts
Setting nofail for /usr mount doesn't make sense because without /usr we
can't really boot. However, having the flag set might cause races in
initrd where we could try to switchroot into rootfs before /usr is
actually mounted. Let's just ignore it so that we always have proper
mount unit ordering for /sysroot/usr mount.
2023-10-27 00:07:54 +01:00
Ronan Pigott
dc8db30db9 editorconfig: add NEWS whitespace configuration 2023-10-26 22:41:03 +01:00
Lennart Poettering
7113640493 fd-uitl: rename PIPE_EBADF → EBADF_PAIR, and add EBADF_TRIPLET
We use it for more than just pipe() arrays. For example also for
socketpair(). Hence let's give it a generic name.

Also add EBADF_TRIPLET to mirror this for things like
stdin/stdout/stderr arrays, which we use a bunch of times.
2023-10-26 22:30:42 +02:00
Raul Cheleguini
5e21da878c nspawn: Make parameter provided_mac a const for setup_veth() 2023-10-26 21:17:29 +01:00
Luca Boccassi
b44a72da57
Merge pull request #29711 from berrange/tests-silverblue
Fix test suite when developing on Fedora SilverBlue (rpm-ostree) host
2023-10-26 21:17:03 +01:00
Luca Boccassi
554a25eb9d
Merge pull request #29727 from aafeijoo-suse/default-tpm2-public-key-fix
tpm2: fixes related to `tpm2-pcr-public-key.pem`
2023-10-26 21:16:07 +01:00
Luca Boccassi
63862de4b7 core: do not post-process skipped mounts
When a mount is gracefully skipped (e.g.: BindReadOnlyPaths=-/nonexistent)
we still post-process it, like making it read-only. Except if nothing
has been mounted, the mount point will be made read-only for no reason.
Track when mounts are skipped and avoid post-processing.

One day we'll switch all of this to the new mount api and do these
operations atomically or not at all.

Fixes https://github.com/systemd/systemd/issues/29725
2023-10-26 21:15:41 +01:00
Richard Maw
31cfcf5008 test: Skip test-recurse-dir on overlayfs 2023-10-26 19:11:21 +01:00
Daan De Meyer
7b794ba019 mkfs-util: Use actual UID/GID in protofile instead of root 2023-10-26 19:10:31 +01:00
Antonio Alvarez Feijoo
2e9f607284
repart: do not ignore tpm2-pcr-public-key.pem
If `--tpm2-public-key=` is not specified, but `tpm2-pcr-public-key.pem` exists
in /{etc,run,usr/lib}/systemd/, it's being ignored.

Fixes 9e437994
2023-10-26 16:51:37 +02:00
Daniel P. Berrangé
3570ee3688 test-fstab-generator: skip test impacted by /mnt symlink
On rpm-ostree distributions such as Fedora SilverBlue /mnt
(and other well known paths) will be a symlink to a location
under /var. The fstab generator emits correct output in this
case, however, the data does not match the expected output
stored in the source tree.

Rather than trying to adapt the test data, just skip this
single test scenario when we see /mnt is a symlink.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-10-26 14:46:15 +01:00
Daniel P. Berrangé
8473ece90e 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>
2023-10-26 14:46:15 +01:00
Daniel P. Berrangé
6aa77f9284 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>
2023-10-26 14:46:15 +01:00
Michal Sekletar
76f2191d8e logind: introduce CreateSessionWithPIDFD()
This new D-Bus API uses pidfd to refer to the session leader. Also,
pam_systemd will try to make use of it when pidfd support is available.
2023-10-26 14:28:48 +01:00
Luca Boccassi
c895d047e3
Merge pull request #29720 from poettering/cgls-fix-delegate
cgls: fix display of delegation flag
2023-10-26 14:28:28 +01:00
Luca Boccassi
e34836aa59
Merge pull request #29529 from yuwata/core-namespace-check-priv
core/namespace: check if we have enough privilege
2023-10-26 14:27:56 +01:00
Antonio Alvarez Feijoo
cb7aabf180
cryptenroll: fix bind default TPM2 signed policy to PCR 11
If `--tpm2-public-key=` is not specified, but `tpm2-pcr-public-key.pem` exists
in /{etc,run,usr/lib}/systemd/, the default PCR 11 is not being set.

Fixes 9e437994
2023-10-26 15:14:52 +02:00
Lennart Poettering
34931384ac varlink: make sure 'incomplete' bool is nullable
This field is optional, it only makes sense for user records that
actually have a privileged part to set.
2023-10-26 11:52:07 +01:00
Yu Watanabe
e9af462aba test: add a simple test for PrivateNetwork= 2023-10-26 19:09:49 +09:00
Yu Watanabe
4793605db1 core/namespace: check if we have enough privilege to mount sysfs or procfs
If we do not have enough privilege to mount a new instance of sysfs or
procfs, units e.g. with PrivateNetwork=yes may fail.

Let's first try to mount sysfs or procfs anyway to check if we have enough
privilege.

Fixes #29526.
2023-10-26 19:09:46 +09:00
Yu Watanabe
b18f4eedeb core/namespace: unify logic of mounting /proc and /sys
No functional change, just refactoring.
2023-10-26 19:06:27 +09:00
Frantisek Sumsal
fa16ce6c44
Merge pull request #29718 from yuwata/networkd-update-state-file-after-dhcp6-information-request
network: update state file when DHCPv6 reply for INFORMATION-REQUEST is received
2023-10-26 08:16:57 +00:00
Lennart Poettering
001feb125b cgroup-show: rework cgroup tree display to operate by fd only
This restores display of the "delegate" flag of a cgroup. Previously we
erroneously passed a full fs path where a cgroup path was expected (the
difference being the /sys/fs/cgroup/ prefix), which meant we never read
the xattr properly. Let's fix that by simply operating by fd on the
cgroup and using it for all operations.
2023-10-26 09:28:29 +02:00
Lennart Poettering
6414203cfc cgroup-util: add cg_is_delegated_fd() helper
This is just like cg_is_delegate() but operates on an fd instead of a
cgroup path.

Sooner or later we should access cgroupfs mostly via fds rather than
paths, but we aren't there yet. But let's at least get started.
2023-10-26 09:27:27 +02:00
Lennart Poettering
f0b8ac9e0e tree-wide: port various users over to the new getxattr_at_bool() call 2023-10-26 09:27:18 +02:00
Lennart Poettering
70554f7ebc xattr-util: add new getxattr_at_bool() helper
This carefully combines getxattr_at_malloc() and parse_bool(), which is
something we use at multiple places.
2023-10-26 09:27:00 +02:00
Topi Miettinen
b208275300 core/cgroup: ignore NFT sets for other sources
Partially fixes: #29678
2023-10-26 08:24:14 +01:00
Luca Boccassi
43efbc3959 core: do not reset tty if there's no tty configured
Otherwise a lock is taken, which can be taken by multiple units at the
same time, depending on each other, causing a deadlock.

Fixes https://github.com/systemd/systemd/issues/29682
2023-10-26 09:13:05 +02:00
Yu Watanabe
9e15e24bdb inotify-util: drop to use pointer outside of the buffer
Hopefully fixes many Coverity issues.
2023-10-26 09:08:28 +02:00
Yu Watanabe
1bd0cefcab tree-wide: fix typo 2023-10-26 12:42:49 +09:00
Yu Watanabe
dd59a609be test-network: suppress too much outputs of state file
Follow-up for 0f9efffaeb.
2023-10-26 12:26:19 +09:00
Yu Watanabe
ef0a234a75 network: update state file when DHCPv6 reply for INFORMATION-REQUEST is received
Otherwise, received information, e.g. DNS servers, may not be saved in
the state file, and will not be propagated to clients like resolved.

Fixes the first issue of #29678.
2023-10-26 12:23:42 +09:00
Yu Watanabe
b9541abdb9 dissect: insert missing space 2023-10-26 12:16:12 +09:00
Daan De Meyer
c173be0d4c
Merge pull request #29708 from DaanDeMeyer/bootctl-always
Always build bootctl
2023-10-25 22:59:59 +02:00
Luca Boccassi
9ceda23941
Merge pull request #29710 from mrc0mmand/test-pcrextend
test: TEST-70-TPM2 shenagians
2023-10-25 21:13:56 +01:00
Frantisek Sumsal
dd741b8893 random-seed: terminate the option array
So we don't crash on invalid options:

$ build/systemd-random-seed --foo
Segmentation fault (core dumped)
2023-10-25 20:41:46 +01:00
Mike Yuan
8c29f6a572 man/systemd.unit: add PropagatesStopTo= to reverse property table 2023-10-25 19:34:17 +01:00
Frantisek Sumsal
d08b67e55e test: slightly extend systemd-tpm2-setup's coverage 2023-10-25 18:18:48 +02:00
Frantisek Sumsal
181a80e602 tpm2-setup: drop the COMMAND placeholder from the help
Since systemd-tpm2-setup doesn't expect any arguments.
2023-10-25 18:18:48 +02:00
Frantisek Sumsal
91893f772b tpm2-setup: terminate the option array
Otherwise bad things happen:

$ build/systemd-tpm2-setup --foo
Segmentation fault (core dumped)
2023-10-25 18:18:48 +02:00
Frantisek Sumsal
af70e2021e test: add a couple more tests for systemd-pcrextend 2023-10-25 18:18:47 +02:00
Frantisek Sumsal
45534eefe6 test: make the TPM event log checking a bit more robust
Don't hardcode the event number, so the test works correctly even if
someone wrote to the event log before us. Also, explicitly pick the
sha256 bank when checking digests, as the indexing may vary depending on
current TPM's capabilities.
2023-10-25 18:18:11 +02:00
Daan De Meyer
7e7ea1b1c8 meson: Always build systemd-measure
Same idea as with bootctl, we might be doing image builds from a
system that doesn't boot with UEFI but we still might want to measure
stuff for the image we're building so let's not gate this behind
ENABLE_BOOTLOADER.
2023-10-25 16:49:30 +02:00
Daan De Meyer
dedb925eaf meson: Always build bootctl
bootctl is rather useful to have, even if on a system without UEFI,
as it has a number of verbs that are unrelated to UEFI (e.g kernel-identify),
and more importantly, it supports --root to operate on directory trees
(which could be intended to be deployed on UEFI) so let's make sure we
always build it.
2023-10-25 16:49:24 +02:00
Raul Cheleguini
813dbff4d5 nspawn: allow user-specified MAC address on container side
Introduce the environment variable SYSTEMD_NSPAWN_NETWORK_MAC to allow
user-specified MAC address on container side.
2023-10-25 13:59:46 +01:00
Frantisek Sumsal
29be59555f test: split TEST-70-TPM2 into subtests 2023-10-25 14:48:30 +02:00