]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
21 months agorepart: support OpenSSL engines/providers for signing 31261/head
Luca Boccassi [Wed, 11 Oct 2023 18:23:40 +0000 (19:23 +0100)] 
repart: support OpenSSL engines/providers for signing

The provider API which is new requires providers, which are not
widely available and don't work very well yet, so also use a
fallback with the legacy engine API.

21 months agoopenssl: add helper to load key from provider/engine
Luca Boccassi [Thu, 12 Oct 2023 09:22:20 +0000 (10:22 +0100)] 
openssl: add helper to load key from provider/engine

It's not the literal private key, but EVP_PKEY becomes a reference
to the engine/provider that OpenSSL knows how to use later

21 months agoMerge pull request #31243 from YHNdnzj/systemctl-disable-now-template
Luca Boccassi [Fri, 9 Feb 2024 14:29:50 +0000 (14:29 +0000)] 
Merge pull request #31243 from YHNdnzj/systemctl-disable-now-template

systemctl: support disable/mask --now with unit template

21 months agoMerge pull request #31224 from mrc0mmand/packit-bpftool-workaround
Luca Boccassi [Fri, 9 Feb 2024 13:48:13 +0000 (13:48 +0000)] 
Merge pull request #31224 from mrc0mmand/packit-bpftool-workaround

packit: temporarily build systemd without BPF stuff

21 months agoMerge pull request #31264 from poettering/sysext-help
Luca Boccassi [Fri, 9 Feb 2024 13:46:28 +0000 (13:46 +0000)] 
Merge pull request #31264 from poettering/sysext-help

sysext: tweaks to the systemd-sysext/systemd-confext --help text

21 months agoInstall pacman in Arch Linux image
Daan De Meyer [Fri, 9 Feb 2024 11:43:43 +0000 (12:43 +0100)] 
Install pacman in Arch Linux image

We install apt and dnf in the other images as well, so lets be
consistent and install pacman in the Arch image as well.

21 months agotest: adjust test-path to fail gracefully with the new pidfd_spawn stuff 31224/head
Frantisek Sumsal [Fri, 9 Feb 2024 11:40:29 +0000 (12:40 +0100)] 
test: adjust test-path to fail gracefully with the new pidfd_spawn stuff

Since 2e106312e2 the test unit fails with 'resources' result instead of
'exit-code', which the test didn't account for when running unprivileged.

Before 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
...
line 151: path-exists.path: state = running; result = success (left: 29986250)
line 151: path-exists.service: state = start; result = success
path-exists.service: Main process exited, code=exited, status=219/CGROUP
path-exists.service: Failed with result 'exit-code'.
line 151: path-exists.path: state = running; result = success (left: 29985948)
line 151: path-exists.service: state = failed; result = exit-code
Failed to start service path-exists.service, aborting test: failed/exit-code

After 2e106312e2:
$ /root/systemd/build/test-path
Failed to start transient scope unit: Interactive authentication required.
Couldn't allocate a scope unit for this test, proceeding without.
...
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
-.slice: Failed to enable/disable controllers on cgroup /user.slice/user-1000.slice/session-1.scope, ignoring: Permission denied
app.slice: Failed to create cgroup /user.slice/user-1000.slice/session-1.scope/app.slice: Permission denied
path-exists.service: Failed to spawn executor: No such file or directory
path-exists.service: Failed to spawn 'start' task: No such file or directory
path-exists.service: Failed with result 'resources'.

21 months agopackit: temporarily build systemd without BPF stuff
Frantisek Sumsal [Tue, 6 Feb 2024 16:48:34 +0000 (17:48 +0100)] 
packit: temporarily build systemd without BPF stuff

The kernel-tools meta-package was retired in Rawhide, but its
replacement has not landed, yet. Until that happens, let's build without
the bpf-framework stuff.

21 months agoAdd systemd.default_debug_tty=
Daan De Meyer [Thu, 8 Feb 2024 09:54:54 +0000 (10:54 +0100)] 
Add systemd.default_debug_tty=

Let's allow configuring the debug tty independently of enabling/disabling
the debug shell. This allows mkosi to configure the correct tty while
leaving enabling/disabling the debug tty to the user.

21 months agosemaphore: temporarily pin autopkgtest to v5.32
Frantisek Sumsal [Fri, 9 Feb 2024 09:30:08 +0000 (10:30 +0100)] 
semaphore: temporarily pin autopkgtest to v5.32

The latest commit (ATTOW) [0] calls adduser with --logmsglevel, which is
not a valid flag for adduser on Ubuntu Focal/Jammy.

[0] https://salsa.debian.org/ci-team/autopkgtest/-/commit/9c033b3db453acaa103bae03a4a5dcebe3858089

