Commit Graph

81549 Commits

Author SHA1 Message Date
Mike Yuan
dbe592a067 cgroup-util: modernize cg_get_keyed_attribute()
- assert on supplied keys being unique
- Reject duplicate attributes with -EBADMSG
- Rename 'ret_values' to just 'values', given we don't
  allocate the array
- Remove now unused cg_get_keyed_attribute_graceful()
2025-05-19 21:24:18 +02:00
Mike Yuan
88f4bf8a8b core/cgroup: also assume cgroup.events frozen attr is available
Follow-up for 3c86a935ad
2025-05-19 21:01:39 +02:00
Zbigniew Jędrzejewski-Szmek
791847ea64 boot: fix ia32 build with clang
After 668d915a4b, the build fails:
[7/14] Linking target src/boot/systemd-bootia32.elf
FAILED: src/boot/systemd-bootia32.elf
clang  -o src/boot/systemd-bootia32.elf src/boot/systemd-bootia32.elf.p/boot.c.o src/boot/systemd-bootia32.elf.p/line-edit.c.o src/boot/systemd-bootia32.elf.p/bcd.c.o -Wl,--as-needed -Wl,--no-undefined -pie -fstack-protector src/boot/libefiia32.a -nostdlib -static-pie -Wl,--entry=efi_main -Wl,--fatal-warnings -Wl,-static,-pie,--no-dynamic-linker,-z,text -z common-page-size=4096 -z max-page-size=4096 -z noexecstack -z relro -z separate-code -Wl,-z,nopack-relative-relocs -fcf-protection=none -fno-asynchronous-unwind-tables -fno-exceptions -fno-unwind-tables -fno-sanitize=all -Wno-unused-command-line-argument -m32
/usr/sbin/ld: src/boot/libefiia32.a.p/console.c.o: in function `console_set_mode':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/console.c:267:(.text+0xb8f): undefined reference to `__moddi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/console.c.o: in function `get_auto_mode':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/console.c:228:(.text+0xf18): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/efi-string.c.o: in function `push_num':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:695:(.text+0x3c1a): undefined reference to `__moddi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:696:(.text+0x3c54): undefined reference to `__divdi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:702:(.text+0x3cda): undefined reference to `__umoddi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/efi-string.c:703:(.text+0x3d0a): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/ticks.c.o: in function `time_usec':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:110:(.text+0x9d): undefined reference to `__udivdi3'
/usr/sbin/ld: src/boot/libefiia32.a.p/ticks.c.o: in function `ticks_freq_arch':
/home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:46:(.text+0x394): undefined reference to `__udivdi3'
/usr/sbin/ld: /home/zbyszek/src/systemd-work/build-clang/../src/boot/ticks.c:49:(.text+0x3ce): undefined reference to `__udivdi3'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Restore the use of -lgcc for 32-bit builds.

