1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

77135 Commits

Author SHA1 Message Date
Michal Sekletar
65c75f99e1 test: add test coverage for EnterNamespace= 2024-10-30 12:38:27 +00:00
Michal Sekletár
13cd1db07f coredump: return correct error variable 2024-10-30 12:38:27 +00:00
Michal Sekletar
e26a7e08f5 coredump: rename AccessContainer= to EnterNamespace= 2024-10-30 12:38:27 +00:00
Michal Sekletar
b8fe1b1dc8 coredump: rework gather_pid_mount_tree_fd() 2024-10-30 12:38:27 +00:00
Michal Sekletar
c287f0f7e9 coredump: use FORK_WAIT 2024-10-30 12:38:26 +00:00
Michal Sekletar
84289ab90f coredump: store actual fd in appropriate variable 2024-10-30 12:20:40 +00:00
Michal Sekletar
e5bad3a7b9 coredump: use FORK_LOG to get more precise logging 2024-10-30 12:20:40 +00:00
Michal Sekletar
a88e72be2c coredump: fix coding style 2024-10-30 12:20:40 +00:00
Michal Sekletar
4698fd9769 coredump: get rid of redundant double space 2024-10-30 12:20:40 +00:00
Michal Sekletar
5e55410aca coredump: use more appropriate return code 2024-10-30 12:20:40 +00:00
Michal Sekletar
a65ad191cd coredump: check for and close unexpected FDs 2024-10-30 12:20:40 +00:00
Michal Sekletar
7bfce97666 coredump: fix line spacing 2024-10-30 11:47:34 +00:00
Michal Sekletar
d8a567dfc3 coredump: merge variable definitions 2024-10-30 11:47:34 +00:00
Michal Sekletar
0aea68721a coredump: rework attaching container mount trees 2024-10-30 11:47:34 +00:00
Michal Sekletar
3ed5c6aa9b analyze: don't use Yoda conditions 2024-10-29 18:08:04 +00:00
Michal Sekletar
b189f0d455 analyze: modernize opening ELF binary a bit 2024-10-29 18:08:04 +00:00
Yu Watanabe
feb9ccb56e
Merge pull request #34633 from keszybz/sd-json-enum-formatting
Add sd_json_format_enabled() helper
2024-10-29 03:29:03 +09:00
Yu Watanabe
3499e87885
Merge pull request #34806 from ryantimwilson/protect-control-groups
cgroup: Add support for ProtectControlGroups= private and strict
2024-10-29 02:53:11 +09:00
Pavel Borecki
ab5715e1cd po: Translated using Weblate (Czech)
Currently translated at 86.5% (219 of 253 strings)

Co-authored-by: Pavel Borecki <pavel.borecki@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/cs/
Translation: systemd/main
2024-10-29 01:50:01 +09:00
Ryan Wilson
cd58b5a135 cgroup: Add support for ProtectControlGroups= private and strict
This commit adds two settings private and strict to
the ProtectControlGroups= property. Private will unshare the cgroup
namespace and mount a read-write private cgroup2 filesystem at /sys/fs/cgroup.
Strict does the same except the mount is read-only. Since the unit is
running in a cgroup namespace, the new root of /sys/fs/cgroup is the unit's
own cgroup.

We also add a new dbus property ProtectControlGroupsEx which accepts strings
instead of boolean. This will allow users to use private/strict via dbus
and systemd-run in addition to service files.

Note private and strict fall back to no and yes respectively if the kernel
doesn't support cgroup2 or system is not using unified hierarchy.

Fixes: #34634
2024-10-28 08:37:36 -07:00
Ryan Wilson
5fe2923828 core: Refactor ProtectControlGroups= to use enum vs bool
This commit refactors ProtectControlGroups= from using a boolean
in the dbus/execute backend to using an enum. There is no functional
change but this will allow adding new non-boolean values (e.g. strict,
private) a la PrivateHome.
2024-10-28 06:42:53 -07:00
Zbigniew Jędrzejewski-Szmek
23441a3d88 sd-json,tree-wide: add sd_json_format_enabled() and use it everwhere
We often used a pattern like if (!FLAGS_SET(flags, SD_JSON_FORMAT_OFF)),
which is rather verbose and also contains a double negative, which we try
to avoid. Add a little helper to avoid an explicit bit check.