21 months agoman: add missing "=" after setting name
Yu Watanabe [Fri, 9 Feb 2024 10:03:19 +0000 (19:03 +0900)] 
man: add missing "=" after setting name

Follow-up for b93bf1bf9fb8f091c52588c5fc9edef6225f4ed3.

21 months agoMerge pull request #31230 from mrc0mmand/test-seccomp
Frantisek Sumsal [Fri, 9 Feb 2024 09:39:23 +0000 (10:39 +0100)] 
Merge pull request #31230 from mrc0mmand/test-seccomp

process-util: use only the least significant byte from personality()

21 months agoREADME: update link to CentOS CI
Yu Watanabe [Fri, 9 Feb 2024 09:08:58 +0000 (18:08 +0900)] 
README: update link to CentOS CI

21 months agoman: fix typo
Yu Watanabe [Fri, 9 Feb 2024 08:49:44 +0000 (17:49 +0900)] 
man: fix typo

Follow-up for 631cf7f0040234d2bca81bdfdf9efecc4fb5f40f.

21 months agosysext: output an appropriate blurb for the mode we are executed in 31264/head
Lennart Poettering [Fri, 9 Feb 2024 08:40:11 +0000 (09:40 +0100)] 
sysext: output an appropriate blurb for the mode we are executed in

21 months agosysext: point to the right man page for the mode we are invoked in
Lennart Poettering [Fri, 9 Feb 2024 08:37:23 +0000 (09:37 +0100)] 
sysext: point to the right man page for the mode we are invoked in

21 months agosysext: rename "directory_name" field to "full_identifier"
Lennart Poettering [Fri, 9 Feb 2024 08:32:53 +0000 (09:32 +0100)] 
sysext: rename "directory_name" field to "full_identifier"

So the field contains simply the full name of the command being invoked,
hence rename the field to match the contents, and to mirror the
"short_identifier" field.

Interestingly, the field is apparently not actually used by anything
though! But we are not going to remove it, since a follow-up commit will
start making use of it.

21 months agosysext: fix --help indenting/line breaking
Lennart Poettering [Fri, 9 Feb 2024 08:32:00 +0000 (09:32 +0100)] 
sysext: fix --help indenting/line breaking

Let's make sure there's an empty line after the explanatory text like we
usually do it, and do not indent the 2nd line more than the 1st

21 months agoMerge pull request #31172 from yuwata/network-bond-port
Yu Watanabe [Fri, 9 Feb 2024 08:32:29 +0000 (17:32 +0900)] 
Merge pull request #31172 from yuwata/network-bond-port

network: do not bring down bonding port on reconfigure

21 months agoMerge pull request #31247 from yuwata/network-make-reload-bus-method-synchronous
Yu Watanabe [Fri, 9 Feb 2024 08:32:07 +0000 (17:32 +0900)] 
Merge pull request #31247 from yuwata/network-make-reload-bus-method-synchronous

network: make Reload bus method synchronous

21 months agosystemctl: allow --now only if not install_client_side() 31243/head
Mike Yuan [Wed, 7 Feb 2024 22:42:10 +0000 (06:42 +0800)] 
systemctl: allow --now only if not install_client_side()

21 months agosystemctl: support disable/mask --now with unit template
Mike Yuan [Wed, 7 Feb 2024 14:15:05 +0000 (22:15 +0800)] 
systemctl: support disable/mask --now with unit template

Closes #15620
Replaces #28240

21 months agobasic/unit-name: introduce unit_name_replace_instance_full
Mike Yuan [Thu, 8 Feb 2024 10:31:37 +0000 (18:31 +0800)] 
basic/unit-name: introduce unit_name_replace_instance_full
that optionally accepts a globbed instance

21 months agosystemctl-util: some modernizations
Mike Yuan [Wed, 7 Feb 2024 15:33:07 +0000 (23:33 +0800)] 
systemctl-util: some modernizations

21 months agobasic/unit-name: include param name in function prototype
Mike Yuan [Wed, 7 Feb 2024 13:55:19 +0000 (21:55 +0800)] 
basic/unit-name: include param name in function prototype

21 months agotest: drop unnecessary sleep 31247/head
Yu Watanabe [Thu, 8 Feb 2024 03:55:07 +0000 (12:55 +0900)] 
test: drop unnecessary sleep

Now, 'Reload' dbus method is synchronous. It is not necessary to wait
for link enter configuring state.

21 months agonetwork: make Reload bus method synchronous
Yu Watanabe [Thu, 8 Feb 2024 03:47:39 +0000 (12:47 +0900)] 
network: make Reload bus method synchronous

