Commit Graph
81290 Commits
Author SHA1 Message Date
Yu Watanabe 8ac5b047fc man/systemd.exec: update documents for PrivateTmp= 2025-05-11 03:33:02 +09:00
Yu Watanabe 3e320dc608 test-execute: add test case for PrivateTmp=disconnected 2025-05-11 03:33:02 +09:00
Yu WatanabeandMike Yuan 6156bec7a4 core: disable mounting disconnected private tmpfs on /var/tmp/ when DefaultDependencies=no
If DefaultDependencies=no, /var/ may not be mounted yet when the service
is being started. Previously, In such case, if the service has
PrivateTmp=disconnected, the service manager created /var/tmp/ on the
root filesystem and mounted the disconnected private tmpfs there. That
poluted the root filesystem and disturbed gpt-auto-generator on next
boot, as /var/ would not be empty anymore. See issue #37258.

This changes PrivateTmp=disconnected as the following:
- If DefaultDependencies=no and RootDirectory=/RootImage= are not set,
  then a private tmpfs is mounted _only_ on /tmp/, and set $TMPDIR=/tmp
  environment variable to suggest the service to use /tmp/.
- If DefaultDependencies=yes and RootDirectory=/RootImage= are not set,
  then implies RequiresMountsFor=/var/, though that is typically
  redundant, but anyway. Hence, we can safely mount /var/tmp/.
- Otherwise, i.e. when one of RootDirectory=/RootImage= is set, behaves
  as the same as the previous, as the private root filesystem for the
  service is explicitly prepared by the service manager, and we can
  safely mount a private tmpfs on /var/tmp/ without any extra
  dependencies.

Fixes #37258.

Co-authored-by: Mike Yuan <me@yhndnzj.com>
2025-05-11 03:33:02 +09:00
Yu Watanabe 26186503d7 core/mount: drop unnecessary dependency generations
When the unit is new, then mount_setup_new_unit() adds the unit to the
load queue, and the same dependencies will be anyway added.

When the unit already exists but previously failed to be loaded, then
mount_setup_existing_unit() also adds the unit to the load queue.
Hence it is not necessary to regenerate dependencies here now.

So, we need to regenerate dependencies only when things changed and
the unit has been already loaded.

No functional changes, just optimization.
2025-05-11 03:33:02 +09:00
Yu Watanabe fee2f5ca3f core/mount,swap: reload unit when manually mounted/started and we previously failed to load
Otherwise, neither unit_patch_contexts() nor unit_add_exec_dependencies()
is called for the unit.
2025-05-11 03:32:48 +09:00
Yu Watanabe 13208591db core/namespace: split out append_private_tmp() 2025-05-11 03:29:20 +09:00
Yu Watanabe 97bf617af1 core/namespace: introduce should_propagate_to_submounts() helper function 2025-05-11 03:29:20 +09:00
Yu Watanabe a4b1232dbf core/unit: suffix directory paths with slash 2025-05-11 03:29:20 +09:00
Mike Yuan 813c96c059 core/unit: clean up duplicate conditions 2025-05-11 03:29:20 +09:00
Luca Boccassi f0b7ca9768 test: fix root check for test-bpf-foreign-programs
This test requires root, but the check was mistakenly dropped, causing it
to fail with an assert when running without root:

src/test/test-bpf-foreign-programs.c:308: Assertion failed: expected "test_bpf_cgroup_programs(m, "single_prog.service", single_prog, ELEMENTSOF(single_prog))" to succeed, but got error: Operation not permitted

Restore the uid check