(FWIW, neither --rtlib=compiler-rt nor --rtlib=libgcc help.)
2025-05-19 16:00:28 +01:00
Daan De Meyer
e53a3f4b40 sd-varlink: Expose sd_varlink_idl_parse() (#37513) 2025-05-19 16:13:44 +02:00
Daan De Meyer
d94c24e9cc sd-varlink: Expose sd_varlink_idl_parse()
We're planning to do code generation based on the systemd varlink
APIs. To simplify this, let's expose the IDL parser, so we can use
it to do code generation instead of having to write our own IDL
parser.
2025-05-19 15:19:24 +02:00
Daan De Meyer
34f714349b sd-varlink: Fix argument names of sd_varlink_idl_parse() 2025-05-19 15:08:16 +02:00
Mike Yuan
741a184a31 core/manager: do not pop gc_unit_queue before unit_gc_sweep()
Follow-up for 52e3671bf7

unit_gc_sweep() might try to add the unit to gc queue again.
While that becomes no-op as Unit.in_gc_queue is not cleared
yet, it induces minor inconsistency of states.
2025-05-18 05:33:09 +09:00
Yu Watanabe
d766c75acd units: kill only udev services and keep udev sockets on switching root
This also makes initrd-cleanup.service explicitly start
initrd-switch-root.service with replace-irreversibly mode, to avoid
systemd-udevd.service being triggered by kernel events and the start
job of initrd-switch-root.service being cancelled.

Follow-ups for 676fb42aae.
Addresses https://github.com/systemd/systemd/pull/37374#issuecomment-2875990471.
2025-05-17 12:47:52 +01:00
Mike Yuan
13cb664181 terminal-util: restore terminal settings if fd_reopen() fails
Follow-up for a0c314d6b0
2025-05-17 12:33:26 +01:00
Lennart Poettering
e7ce9e0954 sd-bus: drop a bunch of 'else'
With the new US taxes on bits and bytes let's reduce our footprint a
bit.
2025-05-17 00:18:24 +02:00
Yu Watanabe
7c087d802f Remove overzealous checks (#37493) 2025-05-17 01:37:18 +09:00
Zbigniew Jędrzejewski-Szmek
f4bdf373c5 basic/terminal-util: simplify output param handling
Those static functions were written to support optional output params, but they
are only ever called with the output param set, and it doesn't make sense to
ever call them without the output param. Since those are internal functions,
drop this unused complexity.
2025-05-16 15:33:50 +02:00
Zbigniew Jędrzejewski-Szmek
5b5545f112 basic/terminal-util: drop 'U' suffix
C automatically casts a signed int to unsigned in binary operation with an
unsigned int. Thus that suffix is not useful. Also surrounding code doesn't use
it.
2025-05-16 15:33:10 +02:00
Zbigniew Jędrzejewski-Szmek
5ecd641ac8 src/boot: assume that intmax_t is the biggest integer
Same as in 81d7934882, intmax_t by definition is
the widest int. Strictly speaking, the check whether
  sizeof(intmax_t) == sizeof(long long)
in the code below is redundant, but I think it's nicer to keep it for symmetry
with the other cases.

Requested in
https://github.com/systemd/systemd/pull/37442#pullrequestreview-2840906908.
2025-05-16 15:31:58 +02:00
Yu Watanabe
a31edb4e71 TEST-07-PID1: drop journal message flood test
This partially reverts f9b186c21a.

The test case is unstable, and fills debugging logs after journald
is restarted.
2025-05-16 22:24:54 +09:00
Lennart Poettering
fbf43297dd man: reword recommendations around Accept=
Accept=yes has very valid usecases (i.e. for sporadically invoked
services) and strong benefits (i.e. better security because connections
can be sandboxed nicely, isolating them). Let's hence reword things and
stop claiming that Accept=yes was a legacy thing, because it really
isn't.

Some other man fixes, too
2025-05-16 21:47:46 +09:00
Lennart Poettering
59276b86dc catalog: add more entries
While message IDs are about more than catalog entries (they make
messages recognizable), I think it makes sense to document at least all
those messages that indicate problems with catalog entries, in an
attempt to be helpful to users.

Fixes: #36201
2025-05-16 21:45:25 +09:00
Lennart Poettering
b177095bfa terminal-util: explicitly reset cursor
Apparently there are terminals where our usual reset is not enough to
turn the cursor back on. Hence do so explicitly.

Fixes: #22168
2025-05-16 21:42:32 +09:00
Daan De Meyer
96b9d4162f bpf-link: Add HAVE_LIBBPF check
Fixes compilation error in userns-restrict.c where we try to include
libbpf.h when it is not available.
2025-05-16 21:36:15 +09:00
AsciiWolf
b2ef1818e6 hwdb: add missing PLUTO SDR vendor name 2025-05-16 19:46:11 +09:00
Yu Watanabe
8e958263d0 man/systemctl: fix typo
Follow-up for 652e4dd743.
2025-05-16 17:49:14 +09:00
Yu Watanabe
ed3dce108d varlink: fix typo
Follow-up for 736349958e.
2025-05-16 17:47:54 +09:00
Yu Watanabe
bfc8941098 journalctl: fix typo
Follow-up for d2f45c7681.
2025-05-16 17:46:20 +09:00
Lennart Poettering
645e35633f Clean up includes (#37467)
Split out of #37344 

More small components that shouldn't be all too controversial.
2025-05-16 10:07:19 +02:00
Lennart Poettering
22b5ddb90f tree-wide: fix use of flink_tmpfile()
Let's always make sure the temporary file returned by fopen_tmpfile()
and friends is removed on failure (via _cleanup_). Conversely, make sure
that once the file is renamed into its final place, we no longer try to
remove the temporary file (since it's not going to exist anymore).
2025-05-16 08:28:42 +02:00
Eisuke Kawashima
b9df3d6447 shell-completion: improve completion of systemd-tmpfiles 2025-05-16 14:04:09 +09:00
Lennart Poettering
edecb56216 man: document how to hook stuff into system wakeup
Fixes: #6364
2025-05-15 22:01:12 +01:00
Daan De Meyer
ef10d4b526 Bugprone argument comment - round 5 (#37481) 2025-05-15 20:33:50 +02:00
Yu Watanabe
9fd936df77 man: fix path to version.h
Follow-up for 30d20907bd.
2025-05-15 15:42:33 +02:00
Jelle van der Waa
346c62f9ca treewide: correct argument comments 2025-05-15 15:39:20 +02:00
Jelle van der Waa
f15dcafdb1 discover-image: correct argument comments 2025-05-15 14:50:33 +02:00
Mike Yuan
7762e9bbb2 core: always enable CPU accounting; cgtop: drop cgv1 handling (#37448) 2025-05-15 14:41:07 +02:00
Yu Watanabe
abbdc33bca hwdb: add PLUTO SDR (#37471)
The goal of this PR is to replace the rules in
76aa80a6d8.

The original rules file have some rules for a device that is now
deprecated and so, are not part of this change. AFAIU, 'plugdev' is also
a thing of the past and we now use 'uaccess' which should be given to
all ID_SOFTWARE_RADIO devices. So yeah, hopefully what I have here is
equivalent to the orginal .rules.

The request for this was done here:
https://github.com/analogdevicesinc/plutosdr-fw/issues/101
2025-05-15 20:19:09 +09:00
Luca Boccassi
a49f3c3890 Update hwdb (#37470)
Update hwdb, even though we are pretty far from a release in order to:
- incrementally test upstream additions to hwdb
- allow backports to stable branches
2025-05-15 12:09:03 +01:00
Luca Boccassi
ed5c3f4436 core: use socket cookie for naming per-connection service instances + set $SO_COOKIE env var to it (#37469) 2025-05-15 11:11:21 +01:00
Tommy Unger
ef3a0478bb test: write file from systemd service in transient unit
This integration test demonstrates that a containerized systemd instance can
write to a bind mounted file observable to the host. Specifically, the bash
script uses systemd-run to start a systemd instance as a transient unit
container. This systemd-run command bind mounts a directory the container will
share with the host, and runs an internal service which creates and writes to a
file from the container's view of this directory. When finished writing, the
service runs the exit target, terminating the internal systemd instance, and
ending the lifetime of the container.

The script waits for the container to finish running, then verifies that the
expected file contents were written on the host side of the filesystem mount.

This test employs a workaround, creating an unmasked procfs mount on the host
which enables the privileged guest to create its own mounts internally. This
may indicate a systemd bug, as the privileged container should not rely on
the existence of an unmasked procfs on the host in order to mount its own
filesystems internally.
2025-05-15 11:33:23 +02:00
Lennart Poettering
62e5b90a49 varlink: two tweaks for method call handling (#37466) 2025-05-15 11:28:58 +02:00
Jelle van der Waa
d495a31f9b test: correct argument comments 2025-05-15 11:14:04 +02:00
Jelle van der Waa
274da0b67b terminal-util: rename openpt_allocate_* ret_peer argument
Make it consistent with its implementation.
2025-05-15 11:12:43 +02:00
Jelle van der Waa
5ae4d7c9ba tpm2-util: correct argument comments 2025-05-15 11:12:43 +02:00
Jelle van der Waa
ccf379b46e sd-varlink: fix argument comment
Follow-up for 52068c1e9c
2025-05-15 11:12:43 +02:00
Jelle van der Waa
2f75e5efa1 tpm2-util: rename tpm2_unseal arguments
To make it consistent with its implementation.
2025-05-15 11:12:28 +02:00
Zbigniew Jędrzejewski-Szmek
7bd6626a43 hwdb: run "update-hwdb-autosuspend"
As usual, mostly additions and a few removals.
2025-05-15 10:51:28 +02:00
Zbigniew Jędrzejewski-Szmek
f41c0fa11e hwdb: run "update-hwdb"
As usual, it seems to be mostly additions and corrections.

The last update was in 0d740f4bc0, Dec 10th. I
think it's reasonable to update the hwdb more often. In particular, I want to
push an update to the stable branches, but it should be updated in 'main'
first.
2025-05-15 10:50:28 +02:00
Nuno Sá
42957adf5c hwdb: append ID_MM_DEVICE_IGNORE to hwdb parser 2025-05-15 09:48:30 +01:00
Nuno Sá
ab8e0c6c7c hwdb: add Analog Devices PLUTO SDR
Add hwdb entries for ADI PLUTO. Note that when in DFU (Device Firmware
mode) mode, the pid is different. Thus, the two entries.

We also want to make sure that no AT commands are sent to us and so we
set 'ID_MM_DEVICE_IGNORE=1'.
2025-05-15 09:46:16 +01:00
Lennart Poettering
1619918da7 update TODO 2025-05-15 09:53:30 +02:00
Yu Watanabe
6a4fe38f7f network: do not drop duplicated entries in loop
Fixes #37456.
2025-05-15 09:49:46 +02:00
Lennart Poettering
9be6e18444 core: name socket unit instances after the socket cookie
On linux sockets have a really good, unique identifier, the SO_COOKIE,
which is used by sockdiag and BPF and elsewhere. Let's expose this more
prominently in the service name of per-connection services invoked via
Accept=yes sockets.

This is really nice, because together with our $SO_COOKIE env var we can
now match up services, process execution contexts, and "ss" outputs, BPF
rules, and more.
2025-05-15 09:45:33 +02:00
Lennart Poettering
bfb1f9e2c9 core: pass the socket cookie to invoked per-connection service instances as $SO_COOKIE env var
The socket cookie is just too useful for identifying connections, let's
emphasize this a bit and pass it as environment variable.
2025-05-15 09:45:32 +02:00