Prompted by https://github.com/systemd/systemd/pull/30085#discussion_r1401534107.

Note, like Reconfigure bus method, even reconfiguration for an interface is
triggered by Reload method, the method only wait for the link enters
configuring state (or unmanaged state if no matching .network file exists).
Users still need to invoke systemd-networkd-wait-online if it is
necessary to wait for the interface enters configured state after Reload
medhod.

21 months agotest-network: add test case for issue #31165 31172/head
Yu Watanabe [Fri, 2 Feb 2024 02:20:25 +0000 (11:20 +0900)] 
test-network: add test case for issue #31165

21 months agonetwork: do not bring down a bonding port interface when it is already joined
Yu Watanabe [Fri, 2 Feb 2024 02:10:45 +0000 (11:10 +0900)] 
network: do not bring down a bonding port interface when it is already joined

Follow-up for 9f913d37a01f71e559d099bff280827f8817d8c5.

Fixes #31165.

21 months agonetwork: fix typo
Yu Watanabe [Fri, 9 Feb 2024 05:12:09 +0000 (14:12 +0900)] 
network: fix typo

Follow-up for baa95d2274179e680c4731a74f514e2651722ad2.

21 months agoMerge pull request #31177 from yuwata/network-ndisc-on-link-zero
Yu Watanabe [Fri, 9 Feb 2024 05:03:32 +0000 (14:03 +0900)] 
Merge pull request #31177 from yuwata/network-ndisc-on-link-zero

network/ndisc: drop onlink prefix route when on-link flag is zero

21 months agodetect-virt: fix Google Compute Engine support
mille-feuille [Thu, 8 Feb 2024 14:47:24 +0000 (23:47 +0900)] 
detect-virt: fix Google Compute Engine support

Follow-up for 9b0688f491674b53ef7a52bdf561a430c53673d6

21 months agopreset: enable homed sidecar services
Zbigniew Jędrzejewski-Szmek [Wed, 7 Feb 2024 11:43:53 +0000 (12:43 +0100)] 
preset: enable homed sidecar services

As described in https://github.com/systemd/systemd/issues/31235, the preset
state for systemd-homed-activate.service was unclear. On the one hand, we have
a preset with 'enable systemd-homed.service', and systemd-homed.service has
'Also=systemd-homed-activate.service systemd-homed-firstboot.service', so
'preset systemd-homed.service' would also enable those two services, but
'preset systemd-homed-activate.service' would disable it, because the presets
don't say it is enabled. It seems that this configuration is internally
inconsistent. As described in the issue, maybe systemctl should be smarter
here, or warn about such configs. Either way, let's make our config consistent.

Follow-up for d1f6e01e4743ae94740314eeb46a162112ef4599 and
3ccadbce3358ba1db7ce5fa3f8dd17c627ffd93b.

21 months agoportable: add --copy=mixed to copy images and link profiles
Luca Boccassi [Wed, 7 Feb 2024 00:36:39 +0000 (00:36 +0000)] 
portable: add --copy=mixed to copy images and link profiles

This new mode copies resources provided by the client, so that they
remain available for inspect/detach even if the original images are
deleted, but symlinks the profile as that is owned by the OS, so that
updates are automatically applied.

21 months agoman: mention that preset-all is performed during early boot
Zbigniew Jędrzejewski-Szmek [Wed, 7 Feb 2024 12:47:38 +0000 (13:47 +0100)] 
man: mention that preset-all is performed during early boot

The intro of systemd-firstboot is rewritten to make it clearer how it fits into
the big picture. Systemd does some machine-id and presets and
systemd-firstboot.service is used to interactively fill in the blanks.

Closes #22225.

21 months agocreds: fix typo
Antonio Alvarez Feijoo [Thu, 8 Feb 2024 16:22:40 +0000 (17:22 +0100)] 
creds: fix typo

21 months agoMerge pull request #30766 from polarina/cryptenroll-tpm2-unlock
Lennart Poettering [Thu, 8 Feb 2024 16:41:03 +0000 (17:41 +0100)] 
Merge pull request #30766 from polarina/cryptenroll-tpm2-unlock

cryptenroll: Add support for unlocking through TPM2 enrollments

21 months agonspawn: add missing OOM check on gethostname_malloc()
Sam Leonard [Tue, 30 Jan 2024 13:05:38 +0000 (13:05 +0000)] 
nspawn: add missing OOM check on gethostname_malloc()

21 months agovmspawn: remove extraneous log_info
Sam Leonard [Thu, 25 Jan 2024 15:03:48 +0000 (15:03 +0000)] 
vmspawn: remove extraneous log_info