Follow-up for 22e2f06428
2025-05-10 14:04:45 +02:00
Yu Watanabe d7b217f2a9 mount-tool: honor arg_canonicalize for ACTION_UMOUNT path_is_absolute() check too (#37398)
Split out from #36337
2025-05-10 03:22:20 +09:00
Yu Watanabe ef12eadfc8 core/bpf: drop old kernels support (#37151) 2025-05-10 03:13:42 +09:00
Yu Watanabe b112a676d5 udev: several cleanups for managing events (#37384)
Mostly no functional changes, just refactoring.
2025-05-10 02:30:25 +09:00
Mike Yuan b3cfee2f5d mount-tool: honor arg_canonicalize for ACTION_UMOUNT path_is_absolute() check too
Follow-up for 4e24796b5a
2025-05-09 18:39:51 +02:00
Mike Yuan 3cea9c403c core/mount: remove unused temporary variable 2025-05-09 18:39:37 +02:00
Luca Boccassi b6c3fc750a boot: skip shim-specific logic when running with new shim
Since shim 16 the plain BS->LoadImage() will just work (TM), we do not need
anymore to set up manual overrides and manually call in the shim-specific
lock protocol or to set shim-specific EFIVAR to make addons work or to load
shim-signed kernels.

Check if the new protocol added in v16 is present, and if so, skip
all that. Once versions < 16 are no longer supported/revoked, all
the code can be dropped entirely.
2025-05-09 17:07:14 +01:00
Yu Watanabe dcd2ad2314 udev: move error handling in event_requeue() to caller
Also, remove udev database on failure.
2025-05-10 00:26:32 +09:00
Yu Watanabe f694a527ac udev: split out device_broadcast_on_error() 2025-05-10 00:26:32 +09:00
Yu Watanabe e969ec1d51 sd-device: rename arguments
To make it consistent with its declaration and other function
prototypes.
2025-05-10 00:26:32 +09:00
Yu Watanabe dc231d66ac udev: move timeout event sources from struct Event to struct Worker
The timeout event sources are enabled only when the event is being
processed by a worker, hence they are not necessary to be owned by the
event.

No effective functional change, just refactoring.
2025-05-10 00:26:32 +09:00
Yu Watanabe e1ae931064 udev: list up all dependencies of an event when the first time it is examined
No functional change, just refactoring.
2025-05-10 00:26:32 +09:00
Yu Watanabe 0cde671c29 udev: check earlier if there is a free room for processing an event 2025-05-10 00:26:32 +09:00
Yu Watanabe 4478546649 udev: cache last queued event entry
When we have N queued events, LIST_APPEND() takes O(N).
Let's cache the last event to optimize queueing.
2025-05-10 00:26:32 +09:00
Yu Watanabe e962ebbe72 udev: introduce event_freep() and use it as cleanup attribute
No functional change, just refactoring and preparation for later change.
2025-05-10 00:26:32 +09:00
Daan De Meyer 180ea8b3ab More header cleanups (#37381) 2025-05-09 17:22:33 +02:00
Yu Watanabe 7ded1bcf04 test: allow to allocate test scope even running with unprivileged user 2025-05-10 00:17:52 +09:00
Yu Watanabe ad446c8ceb core/bpf-devices: use bpf_program_supported()
Note, BPF_PROG_TYPE_CGROUP_DEVICE is supported since kernel v4.15.
As our baseline on the kernel is v5.4, we can assume the bpf type is
always supported.
2025-05-10 00:17:52 +09:00
Yu Watanabe ec3c5cfac7 core/bpf-firewall: replace bpf_firewall_supported() with bpf_program_supported()
Note, BPF_PROG_TYPE_CGROUP_SKB is supported since kernel v4.10, and
BPF_F_ALLOW_MULTI and program name is supported since kernel v4.15.
As our baseline on the kernel is v5.4, we can assume that the type,
flag, and naming is supported when bpf_program_supported() succeeds.
2025-05-10 00:17:52 +09:00
Yu Watanabe 22e2f06428 core/cgroup: foreign bpf programs needs to pass bpf_program_supported()
As CONFIG_CGROUP_BPF may be disabled on the kernel or we are running on
sanitizers. See comments in bpf_program_supported().

Follow-up for 3fcb98cbff.
2025-05-10 00:17:52 +09:00
Yu Watanabe 71be1f3875 bpf-program: introduce bpf_program_supported() helper function
It checks if the kernel is built with CONFIG_CGROUP_BPF.
It is currently unused, but will be used later.
2025-05-10 00:17:52 +09:00
Yu Watanabe df80d728be bpf-compat: drop unused compat_libbpf_probe_bpf_prog_type() 2025-05-10 00:17:52 +09:00
Yu Watanabe fb9991962d core/bpf: drop unnecessary check for probing program type
BPF_PROG_TYPE_CGROUP_SKB is supported since kernel v4.10
(0e33661de493db325435d565a4a722120ae4cbf3) and
BPF_PROG_TYPE_CGROUP_SOCK_ADDR is supported since kernel v4.17
(4fbac77d2d092b475dda9eea66da674369665427).

Our baseline on the kernel is v5.4. The check is not necessary.
2025-05-10 00:17:52 +09:00
Yu Watanabe 4d2b9abbe1 core: replace cgroup_bpf_supported() with dlopen_bpf_full()
After 3988e2489a, the function is a simple
wrapper of bpf_dlopen() with logging. Let's introduce dlopen_bpf_full()
that takes log level, and replace cgroup_bpf_supported() with it.
2025-05-10 00:17:52 +09:00
Yu Watanabe e06e34a3b6 udev: replace get_user/group_creds() with userdb/groupdb_by_name() (#37304)
This also makes networkd not refuse User=/Group=root.
2025-05-09 20:54:16 +09:00
Kurt Borja 15450ba214 hwdb: keyboard: Add Alienware special keys
Add Alienware *Performance mode* toggle key and *Macro* keys.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
2025-05-09 20:42:00 +09:00
Marcos Alano fb8149234a Add emulated release to G-Mode key 2025-05-09 20:41:45 +09:00
Daan De Meyer 5f142e01d0 strv: Move STRV_FOREACH() to strv-fundamental.h 2025-05-09 11:33:33 +02:00
Daan De Meyer 56c710ce37 alloc-util: Remove unneeded stdlib.h include 2025-05-09 11:33:33 +02:00
Daan De Meyer 2782dae50f compress: Drop lz4 includes from compress.h
The lz4 functions are only used in test-compress.c, so let's just
put the declarations and includes in there instead of having everyone
including compress.h pull in the lz4 headers.
2025-05-09 11:33:33 +02:00
Daan De Meyer 7227d5bfff terminal-util: Move various functions to ansi-color.c 2025-05-09 11:33:33 +02:00
Daan De Meyer c992250c24 basic: Move parts of audit-util.{c,h} to libaudit-util.{c,h} in shared/ 2025-05-09 11:33:33 +02:00
Daan De Meyer 3b7d332047 macro: Reduce transitive includes 2025-05-09 11:33:31 +02:00
Daan De Meyer 3b58245624 basic: Override glibc's sys/param.h header with an empty file
Instead of unconditionally including sys/param.h in
macro-fundamental.h which itself includes a bunch of other unnecessary
headers, let's override it with an empty file to avoid it from overriding
our MAX() macro. We can't make including it an error as it's included (
for seemingly no good reason) by <resolv.h>.
2025-05-09 11:23:14 +02:00
Yu Watanabe 37c8a03ebf udevadm-info: parse all arguments before doing anything (#37292) 2025-05-09 14:09:45 +09:00
David Tardon 6cdc63d120 udevadm-info: use string table to parse query type 2025-05-09 12:14:21 +09:00
David Tardon 4ef3019ceb udevadm-info: drop args of stat_device()
They are all static vars now, so can be used directly.
2025-05-09 12:14:21 +09:00
David Tardon 8ea3c1fb9e udevadm-info: shorten the code a bit 2025-05-09 12:14:21 +09:00
David Tardon 31767b92a0 udevadm-info: reject devices passed via opts too
Follow-up-for a6b4b2fa01
2025-05-09 12:14:21 +09:00
David Tardon d89b3004da udevadm-info: split arg. parsing into a separate function 2025-05-09 12:14:16 +09:00
David Tardon 86ff972ac3 udevadm-info: drop superfluous pager_open() call
It's already called in advance in info_main().
2025-05-09 12:10:51 +09:00