Commit Graph
9046 Commits
Author SHA1 Message Date
Yu Watanabe 1f4e9f6d60 core/exec-invoke: check size of read size
Even though we do not use the read data, it is better to check the size
to prevent something spurious going.

Fixes CID#1612155.
2025-07-26 03:44:49 +09:00
Zbigniew Jędrzejewski-Szmek 92716a079f Logging fixlets (#38313) 2025-07-25 12:27:24 +02:00
Mike Yuan 39a8029f4e core/dbus-manager: validate unit type before calling into service-specific methods
Fixes #38320
2025-07-24 16:08:45 +02:00
Mike Yuan 5c94f12fa6 core/dbus-manager: don't ever try to dump fdstore for units not properly loaded 2025-07-24 16:07:28 +02:00
Zbigniew Jędrzejewski-Szmek b0ca060e05 core/socket: shorten/reword message about restarted sockets
log_unit_warning() already prints the full unit name, so we don't need to say
that it is a socket unit. And in technical messages articles like "the" are
generally skipped to make the messages shorter. Use simpler tense and simpler
wording.

Example from log: fedora.local systemd[1]: systemd-initctl.socket: Socket unit
        configuration has changed while unit has been running, no open socket file
        descriptor left. The socket unit is not functional until restarted.
This is just too wordy and says "socket" four times.
2025-07-24 10:29:23 +02:00
Yu Watanabe de69562623 tree-wide: add missing '=' in short comments for function argument 2025-07-22 03:05:54 +09:00
Yu Watanabe 7f6086d530 tree-wide: do not use %m with SYNTHETIC_ERRNO() 2025-07-22 03:05:54 +09:00
Yu Watanabe 5c34d85c74 tree-wide: normalize usage of %m 2025-07-22 03:05:54 +09:00
Yu Watanabe 5918ba9c69 tree-wide: fix log messages: "Failed VERB" -> "Failed to VERB" 2025-07-22 03:05:33 +09:00
Mike Yuan 879ed340a1 core/service: drop job done messages identical to generic ones
Prompted by #38263
2025-07-20 00:56:21 +09:00
Yu Watanabe 0e8e655c52 core/namespace: gracefully handle errors in mounting new bpffs instance
Then, fallback to remount /sys/fs/bpf read-only when ProtectKernelTunables=yes.
2025-07-18 20:25:35 +09:00
Yu Watanabe 9eabf82750 core: it is not necessary to send message after fsconfig() for bpffs
Instead, let's wait for the helper process being finished.
2025-07-18 20:15:25 +09:00
Yu Watanabe 8509ceea10 core/exec-invoke: negative errno needs to be passed to report_errno_and_exit()
Hence, we cannot pass errno as is to report_errno_and_exit().

This splits out bpffs_helper(), which returns negative errno on failure,
and 0 on success. And make the returned value passed to report_errno_and_exit().

Follow-up for #36134.
2025-07-18 20:15:20 +09:00
Luca Boccassi 7ebbe57ece Kill several SysV compat functionalities (v258) (#38178) 2025-07-15 01:21:13 +01:00
Daan De Meyer 43d0d111d2 core/cgroup: always submit unit to realize queue if all controllers are being invalidated (#38194) 2025-07-14 15:07:16 +02:00
Daan De Meyer 6488fa5634 Replace underscores in filenames with hyphens (#38203) 2025-07-14 10:37:23 +02:00
DaanDeMeyer f4df5902d8 bpf: Use hyphens in directory names instead of underscores 2025-07-13 12:45:37 +02:00
Yu Watanabe 8ba48d4bf8 core,initctl,systemctl: kill /dev/initctl support
This also kills support for controlling system state through
/sbin/init, initctl, and telinit.
2025-07-13 05:38:14 +09:00
Mike Yuan 391ad5d8aa io.systemd.Unit.List fix context/runtime split (#38172)
This PR rearranges fields in io.systemd.Unit.List according to
@poettering guidance:

> if a property can be set in a unit file, ever, then it belongs in
context. Otherwise, it belongs to runtime.

https://github.com/systemd/systemd/issues/38124
2025-07-12 18:01:41 +02:00
Mike Yuan e0d3213e09 core/cgroup: always submit unit to realize queue if all controllers are being invalidated
Alternative to #38190
Fixes #38112
2025-07-12 17:41:52 +02:00
Mike Yuan 77af13ffdb core/cgroup: remove deserialization for "cpuacct-usage-base"
This has been superseded by "cpu-usage-base" ever since
the introduction of cgroup v2. With upgrading and thus
deserialzing from cgroup v1 systems becoming impossible
it is eligible for removal.
2025-07-12 17:41:04 +02:00
Mike Yuan db54d1a6b7 core/exec-invoke: pass "/" instead of "" for cgroup root 2025-07-12 17:32:32 +02:00
DaanDeMeyer b98d6bff23 core: Fix scope SIGTERM logging
KILL_TERMINATE_AND_LOG doesn't do anything at the moment, let's fix
that.
2025-07-12 19:50:47 +09:00
Mike Yuan 66867d5308 core/scope: serialize_item() is NOP on NULL 2025-07-11 22:20:25 +02:00
Mike Yuan 4db4641a65 core/scope: drop effectively unused unit_watch_pidref() calls
Follow-up for 495e75ed5c

The mentioned commit switched scope unit's "pids" deserialization
to call unit_watch_pid() already, meaning all later invocations
in scope_coldplug() are no-op. Remove the cruft altogether.
2025-07-11 21:58:51 +02:00
Ivan Kruglov d8135125f8 core: leave comments in varlink-unit.c and varlink-cgroup.c about runtime/context split 2025-07-11 06:56:17 -07:00
Ivan Kruglov 08cd319664 core: move Slice from runtime to context in io.systemd.Unit.List 2025-07-11 06:56:17 -07:00
Ivan Kruglov aa352ece0d core: move DebugInvocation from runtime to context in io.systemd.Unit.List 2025-07-11 06:48:41 -07:00
Yu Watanabe 2bdabb167b basic: rename cap-list.c -> capability-list.c
This also renames relevant files in the same way.

Addresses https://github.com/systemd/systemd/pull/37904#discussion_r2191950396
2025-07-11 18:33:43 +09:00
Daan De Meyer 869b44e0f7 Several follow-ups for recent SELinux changes (#38161) 2025-07-11 09:01:00 +02:00
Yu Watanabe 0939d5c360 reboot-util: merge with raw-reboot.h
The header raw-reboot.h is only used with reboot-util. Let's merge them.
2025-07-11 13:05:46 +09:00
Yu Watanabe 3fc2a44043 include: move trivial kernel header wrappers to src/include/override/ 2025-07-11 13:05:46 +09:00
Yu Watanabe 543a48b653 libc-wrapper: introduce a tiny libc wrapper
Then, move syscall definitions to the wrapper, and prototypes are moved
to relevant headers.

This also adds checks for add_key() and request_key(), as one day
glibc may be going to add some of them separatedly.

The check for fspick in meson.build is dropped, as it is currently
unused in our code.

This also moves
- basic/missing_bpf.h -> include/override/linux/bpf.h,
- basic/missing_keyctl.h -> include/override/linux/keyctl.h.
2025-07-11 13:05:46 +09:00
Yu Watanabe 2b912d2066 tree-wide: several cleanups for generating symbol lists and gperf files
- pass our system include directories to make generators use our libc
  wrappers and latest kernel headers,
- include relevant headers in generated gperf file,
- use files() rather than find_program(), as the result of
  find_program() cannot be passed to 'input' of custom_target(),
- move generate-bpf-delegate-configs.py to src/core/, as it is only used
  by libcore.
2025-07-11 13:05:42 +09:00
Yu Watanabe 090c3f924c core/selinux-access: insert an empty line after function arguments
Follow-ups for fe3f2ac073 and
e3fef210c8.
2025-07-11 12:19:51 +09:00
Yu Watanabe 0c0b4d544c io.systemd.Manager.Describe fix context/runtime split (#38135)
This PR rearranges fields in io.systemd.Manager.Describe according to
the guidance by Lennart:

> If a property can be set in a unit file, ever, then it belongs in context.
> Otherwise, it belongs to runtime.

Closes #38124.
2025-07-11 10:26:57 +09:00
Yu Watanabe b3337feb55 Plumbing to perform SELinux checks in varlink API (#38146)
This PR does minimal changes to introduce varlink support. Ideally, the
code should switch to using `mac_selinux_get_our_label()` and new
`mac_selinux_get_peer_label()`. But I leave it for now to minimize
breakage. `mac_selinux_get_peer_label()` remains unused.

This is a prep step to merge
https://github.com/systemd/systemd/pull/38032
2025-07-11 10:20:36 +09:00
Ivan Kruglov d5f4bd3700 selinux: mac_selinux_unit_access_check_varlink macros 2025-07-10 21:16:32 +02:00
Ivan Kruglov e3fef210c8 selinux: mac_selinux_access_check_varlink_internal() 2025-07-10 21:16:32 +02:00
Ivan Kruglov fe3f2ac073 selinux: check_access() 2025-07-10 21:16:32 +02:00
Ivan Kruglov 5dc3096efb core: leave a comment about context/runtime split 2025-07-10 21:08:11 +02:00
Ivan Kruglov 79eec46dfd core: move ControlGroup move runtime to context 2025-07-10 21:08:11 +02:00
Ivan Kruglov 89701e02ac core: move ConfirmSpawn from runtime to context 2025-07-10 21:08:11 +02:00
Ivan Kruglov 303d1b6b57 core: move ShowStatus/Log* from runtime to context 2025-07-10 21:08:11 +02:00
Ivan Kruglov 712f763036 core: move WatchdogDevice from runtime to context 2025-07-10 21:08:11 +02:00
Ivan Kruglov 545fde151a core: move RuntimeWatchdog* + RebootWatchdog + KExecWatchdog from runtime to spec 2025-07-10 21:08:11 +02:00
Ivan Kruglov afa9992429 core: fix double Environment present in both context and runtime 2025-07-10 21:08:11 +02:00
Ivan Kruglov a5d8520f86 core: move Version/Arch/Features/Taints/UnitPath from context to runtime 2025-07-10 21:08:11 +02:00
Ivan Kruglov 84c05ec632 selinux: get_our_contexts() 2025-07-10 21:06:51 +02:00
Ivan Kruglov 3484af2800 selinux: rename mac_selinux_access_check_internal() -> mac_selinux_access_check_bus_internal() 2025-07-10 21:06:51 +02:00