21 months agovmspawn: fix incorrect handling of -M in getopt_long
Sam Leonard [Thu, 25 Jan 2024 14:50:24 +0000 (14:50 +0000)] 
vmspawn: fix incorrect handling of -M in getopt_long

21 months agovmspawn: fix incorrect mention of container
Sam Leonard [Thu, 25 Jan 2024 14:55:23 +0000 (14:55 +0000)] 
vmspawn: fix incorrect mention of container

21 months agocopy: do not ignore chattr_flags and friends passed to copy_file_atomic_full()
Yu Watanabe [Thu, 8 Feb 2024 06:59:48 +0000 (15:59 +0900)] 
copy: do not ignore chattr_flags and friends passed to copy_file_atomic_full()

Fixes a bug introduced by 427d9c34e61a8f5bfe369f1d5a0426143fe5741e.

21 months agoMerge pull request #31245 from yuwata/network-ndisc-adjust-log-messages
Yu Watanabe [Thu, 8 Feb 2024 13:05:55 +0000 (22:05 +0900)] 
Merge pull request #31245 from yuwata/network-ndisc-adjust-log-messages

network/ndisc: slightly update log messages

21 months agowait-online: split out get_state_range()
Yu Watanabe [Fri, 2 Feb 2024 17:34:07 +0000 (02:34 +0900)] 
wait-online: split out get_state_range()

Follow-up for 2d708781620239c9d1f9828a39f8761acf6350b2.

After the conversion from FOREACH_POINTER() to FOREACH_ARGUMENT(),
the iterator is never set to POINTER_MAX.

21 months agohwdb: add resolution setting for GAOMON S620
Sludge [Thu, 8 Feb 2024 01:18:35 +0000 (02:18 +0100)] 
hwdb: add resolution setting for GAOMON S620

21 months agodissect-image: fix typo
Yu Watanabe [Thu, 8 Feb 2024 02:37:17 +0000 (11:37 +0900)] 
dissect-image: fix typo

Follow-up for b387778c5b8a1e0d1b3f957f0c5866defbfbe4d4.

21 months agonspawn: fix typo
Yu Watanabe [Thu, 8 Feb 2024 02:36:05 +0000 (11:36 +0900)] 
nspawn: fix typo

Follow-up for f94025a13681e001011dd52e0dcecc143b4501b9.

21 months agotest: fix typo
Yu Watanabe [Thu, 8 Feb 2024 02:33:59 +0000 (11:33 +0900)] 
test: fix typo

Follow-up for 38a80ba1089fcad427f4376e28f74f9eb630fb91 and
a39d8396a986cb6291486b1d8451de8b0fd2b6cc.

21 months agonetwork/ndisc: drop onlink prefix route when on-link flag is zero 31177/head
Yu Watanabe [Fri, 2 Feb 2024 07:08:23 +0000 (16:08 +0900)] 
network/ndisc: drop onlink prefix route when on-link flag is zero

Fixes #28435.

21 months agonetwork/ndisc: fix use-of-uninitialized-value on failure path
Yu Watanabe [Wed, 7 Feb 2024 20:47:03 +0000 (05:47 +0900)] 
network/ndisc: fix use-of-uninitialized-value on failure path

Fixes a bug in f44eebd1bab9327c5dd3a281196bd07192134d3b.

Also slightly adjust log message.

21 months agoMerge pull request #31171 from yuwata/sd-ndisc-invalid-dnssl
Yu Watanabe [Thu, 8 Feb 2024 00:10:38 +0000 (09:10 +0900)] 
Merge pull request #31171 from yuwata/sd-ndisc-invalid-dnssl

sd-ndisc: handle invalid DNSSL option gracefully

21 months agonetwork/dhcp4: disable IPv6OnlyMode= by default
Yu Watanabe [Sun, 4 Feb 2024 07:37:33 +0000 (16:37 +0900)] 
network/dhcp4: disable IPv6OnlyMode= by default

As explained in #30891, IPv6OnlyMode= should be enabled with 464XLAT
support, but we do not support it yet. Let's disable by default.

Fixes #30891.

21 months agotest: add test case for invalid DNSSL option 31171/head
Yu Watanabe [Fri, 2 Feb 2024 01:59:36 +0000 (10:59 +0900)] 
test: add test case for invalid DNSSL option

21 months agonetwork/ndisc: sd_ndisc_router_get_{icmp6_ratelimit,retransmission_time}() should... 31245/head
Yu Watanabe [Wed, 7 Feb 2024 21:11:23 +0000 (06:11 +0900)] 
network/ndisc: sd_ndisc_router_get_{icmp6_ratelimit,retransmission_time}() should never fail

