Commit Graph

81755 Commits

Author SHA1 Message Date
Lennart Poettering
b4c2e2b970 varlinkctl: optionally push fds to server 2025-05-27 10:41:52 +02:00
Lennart Poettering
0261fe571b mountfsd: add call for creating a foreign UID owned dir in dir owned by caller
In order to fully support unpriv containers placed in directories owned
by the foreign UID range, below some unpriv user $HOME, we need to away
to actually create these hierarchies in the first place.

Let's add a method call for that. It takes a dir fd, then validates that
its ownership matches the client's identity, and then creates a subdir,
chown()ing it to the foreign UID range. It then returns an fd to the
result.

The result could then be passed to MountDirectory() in order to get a
mount which can then be populated by some code running in a dynamic
userns.
2025-05-27 10:41:52 +02:00
Lennart Poettering
cb062410ec sd-json: add json_dispatch_const_filename()
json_dispatch_const_filename() is to json_dispatch_filename() what json_dispatch_const_path() is to json_dispatch_path().
2025-05-27 10:37:11 +02:00
Mike Yuan
7f436569c1 fs-util: prefer linkat(AT_EMPTY_PATH) over /proc/self/fd/ shenanigans
The permission check got relaxed in kernel v6.10, so let's
switch the fallback order around.

This also effectively reverts 94d94f0c0a,
as I just realized that link_fd() involves multiple paths and
we can't tell which one tripped ENOENT...
2025-05-27 12:19:22 +09:00
Yu Watanabe
f67b2a06bf cgroup-util: drop handcrafted cg_is_empty(), always check cgroup.events populated field (#37624) 2025-05-27 10:41:56 +09:00
Lennart Poettering
5b759bf5fd homed: generate proper error if we cannot create mountpoint for homedir
Let's make this easier to debug. (When this failed for me due to disk
full it took me a bit to figure out what was going on.)
2025-05-27 10:10:03 +09:00
Yu Watanabe
5c606fb33e udevadm-info: update error messages (#37619) 2025-05-27 10:08:24 +09:00
Mike Yuan
b823f7bb6a cgroup-util: remove now unused cg_read_event()
cg_get_keyed_attribute() is a more generic version of this,
and cg_is_empty_recursive() was the only user of this function,
which got converted in the previous commit.
2025-05-26 22:59:48 +02:00
Mike Yuan
c3f900770d cgroup-util: drop handcrafted cg_is_empty(), always check cgroup.events populated field
This effectively renames cg_is_empty_recursive() to cg_is_empty().
Note that all existing code calls the former and not the latter,
hence with cgv1 support being dropped it's trivial to consult
cgroup.events directly for populated state everywhere.

Additionally, use more generic cg_get_keyed_attribute() helper
rather than cg_read_event().
2025-05-26 22:59:48 +02:00
Dusty Mabe
bdd852a199 src/core/manager.c: log preset activity on first boot
This gives us a little more information about what units were enabled
or disabled on that first boot and will be useful for OS developers
tracking down the source of unit state.

An example with this enabled looks like:

```
NET: Registered PF_VSOCK protocol family
systemd[1]: Applying preset policy.
systemd[1]: Unit /etc/systemd/system/dnsmasq.service is masked, ignoring.
systemd[1]: Unit /etc/systemd/system/systemd-repart.service is masked, ignoring.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket'.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir.mount' → '/etc/systemd/system/var-mnt-workdir.mount'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir\x2dtmp.mount' → '/etc/systemd/system/var-mnt-workdir\x2dtmp.mount'.
systemd[1]: Created symlink '/etc/systemd/system/afterburn-sshkeys.target.requires/afterburn-sshkeys@core.service' → '/usr/lib/systemd/system/afterburn-sshkeys@.service'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket' → '/usr/lib/systemd/system/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket' → '/usr/lib/systemd/system/systemd-resolved-monitor.socket'.
systemd[1]: Populated /etc with preset unit settings.
```

Considering it only happens on first boot and not on every boot I think
the extra information is worth the extra verbosity in the logs just for
that boot.
2025-05-27 05:53:36 +09:00
Lennart Poettering
61d3133706 polkit: reword 'Interactive authentication required' error
I guess the current wording of "Interactive authentication required." is
hard to grok for many users. Let's try to reword this, and say
explicitly:

1. That this is a form of "access denied" error
2. That interactive auth could remedy this
3. But that the client disabled interactive auth

I think these are the three primary elements the error msg needs to
convey. I tried to distill this in a short error string with this.

Fixes: #2081
2025-05-27 05:52:38 +09:00
Mike Yuan
879952a853 core/cgroup: CGRuntime.cgroup_path indicates whether the cg is still alive
so drop redundant checks in attr getters. Memory and IO accounting
functions already follow this pattern.
2025-05-26 22:51:58 +02:00
Lennart Poettering
bee59ab901 varlinkctl: if returned error is an errno, print it as one in log message 2025-05-27 05:51:47 +09:00
tuxmainy
554d5882b7 hwdb: make Saitek PLC Pro Flight Rudder Pedals a joystick (#37601)
Fuzzy logic on joystick vs. advanced keyboard detection thinks the
rudders are a keyboard. Adding this forces udev to use this device as
joystick.

```
# udevadm info /dev/input/by-id/usb-Saitek_Saitek_Pro_Flight_Rudder_Pedals-event-joystick
P: /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:06A3:0763.000D/input/input22/event3
M: event3
R: 3
U: input
D: c 13:67
N: input/event3
L: 0
S: input/by-id/usb-Saitek_Saitek_Pro_Flight_Rudder_Pedals-event-joystick
S: input/by-path/pci-0000:00:14.0-usbv2-0:3:1.0-event-joystick
S: input/by-path/pci-0000:00:14.0-usb-0:3:1.0-event-joystick
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:06A3:0763.000D/input/input22/event3
E: DEVNAME=/dev/input/event3
E: MAJOR=13
E: MINOR=67
E: SUBSYSTEM=input
E: USEC_INITIALIZED=10981053700
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_BUS=usb
E: ID_MODEL=Saitek_Pro_Flight_Rudder_Pedals
E: ID_MODEL_ENC=Saitek\x20Pro\x20Flight\x20Rudder\x20Pedals
E: ID_MODEL_ID=0763
E: ID_SERIAL=Saitek_Saitek_Pro_Flight_Rudder_Pedals
E: ID_VENDOR=Saitek
E: ID_VENDOR_ENC=Saitek
E: ID_VENDOR_ID=06a3
E: ID_REVISION=0101
E: ID_TYPE=hid
E: ID_USB_MODEL=Saitek_Pro_Flight_Rudder_Pedals
E: ID_USB_MODEL_ENC=Saitek\x20Pro\x20Flight\x20Rudder\x20Pedals
E: ID_USB_MODEL_ID=0763
E: ID_USB_SERIAL=Saitek_Saitek_Pro_Flight_Rudder_Pedals
E: ID_USB_VENDOR=Saitek
E: ID_USB_VENDOR_ENC=Saitek
E: ID_USB_VENDOR_ID=06a3
E: ID_USB_REVISION=0101
E: ID_USB_TYPE=hid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usbhid
E: ID_PATH_WITH_USB_REVISION=pci-0000:00:14.0-usbv2-0:3:1.0
E: ID_PATH=pci-0000:00:14.0-usb-0:3:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_3_1_0
E: ID_FOR_SEAT=input-pci-0000_00_14_0-usb-0_3_1_0
E: LIBINPUT_DEVICE_GROUP=3/6a3/763:usb-0000:00:14.0-3
E: DEVLINKS=/dev/input/by-id/usb-Saitek_Saitek_Pro_Flight_Rudder_Pedals-event-joystick /dev/input/by-path/pci-0000:00:14.0-usbv2-0:3:1.0-event-joystick /dev/input/by-path/pci-0000:00:14.>
E: TAGS=:seat:uaccess:
E: CURRENT_TAGS=:seat:uaccess:
```

```
# lsusb |fgrep Sait
Bus 001 Device 013: ID 06a3:0763 Saitek PLC Pro Flight Rudder Pedals
```

Closes #34642.
2025-05-27 05:50:04 +09:00
Daan De Meyer
f1ee656d4d tree-wide: Handle EINVAL as not supported for chattr_xxx()
F2FS returns EINVAL from FS_IOC_SETFLAGS when trying to set
FS_NOCOW_FL. Let's handle this by treating EINVAL as not supported.
While we're at it, make sure we use ERRNO_IS_IOCTL_NOT_SUPPORTED()
across the tree instead of ERRNO_IS_NOT_SUPPORTED() when calling any
of the chattr_xxx() functions.

Fixes #37593
2025-05-26 21:59:08 +02:00
Daan De Meyer
8cf13c8752 socket-util: Move getsockopt_int() to implementation file
And switch back to negative_errno() at the same time.
2025-05-26 21:28:10 +02:00
Lennart Poettering
040637ebaa machinectl: fix indentation of status output field
One field is differently aligned then the others in the "status" output.
Fix that.
2025-05-26 18:08:28 +02:00
Frantisek Sumsal
a852f5c27d udevadm-info: make the error messages slightly more consistent
At least across the udevadm-info.c file. No functional changes.
2025-05-26 16:57:22 +02:00
Frantisek Sumsal
1420ffffc5 udevadm-info: print the original input on error
Print the original input value on error instead of the consumed string
(which will be empty).

Previously:
$ udevadm info /dev/block/251:0 -e --attr-match='foo=\'
Failed to parse key/value pair : Invalid argument
$ udevadm info /dev/block/251:0 -e --attr-match='foo'
Missing '=' in key/value pair (null).

Now:
$ build/udevadm info /dev/block/251:0 -e --attr-match='foo=\'
Failed to parse key/value pair foo=\: Invalid argument

(The second scenario can't be hit anymore since
d89b3004da due to an extra check before
calling parse_key_value_argument().)
2025-05-26 16:56:55 +02:00
Lennart Poettering
a6b5e57274 update TODO 2025-05-26 13:46:51 +02:00
Lennart Poettering
0cca16a836 units: enable watchdog notifications for vmspawn
nspawn supports it and enables it. Let's do this for vmspawn too. It
already supports it in code. Let's make it also work in the unit file.
2025-05-26 13:23:45 +02:00
Daan De Meyer
0ee78fc96e tree-wide: Clean up more includes 2025-05-26 11:16:40 +02:00
Daan De Meyer
d4858b3f4e basic + fundamental: Clean up includes (#37595) 2025-05-26 09:15:30 +02:00
Daan De Meyer
0c15577abe basic + fundamental: Clean up includes
Split out of #37344.
2025-05-25 10:06:07 +02:00
Daan De Meyer
e6e6131a2c login-util: Mark session_id_valid() as pure 2025-05-25 10:05:47 +02:00
Daan De Meyer
1aabcd7454 basic: Move userns_supported() to namespace-util.h 2025-05-25 10:00:54 +02:00
Daan De Meyer
01655aec3b strv: Drop unnecessary macros 2025-05-25 09:58:09 +02:00
Daan De Meyer
b4736d9a25 basic: Move LogRatelimit struct to log-ratelimit.h as well 2025-05-25 09:40:26 +02:00
Shubhendra Kushwaha
ac8ed83947 docs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)
For #20929.
2025-05-25 05:01:27 +09:00
Daan De Meyer
881982b1b5 Various cleanups (#37597) 2025-05-24 21:48:04 +02:00
Yu Watanabe
7b41cf7731 Two follow ups for #37591 (#37594) 2025-05-25 04:22:42 +09:00
Daan De Meyer
b065d3529a clangd: Enable UnusedIncludes feature again
Now that the entire free doesn't trigger any clang unused include
violations anymore, let's re-enable the clangd option as it's much
more useful now that the tree is clean.
2025-05-24 20:57:05 +02:00
Daan De Meyer
8ad0d6d479 clang-tidy: Skip public headers
We're very limited in our ability to change these due to backwards
compat, so let's skip them from analysis since we won't be able to
fix the errors anyway.
2025-05-24 20:57:05 +02:00
Daan De Meyer
91a82e790e ci: Setup clang-tidy meson env with extra options
We want the relevant code to be compiled so that it can be analyzed
by clang-tidy.
2025-05-24 20:57:05 +02:00
Daan De Meyer
b4f3a3ad06 core: Add missing bpf-dlopen.h includes to bpf skeleton headers 2025-05-24 20:57:05 +02:00
Daan De Meyer
a119c648f8 fundamental: Move declaration of free() to macro-fundamental.h
Let's put it together with the macro that needs it (mfree()). Also,
get rid of the unnecessary <stdlib.h> include in iovec-util-fundamental.h.
2025-05-24 20:57:05 +02:00
Daan De Meyer
34269a6398 generate-sym-test: Only include required headers
If we don't use any symbols from a header, let's not include it.
2025-05-24 20:56:27 +02:00
Daan De Meyer
a6f4a9c07b netlink-internal: Make message_get_serial() static inline again
There was no need to move this function to the implementation file,
so let's make it static inline again.

Follow up for #37591.
2025-05-24 20:44:32 +02:00
Daan De Meyer
4cfd024e73 forward: Move ChaseFlags forward declaration to forward.h 2025-05-24 20:44:12 +02:00
Daan De Meyer
5cdf13c70c libsystemd: Clean up includes
For libsystemd's headers, the changes made depend on whether the
header is installed or not. For installed headers, the only change
made is that commonly included headers were moved to _sd-common.h.
For these headers, there should be no noticeable change in behavior
when including them. For non-installed headers, includes were replaced
with forward declarations where possible as usual.

Split out of #37344.
2025-05-25 03:40:24 +09:00
Daan De Meyer
b416ac0e15 basic: Move ratelimit logging functions to log-ratelimit.h 2025-05-25 03:28:50 +09:00
Daan De Meyer
dbef7bcf29 shared: Followups for #37575 2025-05-25 03:28:50 +09:00
Daan De Meyer
f989d2853f libudev: Clean up includes
Split out of #37344.
2025-05-25 02:15:36 +09:00
Yu Watanabe
9b6bb9a43c Bugprone argument comment 7 (#37556)
Follow up from https://github.com/systemd/systemd/pull/37507
2025-05-25 01:53:13 +09:00
Jelle van der Waa
637f623920 treewide: correct argument name to user_icon / askpw_icon 2025-05-24 17:13:39 +02:00
Jelle van der Waa
79d70bb282 killall: correct argument comment 2025-05-24 17:13:39 +02:00
Jelle van der Waa
8b67ed854f validatefs: correct argument comments
These functions come from util-linux and can't be renamed.
2025-05-24 17:13:39 +02:00
Jelle van der Waa
5c101b06ea sd-bus: rename 'add_callback' -> 'install_callback'
Throughout the whole codebase it is called install_callback.
2025-05-24 17:13:39 +02:00
Jelle van der Waa
03722d7120 tpm2-util: rename 'policy' -> 'pcrlock_policy'
Follow the used argument comment naming.
2025-05-24 17:13:39 +02:00
Jelle van der Waa
d7bf63bcad creds-util: correct argument comment 2025-05-24 17:13:39 +02:00