This change clarifies an aditional thing: in some cases we treated
SD_JSON_FORMAT_OFF as a flag (flags & SD_JSON_FORMAT_OFF), while in other cases
we treated it as an independent enum value (flags == SD_JSON_FORMAT_OFF).
In the first form, flags like SD_JSON_FORMAT_SSE do _not_ turn the json
output on, while in the second form they do. Let's use the first form
everywhere.

No functional change intended.

Initially I wasn't sure if this helper should be made public or just internal,
but it seems such a common pattern that if we expose the flags, we might just
as well expose it too, to make life easier for any consumers.
2024-10-28 09:23:07 +01:00
Zbigniew Jędrzejewski-Szmek
dc32b09b70 sd-id128: mark functions as const, not pure
We would need to use pure if the funtion was getting pointers and
dereferencing them. But sd128_t is a structure and those functions
only access the parameters of the call.
2024-10-28 09:23:07 +01:00
Zbigniew Jędrzejewski-Szmek
955c51c087 sd-common: add __const__
const is stronger than pure, see
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
and
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute.
2024-10-28 09:23:07 +01:00
Zhou Qiankang
85d0aff84c meson: add loongarch64's definition to cpu_arch_defines
The default definition to add is `-D__loongarch64__`, which is not searched in [bpf_tracing.h](09b9e83102/src/bpf_tracing.h (L68))

This may avoid `error: Must specify a BPF target arch via __TARGET_ARCH_xxx` in loongarch64

Signed-off-by: Zhou Qiankang <wszqkzqk@qq.com>
2024-10-28 15:21:55 +09:00
Andika Triwidada
e127c66985 po: Translated using Weblate (Indonesian)
Currently translated at 100.0% (253 of 253 strings)

Co-authored-by: Andika Triwidada <andika@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/id/
Translation: systemd/main
2024-10-27 17:14:54 +09:00
Yu Watanabe
99b76684d7
Merge pull request #34902 from ryantimwilson/root-dir-not-exists-error
core: Add RootDirectory= path to error message if directory does not exist
2024-10-27 13:49:05 +09:00
Ryan Wilson
141dfbe537 core: Add RootDirectory= path to error message if directory does not exist
A colleague reported when RootDirectory= does not exist, systemd reports an error like:
```
Failed to set up mount namespacing: No such file or directory
```

Unfortunately, with large spec files, it can be hard to diagnose which path systemd is talking
about. Thus, to make the error message more helpful and similar to mount error messages, we add
the root directory/image path into the error message like:
```
Failed to set up mount namespacing: /tmp/thisdoesnotexist: No such file or directory
```
2024-10-26 15:33:30 -07:00
Ryan Wilson
e73c042be6 core/execute: Rename error_path -> reterr_path/ret_path per coding guidelines
This is a non-functional change to ensure error_path used to print out the
offending mount causing an error follows coding guidelines.
2024-10-26 15:28:49 -07:00
Yu Watanabe
7354936ef7 core/cgroup: rename CGROUP_PRESSURE_WATCH_ON/OFF -> CGROUP_PRESSURE_WATCH_YES/NO
No functional change, but let's print yes/no rather than on/off in systemd-analyze.

Similar to 2e8a581b9c and
edd3f4d9b7.
(Note, the commit messages of those commits are wrong, as
 parse_boolean() supports on/off anyway.)
