summaryrefslogtreecommitdiffstats
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-03-11network: make address_configure() and friends take Request objectYu Watanabe11-74/+48
This should not change any behavior. Just a preparation for a later commit which introduces request_call_netlink_async().
2022-03-11network: tc: assign netlink handlers into Request objectYu Watanabe3-11/+11
This should not change any behavior, as req->netlink_handler is always qdisc_handler or tclass_handler. This is just a preparation for a later commit which introduces request_call_netlink_async().
2022-03-11alloc-util: introduce mfree_func_type_tYu Watanabe1-0/+1
2022-03-11core/dbus-job: Use new way of specifying sd-bus vtable parameter namesClyde Byrd III1-8/+6
2022-03-11hostname-util: normalize get_pretty_hostname() call semanticsLennart Poettering2-4/+19
get_pretty_hostname() so far had semantics not in line with our usual ones: the return parameter was actually freed before the return string written into it, because that's what parse_env_file() does. Moreover, when the value was not set it would return NULL but succeed. Let's normalize this, and only fill in the return value if there's something set, and never read from it, like we usually do with return parameter, and in particular those named "ret_xyz". The existing callers don't really care about the differences, but it's nicer to normalize behaviour to minimize surprises.
2022-03-10cgls: mangle user-provided unit namesFrantisek Sumsal1-4/+8
so the CLI interface is now similar to `systemctl`, i.e. if no unit name suffix is provided, assume `.service`. Fixes: #20492 Before: ``` $ systemd-cgls --unit user@1000 Failed to query unit control group path: Invalid argument Failed to list cgroup tree: Invalid argument ``` After: ``` $ build/systemd-cgls --unit user@1000 Unit user@1000.service (/user.slice/user-1000.slice/user@1000.service): ├─session.slice (#4939) │ ├─pipewire-pulse.service (#5203) │ │ └─7711 /usr/bin/pipewire-pulse ... ```
2022-03-10core: support ExtensionDirectories in user managerLuca Boccassi8-7/+38
Unprivileged overlayfs is supported since Linux 5.11. The only change needed to get ExtensionDirectories to work is to avoid hard-coding the staging directory to the system manager runtime directory, everything else just works (TM).
2022-03-10po: Translated using Weblate (Georgian)Temuri Doghonadze1-110/+174
Currently translated at 100.0% (189 of 189 strings) Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com> Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ka/ Translation: systemd/main
2022-03-10core: introduce %R specifier for pretty hostnameFrantisek Sumsal5-1/+32
Resolves: #20054
2022-03-10pid1,nspawn: raise default RLIMIT_MEMLOCK to 8MLennart Poettering5-20/+34
This mirrors a similar check in Linux kernel 5.16 (9dcc38e2813e0cd3b195940c98b181ce6ede8f20) that raised the RLIMIT_MEMLOCK to 8M. This change does two things: raise the default limit for nspawn containers (where we try to mimic closely what the kernel does), and bump it when running on old kernels which still have the lower setting. Fixes: #16300 See: https://lwn.net/Articles/876288/
2022-03-10main: add 'const' on two function argumentsLennart Poettering1-2/+2
2022-03-10core: be a bit more defensive when resolving specifiersFrantisek Sumsal1-0/+39
2022-03-10manager: pass monitor metadata in more casesZbigniew Jędrzejewski-Szmek2-1/+11
The first ExecStartPre or the first ExecStart commands would get the metadata, but not the subsequent ones. Also check that we do not pass it in ExecStartPost.
2022-03-10manager: prevent cleanup of triggering units before we start the handlerZbigniew Jędrzejewski-Szmek1-4/+19
This fixes the following case: OnFailure= would be spawned correctly, but OnSuccess= would be spawned without the MONITOR_* metadata, because we'd "collect" the unit that started successfully. So let's block cleanup while we have a job running for the handler. The job cannot last infinitely, so at some point we'll be able to collect both.
2022-03-10manager/service: when we have multiple candidates to handle, warnZbigniew Jędrzejewski-Szmek1-10/+9
This would be very confusing to users, so let's warn if they configured the same handler for multiple units and we're not running it as expected.
2022-03-10manager/service: when we spawn, say whyZbigniew Jędrzejewski-Szmek1-1/+7
We already logged what we are spawning, but not so much why. Let's add this, so it's easier to distinguish execstartpre/execstart/execstartpost and such.
2022-03-10manager: log how many OnSuccess/OnFailure jobs were startedZbigniew Jędrzejewski-Szmek1-5/+7
2022-03-10manager: adjust commentZbigniew Jędrzejewski-Szmek1-12/+13
2022-03-10various: align vertically for ease of readingZbigniew Jędrzejewski-Szmek3-50/+50
2022-03-10TEST-68: enhance testing of chained commandsZbigniew Jędrzejewski-Szmek1-5/+21
The test would fail when the the same handler was used for multiple *failing* units. We need to call 'reset-failed' to let the manager forget about the earlier ones. systemd-analyze log-target console is removed, because it's easier to follow the logs if logging it to the journal.
2022-03-10TEST-68-PROPAGATE-EXIT-STATUS: deobfuscate shell code and fix typoZbigniew Jędrzejewski-Szmek1-42/+48
After the cleanup, it was fairly easy to see the wrong variable name ;)
2022-03-10NEWS: note backward-incompatible MONITOR_METADATA changeLuca Boccassi1-0/+8
2022-03-10test: cover template OnFailure/OnSuccess handlers in ↵Luca Boccassi1-2/+48
TEST-68-PROPAGATE-EXIT-STATUS
2022-03-10core: split $MONITOR_METADATA and return it only if a single unit triggers ↵Luca Boccassi10-326/+172
OnFailure/OnSuccess Remove the list logic, and simply skip passing metadata if more than one unit triggered an OnFailure/OnSuccess handler. Instead of a single env var to loop over, provide each separate item as its own variable. Fixes https://github.com/systemd/systemd/issues/22370
2022-03-10NEWS: note backward-incompatible change in StartUnitWithFlags()Luca Boccassi1-0/+4
2022-03-10core: do not return 'skipped' when Condition*= fail with StartUnitWithFlags()Luca Boccassi3-9/+2
Backward incompatible change to avoid returning 'skipped' if a condition causes a job activation to be skipped when using StartUnitWithFlags(). Job results are broadcasted, so it is theoretically possible that existing software could get confused if they see this result. Replaces https://github.com/systemd/systemd/pull/22369
2022-03-10pid1: split out crash handler logic into its own .c/.h fileLennart Poettering5-158/+194
This stuff is sufficiently different from the rest of main.c, let's move it to its own .c/.h file, to make main.c a bit shorter. No code changes, just some refactoring.
2022-03-10pid1: add comment to crash handler about memory allocationsLennart Poettering1-0/+6
2022-03-10core: support MountAPIVFS and RootDirectory in user managerLuca Boccassi4-12/+50
The only piece missing was to somehow make /proc appear in the new user+mount namespace. It is not possible to mount a new /proc instance, not even with hidepid=invisible,subset=pid, in a user namespace unless a PID namespace is created too (and also at the same time as the other namespaces, it is not possible to mount a new /proc in a child process that creates a PID namespace forked from a parent that created a user+mount namespace, it has to happen at the same time). Use the host's /proc with a bind-mount as a fallback for this case. User session services would already run with it, so nothing is lost.
2022-03-10main: drop get_process_cmdline from crash handlerlicunlong1-5/+6
get_process_cmdline calls malloc, which should be avoid in signal handler. Fixes: #22690
2022-03-09po: Translated using Weblate (Georgian)Temuri Doghonadze2-0/+857
Currently translated at 23.2% (44 of 189 strings) po: Added translation using Weblate (Georgian) Co-authored-by: Temuri Doghonadze <temuri.doghonadze@gmail.com> Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ka/ Translation: systemd/main
2022-03-09logind: rename scheduled_shutdown_type → scheduled_shutdown_actionLennart Poettering3-21/+19
This matches naming of the 'delayed_action' field we already have. It's similar in both type and concept, and hence should be named similarly.
2022-03-09logind: rename manager_item_for_handle() → handle_action_lookup()Lennart Poettering3-26/+27
The function has nothing to do with any Manager object, hence drop that from the name. And it actually looks something up by handle *action* not by *handle*, hence the old name was a bit misnomer. Let's call it handle_action_lookup(), as it queries handle action metainfo for a handle action. Also, let's make sure it behaves more like our usual functions that lookup some fixed data from some enum value/int: let's return NULL if we don't find it.
2022-03-09logind: drop unused prototypeLennart Poettering1-1/+0
2022-03-09logind: minor whitespace fixLennart Poettering1-7/+7
2022-03-09logind: rename ActionTableItem → HandleActionDataLennart Poettering5-19/+19
It stores meta-info about various HandleActions, hence let's name it after that. The fact that it can be seen as stored inside some form of a table is an implementation detail of logind-action.c, and should not leak into other modules, hence let's focus on what it is, not how it is stored.
2022-03-09logind: replace handle_action_valid() macro by inline functionLennart Poettering1-2/+4
The old macro will double evaluation and has no protection against operator precedence issues. Let's fix that by using an inline func instead, which also gives us typesafety.
2022-03-09update TODOLennart Poettering1-0/+3
2022-03-09random-util: unify RANDOM_ALLOW_INSECURE and !RANDOM_BLOCK and simplifyJason A. Donenfeld3-104/+44
RANDOM_BLOCK has existed for a long time, but RANDOM_ALLOW_INSECURE was added more recently, leading to an awkward relationship between the two. It turns out that only one, RANDOM_BLOCK, is needed. RANDOM_BLOCK means return cryptographically secure numbers no matter what. If it's not set, it means try to do that, but if it fails, fall back to using unseeded randomness. This part of falling back to unseeded randomness is the intent of GRND_INSECURE, which is what RANDOM_ALLOW_INSECURE previously aliased. Rather than having an additional flag for that, it makes more sense to just use it whenever RANDOM_BLOCK is not set. This saves us the overhead of having to open up /dev/urandom. Additionally, when getrandom returns too little data, but not zero data, we currently fall back to using /dev/urandom if RANDOM_BLOCK is not set. This doesn't quite make sense, because if getrandom returned seeded data once, then it will forever after return the same thing as whatever /dev/urandom does. So in that case, we should just loop again. Since there's never really a time where /dev/urandom is able to return some easily but more with difficulty, we can also get rid of RANDOM_EXTEND_WITH_PSEUDO. Once the RNG is initialized, bytes should just flow normally. This also makes RANDOM_MAY_FAIL obsolete, because the only case this ran was where we'd fall back to /dev/urandom on old kernels and return GRND_INSECURE bytes on new kernels. So also get rid of that flag. Finally, since we're always able to use GRND_INSECURE on newer kernels, and we only fall back to /dev/urandom on older kernels, also only fall back to using RDRAND on those older kernels. There, the only reason to have RDRAND is to avoid a kmsg entry about unseeded randomness. The result of this commit is that we now cascade like this: - Use getrandom(0) if RANDOM_BLOCK. - Use getrandom(GRND_INSECURE) if !RANDOM_BLOCK. - Use /dev/urandom if !RANDOM_BLOCK and no GRND_INSECURE support. - Use /dev/urandom if no getrandom() support. - Use RDRAND if we would use /dev/urandom for any of the above reasons and RANDOM_ALLOW_RDRAND is set.
2022-03-09Packit: build SRPMs in CoprLaura Barcziova1-0/+1
Add srpm_build_deps key to the Packit config to specify needed dependencies for SRPM build and indicate to build SRPM in Copr.
2022-03-09test: set log level of user manager in TEST-43 to debugLuca Boccassi1-0/+2
2022-03-09core: create parent directory for mount point of ExtensionDirectoriesLuca Boccassi1-3/+3
This is used by ExtensionDirectories too, as they are bind-mounted in the propagate directory to check the extension-release files