Commit Graph

85078 Commits

Author SHA1 Message Date
Yu Watanabe
332bce5bd7 oomd: move check if processes can be killed into oomd_cgroup_kill()
This also adds a debuuging log if the check failed.
Addresses https://github.com/systemd/systemd/pull/39773#discussion_r2549439336.

Follow-up for 38e9d40c80.
2025-11-24 12:40:13 +01:00
Luca Boccassi
5da6a8ee6e man,doc: add uapi spec numbers to all links to uapi specs (#39867) 2025-11-24 11:15:09 +00:00
Craig McLure
ab5a79ff5d hwdb: Add alternative mode for Beacn Mic (#39868)
The Beacn Mic's alt-mode behaves identically to it's primary mode from a
communication perspective, it just presents a different channel
configuration to ALSA.
2025-11-24 15:02:10 +09:00
Lennart Poettering
fc3adbbbcb man: always prefix links to uapi specs with their UAPI.XY spec number
Let's try to establish the spec numbers, by mentioning them in most doc
links.

Follow-up for: https://github.com/uapi-group/specifications/pull/187
2025-11-23 18:09:11 +01:00
Lennart Poettering
81b52a013c docs: reference UAPI specs by their number when linked 2025-11-23 17:16:09 +01:00
Yu Watanabe
19deb47ade firstboot: drop redundant and spurious errno check
Follow-up for 2319154a6b.
2025-11-23 22:36:50 +09:00
Luca Boccassi
941b91600c boot: ensure profile IDs do not get leaked and overwritten when there are tries suffixes
boot_entry_parse_tries() replaces the id, which means the id
with the profile appended is lost (leaked) and replaced by a plain filename
in case there are tries suffixes. This means the wrong order is used in
displaying the entries in the menu, as the main profile is always last
given id_without_profile has the tries suffixes and sorts higher,
while the main profile has no id_without_profile and the id sorts lower
since it does not have the tries suffix.

Follow-up for 4301ad00ef
2025-11-23 11:04:51 +09:00
Yu Watanabe
2d82ebf600 core/selinux-setup: actually skip setup gracefully when libselinux is not available (#39859) 2025-11-23 09:11:32 +09:00
Daan De Meyer
dd281e19a7 docs: Document cast formatting rules 2025-11-22 23:41:46 +01:00
Mike Yuan
375a4bd878 core/selinux-setup: actually skip setup gracefully when libselinux is not available
Follow-up for 83b6ef9b62
2025-11-22 19:07:28 +01:00
Mike Yuan
32b7a07b8c core/exec-invoke: deduplicate needs_setuid with needs_sandboxing 2025-11-22 19:07:28 +01:00
Yu Watanabe
f53ac7742f clang-tidy: Enable misc-include-cleaner check (#39835)
The previous commit fixes all remaining violations of the check for
a very specific setup (Fedora Rawhide with as many dependencies as
possible installed). The linter job in CI runs that specific setup
so we enable the check in the clang-tidy config but do not yet enable
the clang-tidy test suite in meson by default as it will very likely
still fail in different setups than the one in CI.
2025-11-22 20:54:28 +09:00
Daan De Meyer
6d57f584de clang-tidy: Enable misc-include-cleaner check
The previous commit fixes all remaining violations of the check for
a very specific setup (Fedora Rawhide with as many dependencies as
possible installed). The linter job in CI runs that specific setup
so we enable the check in the clang-tidy config but do not yet enable
the clang-tidy test suite in meson by default as it will very likely
still fail in different setups than the one in CI.
2025-11-22 10:19:41 +01:00
Daan De Meyer
87fbd33372 clang-tidy: Fix all remaining misc-include-cleaner violations
- Remove unused includes
- Add common false positive headers to misc-include-cleaner.IgnoreHeaders
- Add IWYU pragma keep for uncommon false positive headers
2025-11-22 10:19:41 +01:00
Daan De Meyer
d11ce97386 test-journald-config: Modernize test 2025-11-22 10:19:07 +01:00
Zbigniew Jędrzejewski-Szmek
add1828861 Various logging fixlets (#39837) 2025-11-22 10:14:10 +01:00
Yu Watanabe
229e106a6e NEWS: drop one sentence
We have agreed the bump.
2025-11-22 10:43:17 +09:00
Yu Watanabe
e6baa5ba0b Use SD_JSON_BUILD_PAIR_* macros if possible in shared/core/home (#39845) 2025-11-22 10:04:02 +09:00
Yu Watanabe
924081f793 pam-systemd-home: various logging cleanups 2025-11-22 09:42:41 +09:00
Yu Watanabe
447eb0a00c pam-systemd-loadkey: append full stop 2025-11-22 09:42:41 +09:00
Yu Watanabe
37d8d6623f pam-systemd: various fixlets for logging
- Do not use '%m' when errno is not set.
- Do not use pam_syslog_errno() when errno is not set.
- Use pam_debug_syslog_errno() rather than log_debug_errno().
- Use 0 rather than PAM_SUCCESS in the function that returns negative
  errno, though PAM_SUCCESS == 0, hence that does not change any
  behavior.
- Append missing full stop in the log message.
2025-11-22 09:42:41 +09:00
Yu Watanabe
7214aa9a2c pam-util: make pam_debug_syslog_errno() returns pam error
Currently, the result of pam_debug_syslog_errno() is unused, hence this
does not change anything and may be slightly redundant. But let's follow
our usual coding style.
2025-11-22 09:42:41 +09:00
Yu Watanabe
82f2eb73b1 pam-util: use correct errno
- pam_log_oom() passes ENOMEM rather than -ENOMEM, hence previously
  pam_log_oom() did not return PAM_BUF_ERR.
- We may (mistakenly) pass SYNTHETIC_ERRNO(). Let's gracefully handle that.
- Introduce errno_to_pam_error() helper function.
2025-11-22 09:42:41 +09:00
Yu Watanabe
7582679d0e apparmor: update log message
Follow-up for c3b3eea2e5.
Addresses https://github.com/systemd/systemd/pull/39826#discussion_r2547327325.
2025-11-22 09:42:41 +09:00
Nick Rosbrook
7d23e27e4c test: skip test-reread-partition-table if missing privileges
Right now, this test runs inside unprivileged chroots, despite the
running_in_chroot() check. This is because running_in_chroot() fails
with -EACCES, which is ignored.

Hence, check for privileges before calling running_in_chroot(),
otherwise call is inconclusive. Note, the test will fail later on if
running without privileges anyways.
2025-11-21 19:28:05 +00:00
Luca Boccassi
12d2abe082 test: check for all errors in test-reread-partition-table
Otherwise if opening the loop dev fails, the test segfaults
dereferencing a NULL variable later

Follow-up for 757887d01d
2025-11-21 19:13:39 +01:00
Jelle van der Waa
2a3f05400a resolve: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
No functional change, just refactoring.
2025-11-21 17:34:58 +01:00
Jelle van der Waa
2ba6cdc1b9 home: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
No functional change, just refactoring.
2025-11-21 17:34:57 +01:00
Jelle van der Waa
7dda32a544 shared: prefer using SD_JSON_BUILD_PAIR_* over SD_JSON_BUILD_PAIR()
No functional change, just refactoring.
2025-11-21 17:34:43 +01:00
Chris Down
d1ae5e26c4 nspawn: Fix broken host links for container journals (#39727)
Commit 88252ca changed nspawn to always run from a temporary mount
directory (e.g., /tmp/nspawn-root-XXXXXX). This was a good
simplification for mount logic, but it unintentionally broke the
--link-journal feature.

The setup_journal() helper was subsequently passed this ephemeral path
instead of the persistent machine path (from --directory= or --image=).
This caused the host to create broken symlinks pointing to a temporary
directory that would soon be gone.

Fix this by storing the original path and plumbing it through to
setup_journal().

All other mount-related logic in outer_child() continues to use the
temporary `directory` variable.

Fixes: #39472
2025-11-21 23:42:23 +08:00
Chris Down
887f54adce nspawn: Add integration test for --link-journal 2025-11-21 21:04:34 +08:00
Chris Down
11eebc2357 nspawn: Fix broken host links for container journals
Commit 88252ca changed nspawn to always run from a temporary mount
directory (e.g., /tmp/nspawn-root-XXXXXX). This was a good
simplification for mount logic, but it unintentionally broke the
--link-journal feature.

The setup_journal() helper was subsequently passed this ephemeral path
instead of the persistent machine path (from --directory= or --image=).
This caused the host to create broken symlinks pointing to a temporary
directory that would soon be gone.

Fix this by storing the original path and plumbing it through to
setup_journal().

All other mount-related logic in outer_child() continues to use the
temporary `directory` variable.

Fixes: #39472
2025-11-21 21:04:34 +08:00
Daan De Meyer
2691e7558b run0: Add note about processes having privileges over --empower sessions 2025-11-21 13:08:50 +01:00
Daan De Meyer
cf063b8a1c sd-bus: Exit event loop with error code instead of EXIT_FAILURE
Instead of failing the event loop with a generic EXIT_FAILURE
error code when exit-on-disconnect is used, let's propagate the
error code instead of swallowing it.

Whereas previously sd_event_loop() would always fail with exit code
'1' when exit-on-disconnect is used with an sd-bus instance registered
with the event loop that encounters a failure, now we'll correctly
propagate the error to sd_event_loop() that caused sd-bus to fail and
exit the event loop. Additionally, the error is now also properly
propagated to outstanding reply callbacks for async dbus calls started
with sd_bus_call_async() and friends, whereas before we always used
ETIMEDOUT for these calls which is extremely confusing for users.

Why is this confusing? We always start sd-bus instances asynchronously,
in other words, sd_bus_start() will not actually wait until the bus instance
is connected, but it'll happen in the background, either driven by the first
sd_bus_call() when there is no event loop or by sd-event when there is an
event loop attached to the sd-bus instance. Assuming an event loop is attached,
when we fail to connect to the bus, the sd-bus instance will close down and the
first async method call we queued will fail with ETIMEDOUT. Nowhere in this process
do we inform the user that we failed to connect to the bus because of e.g. a permission
error, except for a debug log message.

By propagating the error to sd_event_exit() if exit-on-disconnect is enabled
and always propagating it to outstanding reply callbacks, debugging failures
becomes much easier as users will now get the actual error code causing the
bus instance to close down instead of ETIMEDOUT and 1 respectively.
2025-11-21 09:57:51 +01:00
Luca Boccassi
dff4fb7c35 test: skip test-loop-block udev part in chroot too
Same reason as containers, need full udev/uevent machinery for this
2025-11-21 09:16:57 +01:00
Matteo Croce
38e9d40c80 oomd: check if a cgroup can be killed before attempting to kill it
On OOM event, oomd tries to kill a cgroup until it succeedes.
The kill can fail with EPERM in case a pid is not killed, this leaves
the cgroup with only half of the processed killed.
This is unlikely but theoretically possible in a user namespace,
where systemd run as root inside the container and tries to kill a
cgroup with some PID from the host namespace.

To address this, send the SIG0 signal to all the processes to check
that we have privileges to kill them.
2025-11-21 09:15:37 +01:00
Zbigniew Jędrzejewski-Szmek
f295cfa1a7 apparmor: move dlopen() into mac_apparmor_use() check (#39826)
This mirrors what we do for mac_selinux_use(), which also loads
libselinux.
2025-11-20 20:10:44 +01:00
Luca Boccassi
4902a7f18d virt: debug log when inode_same() fails
If this fails with an error there's no log messages and tests
typically don't log it either as they just check, so add a
message to aid in debugging
2025-11-20 20:02:06 +01:00
Daan De Meyer
6629107404 mkosi: Drop IWYU
We use clang-tidy's include checker, so let's stop installing IWYU.
2025-11-20 18:46:14 +01:00
Christoph Anton Mitterer
2e5f717545 man: fix typo 2025-11-20 15:37:54 +00:00
Daan De Meyer
e1f9de9739 mkosi: update fedora commit reference to 12f95f807fef5075a8842dd107f83b4c41d5ac26
* 12f95f807f Wrap %autosetup in %_build_in_place check
* f9916b6fd1 Revert "Use %autosetup -C"
* 044cff4700 Allow empower group
* a0acca210d Version 259~rc1
* e455d82fd8 Add various extra explicit Requires
* 1a7506a105 Version 258.2
* 256463d690 Restore runlevelX.target units
* b17d9c3474 Use %autosetup -C
* fe18084a05 Remove hack to stop systemd-networkd-resolve-hook.socket
2025-11-20 15:26:26 +01:00
Mike Yuan
53eda862c1 labeler: shell-completion -> "shell completion"
The latter is what we actually use. We didn't observe the issue
because the rule was effectively inactive before
bcf95c4116.
2025-11-20 14:13:20 +00:00
Yu Watanabe
6df082a039 pam_systemd: fix OSC write failure message appearing in error logs (#39791) 2025-11-20 23:07:00 +09:00
Lennart Poettering
b5dbe7179b apparmor-util: shortcut mac_apparmor_use() if compile-time disabled 2025-11-20 14:21:56 +01:00
Lennart Poettering
c3b3eea2e5 apparmor: move dlopen() into mac_apparmor_use() check
This mirrors what we do for mac_selinux_use(), which also loads
libselinux.
2025-11-20 14:19:56 +01:00
Daan De Meyer
8137c6bf2d mkosi: Install valgrind in tools tree 2025-11-20 12:03:01 +01:00
val4oss
6c32492932 pam_systemd: fix OSC write failure message appearing in error logs
Create and use new function pam_debug_syslog_errno() instead to ensure the
message only appears when debug mode is enabled. Pass the debug flag to
open_osc_context() and close_osc_context() to support this change.
2025-11-20 11:43:01 +01:00
val4oss
bc9dc63f4f pam-util: fix pam_syslog_errno() ignoring the level parameter
The function accepts a level parameter but was always logging at
LOG_ERR. Fix by passing the level parameter to sym_pam_vsyslog()
instead of hardcoding LOG_ERR.

This caused debug and warning messages to incorrectly appear in error
logs.
2025-11-20 11:00:48 +01:00
Daan De Meyer
3c6af4cc79 Make file-hierarchy.7 link to two online docs and drop most of the contents (#39412) 2025-11-20 09:56:41 +01:00
Christoph Anton Mitterer
b3d99e2308 man: improve BindsTo= documentation
Make “effect” plural to indicate that BindsTo= also includes the other effects
of Requires= (like starting the listed units).

The documentation of Requires= already describes that the configuring unit is
stopped/restarted if any of the list units is explicitly stopped/restarted.
This made the previous wording “in addition to the effect of Requires, it
declares that if the unit bound to is stopped, this unit will be stopped too.”
ambiguous – this is no in addition, Requires= already does that, at least for
some (namely the explicit) cases.
Resolve this by making it clear what the actual difference to Requires= is and
further mention that this also includes failed units.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
2025-11-20 09:51:08 +01:00