Commit Graph

84273 Commits

Author SHA1 Message Date
Thomas Blume
4c7e30c4e0 test: add policy packages for TEST-06-SELINUX in openSUSE 2025-10-24 12:58:32 +01:00
Dimitri John Ledkov
00a5c447a4 TODO: add that libmicrohttpd2 has openssl support (#39433)
For the openssl unification, add note that development release of
libmicrohttpd2 has openssl support.
2025-10-24 11:58:19 +01:00
Daan De Meyer
1835ce2f04 rpm: Make sure we only match files in the directories in triggers
/usr/lib/systemd/system will match /usr/lib/systemd/systemd-networkd,
which is definitely not the intention.
2025-10-24 10:29:40 +09:00
Yu Watanabe
fe5625cbba mountfsd: allow privileged users to mount bare unprotected filesystems (#39411)
Split from https://github.com/systemd/systemd/pull/39394 as that
requires deeper rework that will take more time
2025-10-24 09:40:52 +09:00
Yu Watanabe
f4072a9da2 Drop libcap dependency (#39425) 2025-10-24 09:40:05 +09:00
Yu Watanabe
9b414a38fa tree-wide: drop unused libcap dependencies 2025-10-24 01:52:59 +09:00
Yu Watanabe
a98f710fdf capability-util: use capability_get() and _apply() in capability_quintet_enforce() 2025-10-24 01:52:59 +09:00
Yu Watanabe
6e5f07756f capability-util: use capability_get() and _apply() in change_capability() 2025-10-24 01:52:59 +09:00
Yu Watanabe
69eb331b6c capability-util: use capability_apply() in drop_privileges() 2025-10-24 01:52:59 +09:00
Yu Watanabe
256d6f3f2f capability-util: rework capability_gain_cap_setpcap() and capability_bounding_set_drop()
This makes the functions use CapabilityQuintet, capability_get(), and
capability_apply().
2025-10-24 01:52:59 +09:00
Yu Watanabe
2bf880892e test: use have_inheritable_cap() in test_apply_ambient_caps()
This also make the test case use ASSERT_XYZ() macros.
2025-10-24 01:52:59 +09:00
Yu Watanabe
96f2255637 test: replace cap_to_text() with capability_get() and capability_set_to_string() 2025-10-24 01:52:59 +09:00
Yu Watanabe
aa8ab67a6d capability-util: introduce capability_apply() and use it in capability_ambient_set_apply() 2025-10-24 01:52:59 +09:00
Yu Watanabe
e1c134ba9c capability-util: introduce capability_get() and use it in have_effective_cap()
capability_get() is a wrapper of capget() syscall and converts its
result to CapabilityQuintet.

This also introduce have_inheritable_cap(), which is similar to
have_effective_cap(). It is currently unused, but will be used later.
2025-10-24 01:52:59 +09:00
Yu Watanabe
e804256b80 capability-util: several coding style updates
- rebreak comments,
- add short comment for constant arguments,
- drop unnecessary {},
- use BIT_SET() macro.
2025-10-24 01:52:59 +09:00
Yu Watanabe
2038ad725d capability-util: introduce capability_quintet_equal() helper function
Currently unused, but will be used later.
2025-10-24 01:52:59 +09:00
Yu Watanabe
50053a0212 capability-util: move several definitions 2025-10-24 01:52:59 +09:00
Yu Watanabe
7de349c1ed test: use CAP_LIMIT at one more place 2025-10-24 01:52:56 +09:00
Yu Watanabe
4c0cdc4a2c capability-util: tighten requirement for CAP_LAST_CAP off by one
Otherwise, we cannot use UINT64_MAX as 'unset'.
2025-10-24 01:52:18 +09:00
Yu Watanabe
2a6b084cc6 capability-list: make capability_list_length() return unsigned 2025-10-23 23:46:49 +09:00
Yu Watanabe
8eefd0f4de core: increment start limit counter only when we can start the unit
Otherwise, e.g. requesting to start a unit that is under stopping may
enter the failed state.

This makes
- rename .can_start() -> .test_startable(), and make it allow to return
  boolean and refuse to start units when it returns false,
- refuse earlier to start units that are in the deactivating state, so
  several redundant conditions in .start() can be dropped,
- move checks for unit states mapped to UNIT_ACTIVATING from .start() to
  .test_startable().

Fixes #39247.
2025-10-23 15:51:28 +02:00
Frantisek Sumsal
c05758663b test: properly wait for the forked process
The process forked off by `systemd-notify --fork` is not a child of the
current shell, so using `wait` doesn't work. This then later causes a
race, when the test occasionally fails because it attempts to start a
new systemd-socket-activate instance before the old one is completely
gone:

[ 1488.947744] TEST-74-AUX-UTILS.sh[1938]: Child 1947 died with code 0
[ 1488.947952] TEST-74-AUX-UTILS.sh[1933]: + assert_eq hello hello
[ 1488.949716] TEST-74-AUX-UTILS.sh[1948]: + set +ex
[ 1488.950112] TEST-74-AUX-UTILS.sh[1950]: ++ cat /proc/1938/comm
[ 1488.945555] systemd[1]: Started systemd-networkd.service - Network Management.
[ 1488.950365] TEST-74-AUX-UTILS.sh[1933]: + assert_in systemd-socket systemd-socket-
[ 1488.950563] TEST-74-AUX-UTILS.sh[1951]: + set +ex
[ 1488.950766] TEST-74-AUX-UTILS.sh[1933]: + kill 1938
[ 1488.950766] TEST-74-AUX-UTILS.sh[1933]: + wait 1938
[ 1488.950766] TEST-74-AUX-UTILS.sh[1933]: .//usr/lib/systemd/tests/testdata/units/TEST-74-AUX-UTILS.socket-activate.sh: line 14: wait: pid 1938 is not a child of this shell
[ 1488.950766] TEST-74-AUX-UTILS.sh[1933]: + :
[ 1488.951486] TEST-74-AUX-UTILS.sh[1952]: ++ systemd-notify --fork -- systemd-socket-activate -l 1234 --now socat ACCEPT-FD:3 PIPE
[ 1488.952222] TEST-74-AUX-UTILS.sh[1953]: Failed to listen on [::]🔢 Address already in use
[ 1488.952222] TEST-74-AUX-UTILS.sh[1953]: Failed to open '1234': Address already in use
[ 1488.956831] TEST-74-AUX-UTILS.sh[1933]: + PID=1953
[ 1488.957078] TEST-74-AUX-UTILS.sh[102]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/TEST-74-AUX-UTILS.socket-activate.sh failed'
[ 1488.957078] TEST-74-AUX-UTILS.sh[102]: Subtest /usr/lib/systemd/tests/testdata/units/TEST-74-AUX-UTILS.socket-activate.sh failed
2025-10-23 11:56:26 +01:00
Yu Watanabe
cc7ccd3c6a man/network: extend document about the default value of IPv6AcceptRA=
Prompted by #39304.
2025-10-23 11:13:36 +09:00
Yu Watanabe
a5962d3327 rereadpt: always update kernel partition tables from userspace in an incremental fashion (#39390)
Let's address #38672 comprehensively: let's avoid BLKRRPART as much as
we can, and always do careful userspace controlled, incremental updates
to the kernel partition tables.

This simply iterates through blkid's partition parsing, and turns it
into a BLKPG ioctls, adding, updating, removing partitions as necessary,
suppressing unnecessary changes. This has the major benefit that the
call becomes truly idempotent: if nothing changed then nothing is
removed/readed, like BLKRRPART is doing it.

This then ports over all code currently doing partition refreshing,
specifcially: udev, repart, and homed.

Fixes: #38672
2025-10-23 09:35:03 +09:00
Yu Watanabe
80297f75e1 Two minor id128-related cleanups (#39407)
Split out from #39210
2025-10-23 09:30:11 +09:00
Lennart Poettering
e582484789 tree-wide: open block device locks in writable mode
udev's block device locking protocol has one pitfall not even the
example in the documentation got right so far (even though this is
explained in all detail above): udev's rescanning is only triggered when
an fd that is opened for writing is closed. This means that if a
separate locking fd is opened on a block device – one that is maintained
independently of the fd actually used for writing – it must be opened for
writing too, so that closing the lock definitely triggers a rescan. This
matters in cases where the lock fd is kept for longer than the fd used
for writing to disk. (Because otherwise udev might get the
IN_CLOSE_WRITE event, but when it tries to rescan will find the device
locked, and never retry because no IN_CLOSE_WRITE is triggred anymore.)

Let's fix that across the codebase, at 4 places:

1. in makefs (a lock fd is kept, and mkfs then invoked as child, which
   uses a different fd, and the lock fd is closed only once the child
   died)

2. in udevadm lock (embarassing!): which is intended to be used to wrap tools
   that modify disk contents, very similar to the makefs case. The lock
   is also kept until after the tool exited.

3. In storagetm: the kernel nvme-tcp layer writes to the device
   directly, we just keep a lock fd.

4. the example in BLOCK_DEVICE_LOCKING.md
2025-10-22 22:56:02 +02:00
Lennart Poettering
46da450f13 repart: switch things over to our own partition reread logic 2025-10-22 22:56:02 +02:00
Lennart Poettering
78c017a8ed repart: split out that disarms automatic artifact removal 2025-10-22 22:56:01 +02:00
Lennart Poettering
aa47d8ade1 udev: switch over to rereadpt() rather than raw BLKRRPART
Fixes: #38672
2025-10-22 22:56:01 +02:00
Lennart Poettering
0ef4118c78 homed: switch from raw BLKRRPART to rereadpt_fd() 2025-10-22 22:56:01 +02:00
Lennart Poettering
757887d01d rereadpt: implement userspace-based BLKRRPART re-implementation 2025-10-22 22:56:01 +02:00
Lennart Poettering
524ebfe28a blockdev-util: split out partition device node generation from dissect-util.c 2025-10-22 22:56:01 +02:00
Lennart Poettering
bb45a893c2 blockdev-util: in blockdev_partscan_enabled() check if we are operating on block device first
The function makes no sense on any other type of fd, hence we better
check this explicitly.
2025-10-22 22:56:01 +02:00
Lennart Poettering
a251345cf5 blockdev-util: rename BlockDeviceLookupFlag to plural
This is a flags type and a flag function argument, let's name it in
plural, because it allows many flags combinations. Internally, the
implementation already used plural, but let's fix the prototypes too.
2025-10-22 22:56:01 +02:00
Lennart Poettering
b09ea23978 sd-device: add device_get_property_uint() helper
This is just like device_get_property_int() but operates on unsigned
ints.
2025-10-22 22:56:01 +02:00
Luca Boccassi
d62ab43fd0 mkosi: update debian commit reference to 5650452e6b0b430f44d3d48b7322c2b3c8b9477f
* 5650452e6b Install new files for upstream build
* 607afcd060 salsa: disable arm64/ppc64el again
* b1bb6d4849 systemd-tests: drop unused overrides
* b3790a36ca getty-static: add missing Documentation=
* 1cea27caba Backport patch to fix autopkgtest with new util-linux due to file move
* 2e74a7f969 Update changelog for 258.1-1 release
* 9250e242b9 Make /run/lock world writable by default
2025-10-22 20:06:44 +02:00
Daan De Meyer
ed5b77fe2e vmspawn: Add --bind-user= and --bind-user-shell= (#38410)
We use virtiofsd ID translation to mimick idmapped mounts and the
transient userdb credentials to provision the mapped user in the VM.
2025-10-22 20:03:47 +02:00
Luca Boccassi
e84aa21af8 man: RootImageOptions= is only supported for system services right now
Support via mountfsd is being worked on but will take more time,
fix the documentation to be correct in the meanwhile

Follow-up for fad01f798d
2025-10-22 17:22:03 +01:00
Luca Boccassi
53d49fbf3f mountfsd: allow privileged users to mount bare unprotected filesystems
This is useful when we start to call mountfsd from root, for example
from the tests where we just use a simple squashfs/erofs.
Note that this requires the caller to be root, and it will be rejected
otherwise, as such images are classified as 'unprotected' and the
enforced policy does not accept them for unprivileged users.
2025-10-22 16:47:46 +01:00
DaanDeMeyer
b1681f981b vmspawn: Add --bind-user= and --bind-user-shell=
We use virtiofsd ID translation to mimick idmapped mounts and the
transient userdb credentials to provision the mapped user in the VM.
2025-10-22 16:42:50 +02:00
Daan De Meyer
ac0a248ee6 vmspawn: Use machine_credential_add() 2025-10-22 16:42:50 +02:00
DaanDeMeyer
af0ae29714 machine-bind-user: Make home mount directory configurable 2025-10-22 16:42:50 +02:00
DaanDeMeyer
9aa6c30bbd machine-bind-user: Use machine in log messages instead of container 2025-10-22 16:42:50 +02:00
Daan De Meyer
64d5bb4d53 nspawn: Add --bind-user-shell= to --help 2025-10-22 16:42:46 +02:00
theSillywhat
3331d99b49 Missing policies for polkit as mentioned in freedesktop.org/software/systemd/man 2025-10-22 16:20:44 +02:00
Zbigniew Jędrzejewski-Szmek
e39cde9585 Disable abort in log_assert in libsystemd/libudev (#39307)
See the second commit for details.

I think we might want to apply the same treatment to nss and pam
modules. Asserting in such "plugin code" seems iffy. But this PR doesn't
change those in any way.
2025-10-22 14:48:14 +02:00
Mike Yuan
7d4e8f920b shared/bus-get-properties: use sizeof instead of hardcoded size in bus_property_get_id128()
Prompted by
https://github.com/systemd/systemd/pull/39210#discussion_r2404225907
2025-10-22 14:44:50 +02:00
Mike Yuan
fbc9f0dd4e libsystemd-network/sd-lldp-tx: use SD_JSON_BUILD_PAIR_ID128 2025-10-22 14:44:50 +02:00
Lennart Poettering
b38dc56bab coredump: split coredump.c into small pieces (#39351) 2025-10-22 13:37:51 +02:00
Lennart Poettering
aea2f059a3 tree-wide: use setenvf() more, where appropriate 2025-10-22 13:36:18 +02:00