This also fixes use of '%m' specifier without passign error code.

21 months agonetwork/ndisc: slightly adjust log messages
Yu Watanabe [Wed, 7 Feb 2024 21:04:09 +0000 (06:04 +0900)] 
network/ndisc: slightly adjust log messages

21 months agotest: add short comment for RA message
Yu Watanabe [Fri, 2 Feb 2024 01:59:17 +0000 (10:59 +0900)] 
test: add short comment for RA message

21 months agosd-ndisc: make sd_ndisc_router_dnssl_get_domains() return -EBADMSG when received...
Yu Watanabe [Fri, 2 Feb 2024 01:23:56 +0000 (10:23 +0900)] 
sd-ndisc: make sd_ndisc_router_dnssl_get_domains() return -EBADMSG when received invalid domain name

Fixes #31168.

21 months agoMerge pull request #31176 from yuwata/network-required-for-online
Yu Watanabe [Wed, 7 Feb 2024 20:26:12 +0000 (05:26 +0900)] 
Merge pull request #31176 from yuwata/network-required-for-online

network: adjust default value of RequiredForOnline=

21 months agosd-dhcp6-client: allow setting send-release when client is running
Fernando Fernandez Mancera [Wed, 7 Feb 2024 10:07:38 +0000 (11:07 +0100)] 
sd-dhcp6-client: allow setting send-release when client is running

The send-release option only affects to the client when STOPPING. There
is no reason to do not allow this option to be set while the client is
running.

An user might want to delay the decision of sending a RELEASE message to
a later stage where the client is already running.