2024-10-27 03:04:35 +09:00
Sascha Mester
f2eccaab34
hwdb: add Stream Deck Neo (#34903) 2024-10-27 00:27:29 +09:00
Yu Watanabe
5dc0668802 sd-event: fix memleak when built without assertion
Fixes a bug introduced by baf3fdec27.

This also adds several assertions at the beginning of the function.

Fixes #34899.
2024-10-26 17:21:34 +02:00
Yu Watanabe
ddeb701b55 man: fix typo
Follow-up for 115fac3c29.
2024-10-26 14:00:38 +09:00
Yu Watanabe
f7804c1aa2 basic/missing: add short comment about when CLONE_NEWCGROUP is added 2024-10-26 13:59:19 +09:00
Integral
ddb8a639d5
tree-wide: replace for loop with FOREACH_ELEMENT or FOREACH_ARRAY macros (#34893) 2024-10-26 07:10:22 +09:00
Yu Watanabe
f7078de515
Merge pull request #34884 from poettering/run0-disconnect-fix
run: reconnect if our dbus connection is terminated
2024-10-26 02:50:48 +09:00
Yu Watanabe
6d6048b4cb
Merge pull request #34881 from poettering/run0-ui-tweaks
run0: various UI tweaks
2024-10-26 02:49:48 +09:00
Ivan Kruglov
10a48938ef machine: operation should not send a response when 'done' callback set 2024-10-26 02:45:53 +09:00
Lennart Poettering
b58b13f1c6 test: add brief testcase for systemd-run disconnect handling 2024-10-25 17:51:04 +02:00
Lennart Poettering
c8f59296bf run: reconnect if our dbus connection is terminated
We must be prepared that systemd temporarily drops off the bus or
disconnects our direct connections (due to systemctl daemon-reexec or
so). Hence automatically reconnect when we watch the unit status, and
handle this case gracefully.

Fixes: #32906 #27204
2024-10-25 17:51:04 +02:00
Lennart Poettering
d585085f57 update TODO 2024-10-25 17:32:19 +02:00
Lennart Poettering
ff4b6a1915 run: drop "-" prefix from command line when generating unit description
Let's not confuse users with the login shell indicator and drop it from
the description. This means a run0 session will now usually show up with
a description of "[run0] /bin/bash" rather than "[run0] -/bin/bash".
2024-10-25 17:32:19 +02:00
Lennart Poettering
d9f68f48f7 run: prefix unit description with our own process name
I think we should try to communicate clearly if something is a run0
session, or a systemd-run invocation. Hence, let's initialize the
description so that the command is prefixed by
program_invocation_short_name.

Effectively this means that our run0 sessions now appear as services
with a description of "[run0] -/bin/bash"
2024-10-25 17:32:19 +02:00
Lennart Poettering
0310b2a60b run: tweak how we name our transient units
The current logic is a bit complex how systemd-run units are called. It
used to be just the unique ID of the dbus connection. Which was nice,
since its system-widely, uniquely assigned to us. But this didn't work
out well, due to direct connections to PID 1 and due to soft reboots.

We nowadays have a better ID to use though, with nicer properties: the
kernel manages a pidfd ID for every process after all, and it's globally
unique, for any process, and regardless of soft reboots. Hence use that
for naming preferably, and just keep one branch with a randomized name
as fallback.
2024-10-25 17:32:19 +02:00
Lennart Poettering
115fac3c29 run0: optionally show superhero emoji on each shell prompt
This makes use of the infra introduced in 229d4a9806 to indicate visually on each prompt that we are in superuser mode temporarily.
pick ad5de3222f userdbctl: add some basic client-side filtering
2024-10-25 17:31:06 +02:00
Lennart Poettering
9d8f5e22f8
Merge pull request #34891 from poettering/run0-pty
run0: add --pty and --pipe switches to force allocation of a pty or pipe
2024-10-25 16:25:01 +02:00
Lennart Poettering
6fb0c52295 ci: add some basic testing of the new --pty and --pipe switches 2024-10-25 14:14:26 +02:00
Lennart Poettering
edd10ab29c run0: add options to force allocation of PTY or of pipe use
Fixes: #33033
2024-10-25 14:14:26 +02:00
Lennart Poettering
988053eac3 tree-wide: use isatty_safe() everywhere 2024-10-25 14:09:38 +02:00
Lennart Poettering
a586f57eb2 update TODO 2024-10-25 13:57:44 +02:00