21 months ago60-evdev.hwdb: Add support for Huion Inspiroy 2 L (#31241)
Keian [Wed, 7 Feb 2024 20:14:09 +0000 (20:14 +0000)] 
60-evdev.hwdb: Add support for Huion Inspiroy 2 L (#31241)

Also fixed a spelling mistake on the HUION Inspiroy H420X

21 months agoprocess-util: unify the hex value format a bit 31230/head
Frantisek Sumsal [Wed, 7 Feb 2024 18:12:22 +0000 (19:12 +0100)] 
process-util: unify the hex value format a bit

And fix the man page reference as well.

21 months agoprocess-util: use only the least significant byte from personality()
Frantisek Sumsal [Wed, 7 Feb 2024 18:07:07 +0000 (19:07 +0100)] 
process-util: use only the least significant byte from personality()

The personality() syscall returns a 32-bit value where the top three
bytes are reserved for flags that emulate historical or architectural
quirks, and only the least significant byte reflects the actual
personality we're interested in (in opinionated_personality()).

Use the newly defined mask in the corresponding test as well, otherwise
the test fails on some more "exotic" architectures that set some of the
"quirk" flags:

~# uname -m
armv7l
~# build/test-seccomp
...
/* test_lock_personality */
current personality=0x0
safe_personality(PERSONALITY_INVALID)=0x800000
Assertion '(unsigned long) safe_personality(current) == current' failed at src/test/test-seccomp.c:970, function test_lock_personality(). Aborting.
lockpersonalityseccomp terminated by signal ABRT.
Assertion 'wait_for_terminate_and_check("lockpersonalityseccomp", pid, WAIT_LOG) == EXIT_SUCCESS' failed at src/test/test-seccomp.c:996, function test_lock_personality(). Aborting.
Aborted (core dumped)

See: personality(2) and comments in sys/personality.h

21 months agonetwork: set 'removing' flag to remembered object
Yu Watanabe [Fri, 2 Feb 2024 04:08:35 +0000 (13:08 +0900)] 
network: set 'removing' flag to remembered object

Previously, if address_remove() or friends called with a temporary
object, the removing flag is assigned to the temporary object, and is
not set to the remembered object. Hence, e.g.
route_is_ready_to_configure() wrongly judge a required address for a
route is (still) ready, hence networkd fails to configure the route.

Fixes #28009.

21 months agonetwork/address: do not configure with IFA_F_TENTATIVE
Yu Watanabe [Fri, 2 Feb 2024 04:17:18 +0000 (13:17 +0900)] 
network/address: do not configure with IFA_F_TENTATIVE

Follow-up for 0a0c2672dbd22dc85d660e5baa7e1bef701beb88.

After the commit, remembered Address objects by Link are always given by
kernel. Hence, it is not necessary to set the flag, as it is always
ignored by the kernel, and the kernel set the flag on notification if it
is necessary.

21 months agoMerge pull request #31202 from YHNdnzj/creds-reuse
Luca Boccassi [Wed, 7 Feb 2024 10:17:07 +0000 (10:17 +0000)] 
Merge pull request #31202 from YHNdnzj/creds-reuse

core: reuse credential dir across start and start-post if populated

21 months agotest: systemd-update-utmp is optional
Franck Bui [Tue, 6 Feb 2024 13:46:53 +0000 (14:46 +0100)] 
test: systemd-update-utmp is optional

It can be disabled with '-Dutmp=false'

21 months agopreset: enable confext and sysext by default (#31211)
Maanya Goenka [Tue, 6 Feb 2024 20:19:59 +0000 (12:19 -0800)] 
preset: enable confext and sysext by default (#31211)

21 months agoNEWS: announce plan to drop support for nscd
Zbigniew Jędrzejewski-Szmek [Thu, 25 Jan 2024 11:09:59 +0000 (12:09 +0100)] 
NEWS: announce plan to drop support for nscd

This is in preparation for https://github.com/systemd/systemd/pull/30360 to be
merged in a future release. As described there:

  nscd is known to be racy [1] and it was already deprecated and later dropped
  in Fedora a while back [1,2]. We don't need to support obsolete stuff in
  systemd, and the cache in systemd-resolved provides a better solution anyway.

  [1] https://fedoraproject.org/wiki/Changes/DeprecateNSCD
  [2] https://fedoraproject.org/wiki/Changes/RemoveNSCD

Note that our "support" is only the signal to flush the cache that we send at
various points. Nscd itself may still exist, dropping it is a decision to be
made in glibc.

21 months agocore: reuse credential dir across start and start-post if populated, 31202/head
Mike Yuan [Sun, 4 Feb 2024 15:22:46 +0000 (23:22 +0800)] 
core: reuse credential dir across start and start-post if populated,
fresh otherwise

Currently, exec_setup_credential() always rewrite all credentials
upon exec_invoke(), i.e. invocation of each ExecCommand, and within
a single tmpfs instance. This is problematic though:

* When writing each tmp cred file, we essentially double the size
  of the credential. Therefore, if one cred is bigger than half
  of CREDENTIALS_TOTAL_SIZE_MAX, confusing ENOSPC occurs (see also
  https://github.com/systemd/systemd/pull/24734#issuecomment-1925440546)

* Credential is a unit-wide thing and thus should not change
  during the whole lifetime of main process. However, if e.g.
  a on-disk credential or SetCredential= in unit file
  changes between ExecStart= and ExecStartPost=,
  the credentials are overwritten when the latter gets to run,
  and the already-running main process is suddenly seeing
  completely different creds.

So, let's try to reuse final cred dir if the main process has started
and the tmpfs has been populated, so that the creds used is stable
across all ExecStart= and ExecStartPost=-s. We still want to retain
the ability of updating creds through ExecStartPre= though, therefore
we forcibly use a fresh cred dir for those. 'Fresh' means to actually
unmount the old tmpfs first, so the first problem goes away, too.

21 months agocore: introduce exec_params_need_credentials
Mike Yuan [Tue, 6 Feb 2024 13:53:35 +0000 (21:53 +0800)] 
core: introduce exec_params_need_credentials

Also rename EXEC_WRITE_CREDENTIALS to EXEC_SETUP_CREDENTIALS.

21 months agoTEST-54-CREDS: add test for ExecStartPost= (#31194)
Mike Yuan [Tue, 6 Feb 2024 09:10:49 +0000 (17:10 +0800)] 
TEST-54-CREDS: add test for ExecStartPost= (#31194)

21 months agocore/exec-credential: use FOREACH_ARRAY at one more place
Mike Yuan [Tue, 6 Feb 2024 14:20:49 +0000 (22:20 +0800)] 
core/exec-credential: use FOREACH_ARRAY at one more place

21 months agocore/exec-credential: add missing assertions
Mike Yuan [Tue, 6 Feb 2024 14:17:34 +0000 (22:17 +0800)] 
core/exec-credential: add missing assertions

21 months agowait-online: by default not all interface need to be online
Yu Watanabe [Fri, 2 Feb 2024 17:44:08 +0000 (02:44 +0900)] 
wait-online: by default not all interface need to be online

Fixes an issue caused by ab3aed4a0349bbaa26f53340770c1b59b463e05d (v253).

By default, all managed interface need to be configured, and at least
one interface need to be online. Hence, offline interface should be ignored.

Fixes #29506.

21 months agocryptenroll: Fix reading keyfile from socket
Felix Riemann [Fri, 2 Feb 2024 17:08:52 +0000 (18:08 +0100)] 
cryptenroll: Fix reading keyfile from socket

systemd-cryptenroll uses the READ_FULL_FILE_CONNECT_SOCKET flag when
reading the keyfile to also allow reading it from a socket. But it also
sets the offset to 0, causing an unnecessary seek to the beginning of
the newly opened keyfile and disables socket support again, as these do
not support seeking.

Disable seeking entirely to remove the unneeded seek and restore support
for reading the keyfile from a socket again as with systemd-cryptsetup.

21 months agoMerge pull request #31210 from poettering/chdir-hardening
Luca Boccassi [Tue, 6 Feb 2024 12:41:43 +0000 (12:41 +0000)] 
Merge pull request #31210 from poettering/chdir-hardening

WorkingDirectory= hardening

21 months agoMerge pull request #31205 from YHNdnzj/path-is-mount-point
Luca Boccassi [Tue, 6 Feb 2024 12:37:20 +0000 (12:37 +0000)] 
Merge pull request #31205 from YHNdnzj/path-is-mount-point

mountpoint-util: expose root and flags as path_is_mount_point_full

21 months agounits: drop userdbd from homed's Also=
Zbigniew Jędrzejewski-Szmek [Mon, 5 Feb 2024 19:01:25 +0000 (20:01 +0100)] 
units: drop userdbd from homed's Also=

Also= lists units which should be enabled/disabled together with the first unit.
But userdbd is independent of homed, we shouldn't e.g. disable it even if homed
is disabled.

21 months agoprocess-util: minor follow-up for pidfd_spawn
Mike Yuan [Tue, 6 Feb 2024 07:33:07 +0000 (15:33 +0800)] 
process-util: minor follow-up for pidfd_spawn

21 months agonspawn: and also add comment, making clear chdir() should come late 31210/head
Lennart Poettering [Mon, 5 Feb 2024 16:11:12 +0000 (17:11 +0100)] 
nspawn: and also add comment, making clear chdir() should come late

21 months agonspawn: also refuse paths below API VFS in nspawn's --chdir= field
Lennart Poettering [Mon, 5 Feb 2024 16:10:40 +0000 (17:10 +0100)] 
nspawn: also refuse paths below API VFS in nspawn's --chdir= field

21 months agoload-fragment: set PATH_CHECK_NON_API_VFS flag at various other places
Lennart Poettering [Mon, 5 Feb 2024 15:38:11 +0000 (16:38 +0100)] 
load-fragment: set PATH_CHECK_NON_API_VFS flag at various other places

I tried to be conservative here, and hence in doubt I left the flag off,
but in some cases I really can't see any reason why it would make sense
to specifiy paths into API VFS, hence add it there, to lock things down
a bit.

21 months agoparse-helpers: adjust log level when we say we ignore to LOG_WARNING
Lennart Poettering [Mon, 5 Feb 2024 15:32:57 +0000 (16:32 +0100)] 
parse-helpers: adjust log level when we say we ignore to LOG_WARNING

21 months agodbus: make dbus property parsing of WorkingDirectory= equally strict as loading it...
Lennart Poettering [Mon, 5 Feb 2024 15:16:59 +0000 (16:16 +0100)] 
dbus: make dbus property parsing of WorkingDirectory= equally strict as loading it from the unit files

21 months agoexec-invoke: extend comment on placement of apply_working_directory() call
Lennart Poettering [Mon, 5 Feb 2024 14:42:46 +0000 (15:42 +0100)] 
exec-invoke: extend comment on placement of apply_working_directory() call

Inspired by CVE-2024-21626, let's add a longer comment explaining why
the code really shouldn#t be moved any earlier.

Just in the hope that anyone who feels tempted to move this around maybe
actually reads the comment and reconsiders.

21 months agoparse-helpers: add new PATH_CHECK_NON_API_VFS flag
Lennart Poettering [Mon, 5 Feb 2024 14:38:55 +0000 (15:38 +0100)] 
parse-helpers: add new PATH_CHECK_NON_API_VFS flag

In various contexts it's a bit icky to allow paths below /proc/, /sys/,
/dev/ i.e. file hierarchies where API VFS are placed. Let's add a new
flag for path_simplify_and_warn() to check for this and refuse a path if
in these paths.

Enable this when parsing WorkingDirectory=.

This is inspired by CVE-2024-21626, which uses trickery around the cwd
and /proc/self/fd/.

AFAICS we are not actually vulnerable to the same issue as explained in
the CVE since we execute the WorkingDirectory= setting very late, i.e.
long after we set up the new mount namespace. But let's filter out icky
stuff better earlier than later, as extra safety precaution.

21 months agomountpoint-util: add small helper that checks if a path is below the API VFS hierarchies
Lennart Poettering [Mon, 5 Feb 2024 14:38:20 +0000 (15:38 +0100)] 
mountpoint-util: add small helper that checks if a path is below the API VFS hierarchies

21 months agoexec-invoke: rework apply_working_directory() around chase()
Lennart Poettering [Mon, 5 Feb 2024 14:36:29 +0000 (15:36 +0100)] 
exec-invoke: rework apply_working_directory() around chase()

let's be more careful and get rid of one more prefix_roota() use, in
favour of the safe chase().

21 months agoparse-helpers: indent according to coding style
Lennart Poettering [Mon, 5 Feb 2024 14:15:57 +0000 (15:15 +0100)] 
parse-helpers: indent according to coding style

21 months agoMerge pull request #31209 from bluca/pidfd_spawn
Mike Yuan [Tue, 6 Feb 2024 07:14:17 +0000 (15:14 +0800)] 
Merge pull request #31209 from bluca/pidfd_spawn

core: add support for pidfd_spawn

21 months agomountpoint-util: introduce path_is_mount_point_full 31205/head
Mike Yuan [Sun, 4 Feb 2024 20:17:32 +0000 (04:17 +0800)] 
mountpoint-util: introduce path_is_mount_point_full

21 months agologin/user-runtime-dir: properly check for mount point
Mike Yuan [Sun, 4 Feb 2024 20:53:14 +0000 (04:53 +0800)] 
login/user-runtime-dir: properly check for mount point

21 months agoTODO: drop clone3 item 31209/head
Luca Boccassi [Mon, 5 Feb 2024 16:26:44 +0000 (16:26 +0000)] 
TODO: drop clone3 item

21 months agocore: add support for pidfd_spawn
Luca Boccassi [Fri, 12 Jan 2024 21:32:20 +0000 (21:32 +0000)] 
core: add support for pidfd_spawn

Added in glibc 2.39, allows cloning into a cgroup and to get
a pid fd back instead of a pid. Removes race conditions for
both changing cgroups and getting a reliable reference for the
child process.

Fixes https://github.com/systemd/systemd/pull/18843
Replaces https://github.com/systemd/systemd/pull/16706

21 months agoexecutor: really set POSIX_SPAWN_SETSIGDEF for posix_spawn
Luca Boccassi [Mon, 5 Feb 2024 14:22:52 +0000 (14:22 +0000)] 
executor: really set POSIX_SPAWN_SETSIGDEF for posix_spawn

posix_spawnattr_setflags() doesn't OR the input to the current set of flags,
it overwrites them, so we are currently losing POSIX_SPAWN_SETSIGDEF.

Follow-up for: 6ecdfe7d1008964eed3f67b489cef8c65a218bf1

21 months agoREADME: bump the gcc baseline to 8.4
Frantisek Sumsal [Mon, 5 Feb 2024 10:02:49 +0000 (11:02 +0100)] 
README: bump the gcc baseline to 8.4

We already use __VA_OPT__ in multiple places, which was introduced in
gcc 8 [0], so let's bump the baseline to reflect that. I chose gcc 8.4,
as that was the lowest 8.x version I could easily get my hands on when I
verified this (on Ubuntu Focal with the gcc-8 package).

Closes: #31191
[0] https://gcc.gnu.org/gcc-8/changes.html

21 months agoMerge pull request #31197 from YHNdnzj/protect-system-cred
Mike Yuan [Mon, 5 Feb 2024 08:06:42 +0000 (16:06 +0800)] 
Merge pull request #31197 from YHNdnzj/protect-system-cred

core/service: set up credentials for all start-post commands too

21 months agocore/service: allow ExecStartPost= cmds to access creds 31197/head
Mike Yuan [Sun, 4 Feb 2024 11:38:20 +0000 (19:38 +0800)] 
core/service: allow ExecStartPost= cmds to access creds

Fixes #31194

21 months agocore/service: don't setup credentials for ExecCondition= and ExecReload=
Mike Yuan [Sun, 4 Feb 2024 11:36:06 +0000 (19:36 +0800)] 
core/service: don't setup credentials for ExecCondition= and ExecReload=

This seems to be a mistake in #27279. I believe credentials should
not be made available to condition or reload tasks. In most cases
they're irrelevant from the actual job of the service. Also, currently
the first ExecCondition= or ExecReload= cannot access creds anyway,
making the incompatibility introduced negligible.

If people actually come up with valid use cases, we can always
revisit this.

21 months agocore/service: don't give ExecStopPost= commands tty access
Mike Yuan [Sun, 4 Feb 2024 11:34:16 +0000 (19:34 +0800)] 
core/service: don't give ExecStopPost= commands tty access

All tasks spawned later than ExecStart= (e.g. ExecReload=, ExecStop=, ...)
don't get tty access. ExecStopPost= is the odd one out. Fix that.