]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
10 months agodebug-generator: add a kernel cmdline option to pause the boot process 35410/head
Antonio Alvarez Feijoo [Fri, 20 Dec 2024 07:51:23 +0000 (08:51 +0100)] 
debug-generator: add a kernel cmdline option to pause the boot process

Introduce the `systemd.break=` kernel command line option to allow stopping the
boot process at a certain point and spawn a debug shell. After exiting this
shell, the system will resume booting.

It accepts the following values:
- `pre-udev`: before starting to process kernel uevents (initrd and host).
- `pre-basic`: before leaving early boot and regular services start (initrd and
host).
- `pre-mount`: before the root filesystem is mounted (initrd).
- `pre-switch-root`: before switching root (initrd).

10 months agoman/debug-generator: add a section for kernel command line options
Antonio Alvarez Feijoo [Fri, 29 Nov 2024 10:29:17 +0000 (11:29 +0100)] 
man/debug-generator: add a section for kernel command line options

10 months agocapability-util: generalize helper to acquire local caps (#35403)
Yu Watanabe [Fri, 20 Dec 2024 02:52:24 +0000 (11:52 +0900)] 
capability-util: generalize helper to acquire local caps (#35403)

This generalizes and modernizes the code to acquire set of local caps,
based on the code for this in the condition logic. Uses PidRef, and
acquires the full quintuplet of caps.

This can be considered preparation to one day maybe build without
libcap.

10 months agoanalyze: add "chid" verb to display CHIDs of the local system (#35175)
Yu Watanabe [Fri, 20 Dec 2024 02:47:03 +0000 (11:47 +0900)] 
analyze: add "chid" verb to display CHIDs of the local system (#35175)

We already have the code for it, expose it in systemd-analyze, because
it's useful.

10 months agoSmall fixes to nspawn and other stuff (#35686)
Yu Watanabe [Fri, 20 Dec 2024 02:03:59 +0000 (11:03 +0900)] 
Small fixes to nspawn and other stuff (#35686)

Split out ouf #35685.

10 months agoudev: support reloading udev.conf (#35458)
Yu Watanabe [Fri, 20 Dec 2024 00:00:48 +0000 (09:00 +0900)] 
udev: support reloading udev.conf (#35458)

This makes systemd-udevd reload udev.conf when explicitly requested by
e.g. `udevadm control --reload`.

10 months agoptyfwd: reset writable/readable flag before shovel() on exit
Yu Watanabe [Thu, 19 Dec 2024 03:22:00 +0000 (12:22 +0900)] 
ptyfwd: reset writable/readable flag before shovel() on exit

Follow-up for 12807b5a49d1fe60434d473afe11ff81a4c92306.

Otherwise, if a call of shovel() disabled the flags, the subsequent
calls do nothing even if there is something we need to read or write.

Fixes the following error:
```
Dec 19 02:19:39 run0[5618]: Error on PTY forwarding logic: Too many levels of symbolic links
```

10 months agomachine: make TEST-13-NSPAWN wqlong-running code more verbose
Ivan Kruglov [Wed, 18 Dec 2024 17:50:35 +0000 (18:50 +0100)] 
machine: make TEST-13-NSPAWN wqlong-running code more verbose

Need this to debug https://github.com/systemd/systemd/issues/35115

10 months agoMinor fixes in man pages, example scripts, error log (#35683)
Luca Boccassi [Thu, 19 Dec 2024 17:08:13 +0000 (17:08 +0000)] 
Minor fixes in man pages, example scripts, error log (#35683)

No functional changes.

10 months agonspawn: switch to read_virtual_file() for reading audit loginuid 35686/head
Lennart Poettering [Thu, 14 Nov 2024 11:25:22 +0000 (12:25 +0100)] 
nspawn: switch to read_virtual_file() for reading audit loginuid

10 months agonsresource: print nicer error message when trying to acquire an unpriv user ns range...
Lennart Poettering [Tue, 12 Nov 2024 13:19:09 +0000 (14:19 +0100)] 
nsresource: print nicer error message when trying to acquire an unpriv user ns range where this isn't possible

10 months agomount-util: add debug message to make_userns() failure
Lennart Poettering [Thu, 19 Dec 2024 13:27:03 +0000 (14:27 +0100)] 
mount-util: add debug message to make_userns() failure

10 months agomount-util: add debug output when we switched root
Lennart Poettering [Mon, 25 Nov 2024 10:35:11 +0000 (11:35 +0100)] 
mount-util: add debug output when we switched root

10 months agonspawn: trivial improvements
Lennart Poettering [Wed, 13 Nov 2024 11:15:08 +0000 (12:15 +0100)] 
nspawn: trivial improvements

10 months agonspawn: rename pin_fully_visible_fs() → pin_fully_visible_api_fs()
Lennart Poettering [Mon, 25 Nov 2024 10:32:35 +0000 (11:32 +0100)] 
nspawn: rename pin_fully_visible_fs() → pin_fully_visible_api_fs()

This function pins the *API* FS, i.e. /proc/ + /sys/, not just any fs.
Hence clarify this in the name.

(At least we call these two fs "API (V)FS" in our codebase, hence
continue to do so here)

10 months agonspawn: add some additional useful debug logging
Lennart Poettering [Mon, 25 Nov 2024 10:54:21 +0000 (11:54 +0100)] 
nspawn: add some additional useful debug logging

10 months agonspawn: make unexpected mkdir() failures fatal
Lennart Poettering [Mon, 25 Nov 2024 11:08:59 +0000 (12:08 +0100)] 
nspawn: make unexpected mkdir() failures fatal

THis is just to make things easier to debug.

10 months agonspawn: rename 'fd' variable to something more descriptive
Lennart Poettering [Mon, 25 Nov 2024 11:18:14 +0000 (12:18 +0100)] 
nspawn: rename 'fd' variable to something more descriptive

10 months agonspawn: use DEVNUM_FORMAT_STR/DEVNUM_FORMAT_VAL more
Lennart Poettering [Thu, 19 Dec 2024 13:26:14 +0000 (14:26 +0100)] 
nspawn: use DEVNUM_FORMAT_STR/DEVNUM_FORMAT_VAL more

10 months agoman/sysupdate.features: fix typos 35683/head
Matthias Lisin [Thu, 19 Dec 2024 11:04:24 +0000 (12:04 +0100)] 
man/sysupdate.features: fix typos

10 months agosysupdate: fix args order of formatted error
Matthias Lisin [Thu, 19 Dec 2024 10:30:13 +0000 (11:30 +0100)] 
sysupdate: fix args order of formatted error

10 months agoman/sysupdate.d: fix wrong PathRelativeTo value
Matthias Lisin [Thu, 19 Dec 2024 09:32:52 +0000 (10:32 +0100)] 
man/sysupdate.d: fix wrong PathRelativeTo value

10 months agoman: fix args order for udevadm info cmd
Matthias Lisin [Wed, 16 Oct 2024 05:02:21 +0000 (07:02 +0200)] 
man: fix args order for udevadm info cmd

10 months agoTEST-17: use 'udevadm control --reload' or 'systemctl reload systemd-udevd.service... 35458/head
Yu Watanabe [Tue, 3 Dec 2024 21:34:43 +0000 (06:34 +0900)] 
TEST-17: use 'udevadm control --reload' or 'systemctl reload systemd-udevd.service' for reloading udev.conf

These should be equivalent. For coverage, one subtest uses systemctl and
another uses udevadm.

10 months agoudev: also reload udev.conf when explicitly requested
Yu Watanabe [Tue, 3 Dec 2024 19:29:13 +0000 (04:29 +0900)] 
udev: also reload udev.conf when explicitly requested

When reloading is explicitly requested, e.g. by 'udevadm control --reload',
then also reload udev.conf.

10 months agoudev: reload .rules files and builtins only when necessary
Yu Watanabe [Tue, 3 Dec 2024 19:31:31 +0000 (04:31 +0900)] 
udev: reload .rules files and builtins only when necessary

Previously, even if e.g. .rules files are unchanged, all .rules files
are reloaded when other kind of config files like .link files or
.hwdb.bin are changed, vice versa.

10 months agoudev: move config parsers and related things to udev-config.c (#35624)
Yu Watanabe [Thu, 19 Dec 2024 09:41:52 +0000 (18:41 +0900)] 
udev: move config parsers and related things to udev-config.c (#35624)

No functional change, just refactoring and preparation for later
changes.

10 months agoudev-config: introduce UdevConfig 35624/head
Yu Watanabe [Tue, 3 Dec 2024 17:26:02 +0000 (02:26 +0900)] 
udev-config: introduce UdevConfig

Then, save configurations by their source: udev.conf, command line
arguments, kernel command line options, and udev control.

Preparation to support reloading udev.conf in a later commit.

10 months agoudev: move parsers for config file, kerenel command line, and positional arguments...
Yu Watanabe [Tue, 3 Dec 2024 17:33:47 +0000 (02:33 +0900)] 
udev: move parsers for config file, kerenel command line, and positional arguments to udev-config.c

No functional change, just refactoring and preparation for later
commits.

10 months agoukify: Fix regression in --no-sign-kernel flag
Thomas Hebb [Wed, 18 Dec 2024 16:08:17 +0000 (11:08 -0500)] 
ukify: Fix regression in --no-sign-kernel flag

The man page says that --sign-kernel and --no-sign-kernel "override the
detection of whether to sign the Linux binary", so we should only
autodetect if neither are specified. But as of commit 02eabaffe98c
("ukify: Add a unified interface for signing tools"), we autodetect even
when --no-sign-kernel is passed, which makes the flag useless.

The sign_kernel option is parsed using argparse.BooleanOptionalAction,
which sets it to either True, False, or None. commit 02eabaffe98c
replaced `sign_kernel is None` with `not sign_kernel`. These are not the
same in Python, as the latter accepts False as well as None.

Restore the original check and fix type annotations accordingly.

Fixes: 02eabaffe98c ("ukify: Add a unified interface for signing tools")
10 months agonetworkd-sysctl: tweak error handling and log level a bit (#35673)
Lennart Poettering [Wed, 18 Dec 2024 17:20:30 +0000 (18:20 +0100)] 
networkd-sysctl: tweak error handling and log level a bit (#35673)

10 months agoanalyze: drop conditioning of --no-legend and --json= on specific verbs 35175/head
Lennart Poettering [Fri, 15 Nov 2024 10:40:44 +0000 (11:40 +0100)] 
analyze: drop conditioning of --no-legend and --json= on specific verbs

First of all, the list of verbs was badly out of date, in particular for
--no-legend. But second if it, I think such minor switches that alter
some detail of the output should not result in failure when the specific
tweak does not apply on some command. It should be fine for scripts and
suchlike to dumbly always pass --no-legend to all invocations of our
tools without having to consider if a specific subtool of ours actually
supports it or not.

10 months agoanalyze: add verb for showing system's CHIDs
Lennart Poettering [Fri, 15 Nov 2024 10:38:30 +0000 (11:38 +0100)] 
analyze: add verb for showing system's CHIDs

We have the code already, expose it in systemd-analyze too.

This should make it easier to debug the CHID use in the UKIs with
onboard tooling.

10 months agonetworkd-sysctl: tweak error handling and log level a bit 35673/head
Mike Yuan [Wed, 18 Dec 2024 13:34:59 +0000 (14:34 +0100)] 
networkd-sysctl: tweak error handling and log level a bit

Follow-up for 6d9ef22acdeac4b429efb75164341233955484af

- Downgrade log level for bpf not installed or kernel version
  being too old to LOG_DEBUG. Otherwise, on kernels older than 6.12
  the log becomes quite annoying.
- Always propagate the error and ignore only on caller's side.
  The current style is a messy mix.

10 months agoman: Document generator sandbox environment
Daan De Meyer [Wed, 18 Dec 2024 11:32:59 +0000 (12:32 +0100)] 
man: Document generator sandbox environment

10 months agonetworkd-sysctl: rename functions to match our typical prefixes
Mike Yuan [Wed, 18 Dec 2024 13:26:39 +0000 (14:26 +0100)] 
networkd-sysctl: rename functions to match our typical prefixes

10 months agoptyfwd: several cleanups (#35663)
Yu Watanabe [Wed, 18 Dec 2024 15:35:42 +0000 (00:35 +0900)] 
ptyfwd: several cleanups (#35663)

10 months agoupdate-utmp: do not give up if the first attempt at connecting bus failed
Yu Watanabe [Wed, 18 Dec 2024 13:27:29 +0000 (22:27 +0900)] 
update-utmp: do not give up if the first attempt at connecting bus failed

Otherwise, the program exits with failure if the first attempt in run() failed:
```
Dec 18 20:27:37 systemd-update-utmp[254]: Bus n/a: changing state UNSET → OPENING
Dec 18 20:27:37 systemd-update-utmp[254]: sd-bus: starting bus by connecting to /run/systemd/private...
Dec 18 20:27:37 systemd-update-utmp[254]: Bus n/a: changing state OPENING → CLOSED
Dec 18 20:27:37 systemd-update-utmp[254]: Failed to get D-Bus connection: Connection refused
```

10 months agoTEST-50-DISSECT: notify message cannot be sent by ncat
Yu Watanabe [Tue, 17 Dec 2024 06:09:47 +0000 (15:09 +0900)] 
TEST-50-DISSECT: notify message cannot be sent by ncat

Follow-up for d0a63cf0412ccb9b4edd1f6048e25aa7f68b0133.

The command ncat may be already dead when the service manager receives
the notify message. Hence, the service cannot be found by the sender PID,
and the notify message will be ignored.
```
Dec 17 03:26:49 systemd[1]: Cannot find unit for notify message of PID 1159, ignoring.
Dec 17 03:26:49 systemd[1]: Received SIGCHLD from PID 1152 (bash).
Dec 17 03:26:49 systemd[1]: Child 1152 (bash) died (code=exited, status=0/SUCCESS)
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Child 1152 belongs to run-p1151-i1451.service.
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Main process exited, code=exited, status=0/SUCCESS (success)
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Failed with result 'protocol'.
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Service will not restart (restart setting)
Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Changed start -> failed
```

This also drops unnecessary --pipe option and redundant check by 'env' command.

10 months agoresolved: if one transaction completes, expect other transactions within candidate...
Morten Hauke Solvang [Thu, 12 Dec 2024 13:26:31 +0000 (14:26 +0100)] 
resolved: if one transaction completes, expect other transactions within candidate to succeed quickly

Fixes #22575, as suggested by poettering in #35514.

Intended as a workaround for some buggy routers, which refuse to send empty
replies. If systemd-resolved starts two DnsTransactions, one for A and one
for AAAA, and the domain in question has no AAAA entry, then the server will
send a reply for A and no reply for AAAA. Correct behavior for the server would
be to send an empty reply for AAAA.

systemd-resolved would previously keep retrying the AAAA transaction, and
eventually timeout the whole query, returning an error to the caller.

Now, if the server replies to one query and not another, we cut short the
timeout and return the partial result. Returning the partial result allows
the rest of the system to keep working. It matches how e.g. glibc libnss_dns
behaves.

10 months agotest-firewall-util: Migrate to new assertion macros
Daan De Meyer [Wed, 18 Dec 2024 10:42:37 +0000 (11:42 +0100)] 
test-firewall-util: Migrate to new assertion macros

10 months agoudev: make builtins take UdevEvent object (#35625)
Yu Watanabe [Wed, 18 Dec 2024 13:02:22 +0000 (22:02 +0900)] 
udev: make builtins take UdevEvent object (#35625)

No functional change, just refactoring.

10 months agodata-fd-util: drop dead code
Yu Watanabe [Wed, 18 Dec 2024 02:55:47 +0000 (11:55 +0900)] 
data-fd-util: drop dead code

Also drops unnecessary header inclusions.

Follow-ups for a87a9625f8bde776ece11b8ddb77588cfff73038.
Fixes CID#1568419.

10 months agotpm2-util: Also retry unsealing after policy_pcr returns PCR_CHANGED
Fabian Vogt [Mon, 16 Dec 2024 18:08:13 +0000 (19:08 +0100)] 
tpm2-util: Also retry unsealing after policy_pcr returns PCR_CHANGED

It's not just Esys_Unseal that may fail due to PCR changes during the
session, but also Esys_PolicyPCR. Perform a retry in that case as well.

Fixes #35490

10 months agotree-wide: use pidref_is_self() at more places
Lennart Poettering [Tue, 19 Nov 2024 14:54:28 +0000 (15:54 +0100)] 
tree-wide: use pidref_is_self() at more places

10 months agomachinectl: explicitly assign PTY forwarder to sd_bus_slot 35663/head
Yu Watanabe [Wed, 18 Dec 2024 04:35:54 +0000 (13:35 +0900)] 
machinectl: explicitly assign PTY forwarder to sd_bus_slot

No functional change, just refactoring.

10 months agoptyfwd: always flush buffer and disconnect before exit
Yu Watanabe [Wed, 18 Dec 2024 02:14:06 +0000 (11:14 +0900)] 
ptyfwd: always flush buffer and disconnect before exit

Then, it is not necessary to manually drain PTY forwarder by the user
side. Also, not necessary to free PTY forwarder earlier explicitly to
make it disconnected.

10 months agoptyfwd: always write additional line break on stop
Yu Watanabe [Wed, 18 Dec 2024 02:12:57 +0000 (11:12 +0900)] 
ptyfwd: always write additional line break on stop

Currently we do that in the user of PTY forwarder, e.g. nspawn.
But, let's do that unconditionally in the PTY forwarder.

10 months agoptyfwd: save the last character before the escape sequence
Yu Watanabe [Wed, 18 Dec 2024 02:10:47 +0000 (11:10 +0900)] 
ptyfwd: save the last character before the escape sequence

If we write e.g. a line break and CSI sequence, then it is not necessary
to write another line break on exit.

10 months agoptyfwd: do not forward partial escape sequence
Yu Watanabe [Wed, 18 Dec 2024 02:06:07 +0000 (11:06 +0900)] 
ptyfwd: do not forward partial escape sequence

Otherwise, if the sender is killed while writing escape sequence,
we may get spurious output.

10 months agoptyfwd: coding style fix
Yu Watanabe [Tue, 17 Dec 2024 06:37:10 +0000 (15:37 +0900)] 
ptyfwd: coding style fix

- replace 'type *func()' -> 'type* func()',
- rename output argument to 'ret'.

10 months agomkosi: Fix tools image package name
Michal Koutný [Wed, 18 Dec 2024 09:36:55 +0000 (10:36 +0100)] 
mkosi: Fix tools image package name

10 months agoconfext/sysext: add initrd-specific units (#35426)
Lennart Poettering [Wed, 18 Dec 2024 09:33:38 +0000 (10:33 +0100)] 
confext/sysext: add initrd-specific units (#35426)

In the rootfs these need to run after /var/lib/ has been set up. In the
initrd we want them to run as soon as possible so that they can be used
to customize setting up the rootfs.

10 months agocore: drop unnecessary header inclusion
Yu Watanabe [Wed, 18 Dec 2024 02:01:35 +0000 (11:01 +0900)] 
core: drop unnecessary header inclusion

Follow-up for e76fcd0e40a6910f4818a374c6a8d854d644ff93.

10 months agoTEST-07-PID1: fix typo
Yu Watanabe [Wed, 18 Dec 2024 01:46:14 +0000 (10:46 +0900)] 
TEST-07-PID1: fix typo

Follow-up for e76fcd0e40a6910f4818a374c6a8d854d644ff93.

10 months agopam_systemd: some refactorings and bugfixes (#35178)
Lennart Poettering [Tue, 17 Dec 2024 22:02:00 +0000 (23:02 +0100)] 
pam_systemd: some refactorings and bugfixes (#35178)

Inspired at #35171 I had another closer look at pam_systemd, and found a
bunch of things to fix, and correct.

10 months agoremove fallbacks for memfd-less kernels (#35605)
Lennart Poettering [Tue, 17 Dec 2024 22:01:29 +0000 (23:01 +0100)] 
remove fallbacks for memfd-less kernels (#35605)

Let the culling continue: let's remove support for kernels that lack
memfd, i.e. pre-3.17 kernels.

This is a nice simplification of things.

10 months agotest: skip TEST-69-SHUTDOWN on ubuntu too
Nick Rosbrook [Tue, 17 Dec 2024 16:10:42 +0000 (11:10 -0500)] 
test: skip TEST-69-SHUTDOWN on ubuntu too

10 months agojournald: get rid of get_process_capeff(), use pidref_get_capability() instead 35403/head
Lennart Poettering [Tue, 17 Dec 2024 18:02:24 +0000 (19:02 +0100)] 
journald: get rid of get_process_capeff(), use pidref_get_capability() instead

This does pretty much the same, but is nicer, since it parses things
properly.

10 months agocapability-util: introduce capability_is_set() helper
Lennart Poettering [Tue, 17 Dec 2024 18:01:13 +0000 (19:01 +0100)] 
capability-util: introduce capability_is_set() helper

10 months agocapability-util: generalize helper to acquire local caps
Lennart Poettering [Thu, 28 Nov 2024 11:59:21 +0000 (12:59 +0100)] 
capability-util: generalize helper to acquire local caps

This generalizes and modernizes the code to acquire set of local caps,
based on the code for this in the condition logic. Uses PidRef, and
acquires the full quintuplet of caps.

This can be considered preparation to one day maybe build without
libcap.

10 months agoupdate TODO 35605/head
Lennart Poettering [Fri, 13 Dec 2024 18:52:33 +0000 (19:52 +0100)] 
update TODO

10 months agodoc: document new baseline requires memfd_create()
Lennart Poettering [Fri, 13 Dec 2024 18:08:16 +0000 (19:08 +0100)] 
doc: document new baseline requires memfd_create()

10 months agofuzz-journal-remote: use memfd_new_and_seal() where appropriate
Lennart Poettering [Mon, 16 Dec 2024 11:18:17 +0000 (12:18 +0100)] 
fuzz-journal-remote: use memfd_new_and_seal() where appropriate

This means we can drop memfd_new_and_map() and results in generally
shorter code.

10 months agopid1: drop check that ensures /run/ has plenty space before reexec/reload
Lennart Poettering [Mon, 16 Dec 2024 10:48:19 +0000 (11:48 +0100)] 
pid1: drop check that ensures /run/ has plenty space before reexec/reload

Now that we only support serialization into a memfd (rather than a file
in /run/) there's no point to check the free space in /run/. Let's drop it.

One error scenario gone. Yay.

10 months agomemfd-util: trivial modernizations
Lennart Poettering [Mon, 16 Dec 2024 10:32:07 +0000 (11:32 +0100)] 
memfd-util: trivial modernizations

10 months agoserialize: add explicit calls for finishing serialization
Lennart Poettering [Mon, 16 Dec 2024 10:29:52 +0000 (11:29 +0100)] 
serialize: add explicit calls for finishing serialization

These new calls will do three things:

1. in case of FILE* stuff: flush any pending bytes onto the fd, just in
   case
2. seal the backing memfd
3. seek back to the beginning.

Note that this adds sealing to serialization: once we serialized fully,
we'll seal the thing off for further modifications, before we pass the
fd over to the target process. This should add a bit of robustness, and
maybe finds a bug or two one day, if we accidentally write to a
serialization that is complete.

10 months agomemfd-util: introduce memfd_new_full() helper
Lennart Poettering [Mon, 16 Dec 2024 10:28:46 +0000 (11:28 +0100)] 
memfd-util: introduce memfd_new_full() helper

This is just like memfd_new(), but allows fine grained control of the
sealing flags.

This switches over all uses of memfd_new() where we actually want
sealing to use memfd_new_full().

This then allows use to use memfd_new() for two further calls, where we
previously used the more lowlevel memfd_create_wrapper().

10 months agomemfd-util: explain what memfd_create_wrapper() is for in a comment
Lennart Poettering [Mon, 16 Dec 2024 10:27:58 +0000 (11:27 +0100)] 
memfd-util: explain what memfd_create_wrapper() is for in a comment

10 months agomemfd-util: use TASK_COMM_LEN at one more place
Lennart Poettering [Mon, 16 Dec 2024 10:04:03 +0000 (11:04 +0100)] 
memfd-util: use TASK_COMM_LEN at one more place

Note this corrects the size of the array from 17 to 16, as the 16
already includes space for a trailing NUL.

10 months agosd-journal: drop memfd fallback
Lennart Poettering [Fri, 13 Dec 2024 18:05:41 +0000 (19:05 +0100)] 
sd-journal: drop memfd fallback

10 months agoserialize: drop memfd fallback when serializing
Lennart Poettering [Fri, 13 Dec 2024 17:59:15 +0000 (18:59 +0100)] 
serialize: drop memfd fallback when serializing

10 months agomemfd-util: short memfd_clone_fd()
Lennart Poettering [Fri, 13 Dec 2024 17:55:59 +0000 (18:55 +0100)] 
memfd-util: short memfd_clone_fd()

10 months agomemfd-util: simplify memfd_new_and_seal()
Lennart Poettering [Fri, 13 Dec 2024 17:55:00 +0000 (18:55 +0100)] 
memfd-util: simplify memfd_new_and_seal()

Let's use pwrite() to write the contents of the memfd. This has the
benefit of not moving the file offset, which means we don't have to
reset it after at all.

10 months agotree-wide: drop acquire_data_fd_full() helper
Lennart Poettering [Fri, 13 Dec 2024 17:51:34 +0000 (18:51 +0100)] 
tree-wide: drop acquire_data_fd_full() helper

Let's drop support systems lacking memfds, i.e. pre kernel 3.17 systems.
This allows us to drastically simplify the "data fd" concept, so far
that we can remove it entirely.

This replaces acquire_data_fd() with a specialized call to
memfd_new_and_seal(), not that memfds can be the only implementation of
the concept.

10 months agopam_systemd: introduce pam_get_data_many() helper and make use of it 35178/head
Lennart Poettering [Fri, 15 Nov 2024 14:23:41 +0000 (15:23 +0100)] 
pam_systemd: introduce pam_get_data_many() helper and make use of it

This is to pam_get_data() what pam_get_item() is to pam_get_item_many().

10 months agopam_systemd: fix error code confusion when prepping D-Bus message
Lennart Poettering [Fri, 15 Nov 2024 14:03:51 +0000 (15:03 +0100)] 
pam_systemd: fix error code confusion when prepping D-Bus message

We got confused by the error codes here, and sometimes return PAM errors
where the caller propagated them unconverted as negative errno errors. Fix that.

10 months agopam_systemd: split pam_sm_open_session() into more digestable blocks
Lennart Poettering [Fri, 15 Nov 2024 13:25:59 +0000 (14:25 +0100)] 
pam_systemd: split pam_sm_open_session() into more digestable blocks

Let's separate four different parts of pam_sm_open_session():

1. Acquiring of our various parameters from pam env, pam data, pam items
2. Mangling of that data to clean it up
3. Registering of the service with logind
4. Importing shell credentials into environment variables
5. Enforcement of user record data

This makes the code a lot more readable, and gets rid of an ugly goto
label.

It also corrects things: if step 3 doesnt work because logind is not
around, we'll now still do step 4, which we previously erroneously
skipped.

Besides that no real code changes.

10 months agopam_systemd: split out setting of shell env vars from credentials and move it later
Lennart Poettering [Fri, 15 Nov 2024 14:08:15 +0000 (15:08 +0100)] 
pam_systemd: split out setting of shell env vars from credentials and move it later

Let's shorten the code of pam_sm_open_session() a bit, and also make
sure the importing of the env vars from the creds also happens if the
session registration with logind is skipped.

10 months agopam_systemd: drop "uid" field from SessionContext
Lennart Poettering [Fri, 15 Nov 2024 13:39:11 +0000 (14:39 +0100)] 
pam_systemd: drop "uid" field from SessionContext

Let's instead just pass over the UserRecord, it's a much more useful
object with lots more information we'll sooner or later need
(preparation for later commits).

10 months agopam_systemd: drop "pid" field from SessionContext
Lennart Poettering [Fri, 15 Nov 2024 13:36:22 +0000 (14:36 +0100)] 
pam_systemd: drop "pid" field from SessionContext

We never use the field and this is not going to change...

This addresses a weird asymmetry, as create_session_message() always
went to the process' own PID when doing pidfds but otherwise (i.e.
without pidfds) would honour the PID specified as function parameter.

10 months agopam_systemd: normalize parsing of XDG_VTNR
Lennart Poettering [Fri, 15 Nov 2024 13:31:09 +0000 (14:31 +0100)] 
pam_systemd: normalize parsing of XDG_VTNR

Let's make it more like the parsing of the "incomplete" boolean env var,
to streamline things.

10 months agodiscover-image: modernize image discovery around O_PATH (#35513)
Lennart Poettering [Tue, 17 Dec 2024 16:39:59 +0000 (17:39 +0100)] 
discover-image: modernize image discovery around O_PATH (#35513)

let's always pin the image fd as early as we can, then derive all
properties off it, to have a consistent view on things.

10 months agotree-wide: remove support for kernels lacking ambient caps
Lennart Poettering [Thu, 12 Dec 2024 12:42:12 +0000 (13:42 +0100)] 
tree-wide: remove support for kernels lacking ambient caps

Let's bump the kernel baseline a bit to 4.3 and thus require ambient
caps.

This allows us to remove support for a variety of special casing, most
importantly the ExecStart=!! hack.

10 months agomachine: introduce io.systemd.Machine.{MapFrom, MapTo} methods (#35064)
Daan De Meyer [Tue, 17 Dec 2024 15:51:51 +0000 (16:51 +0100)] 
machine: introduce io.systemd.Machine.{MapFrom, MapTo} methods (#35064)

This PR introduces varlink's alternatives to the following DBus methods:
- MapFromMachineUser
- MapToMachineUser
- MapFromMachineGroup
- MapToMachineGroup

10 months agoboot: do not build test-hwids-section.c if ukify is disabled
Antonio Alvarez Feijoo [Tue, 17 Dec 2024 09:05:54 +0000 (10:05 +0100)] 
boot: do not build test-hwids-section.c if ukify is disabled

Otherwise the build fails:

```
[22/3075] Generating src/boot/test-hwids-section.c with a custom command (wrapped by meson to capture output)
FAILED: src/boot/test-hwids-section.c
/usr/bin/meson --internal exe --capture src/boot/test-hwids-section.c -- /usr/bin/python3.10 /mnt/work/systemd/upstream-fork/main/src/boot/generate-hwids-section.py /mnt/work/systemd/upstream-fork/main/src/boot/hwids
--- stderr ---
Traceback (most recent call last):
  File "/mnt/work/systemd/upstream-fork/main/src/boot/generate-hwids-section.py", line 12, in <module>
    import ukify
  File "/mnt/work/systemd/upstream-fork/main/src/boot/../ukify/ukify.py", line 61, in <module>
    import pefile  # type: ignore
ModuleNotFoundError: No module named 'pefile'
```

Follow-up for 640f8c3eb8dc21539500e92a5c69cdb6cbda3381

10 months agomachine: tests for io.systemd.Machine.{MapFrom, MapTo} methods 35064/head
Ivan Kruglov [Thu, 7 Nov 2024 10:09:14 +0000 (11:09 +0100)] 
machine: tests for io.systemd.Machine.{MapFrom, MapTo} methods

10 months agomachine: introduce io.systemd.Machine.{MapFrom, MapTo} methods
Ivan Kruglov [Thu, 7 Nov 2024 09:39:41 +0000 (10:39 +0100)] 
machine: introduce io.systemd.Machine.{MapFrom, MapTo} methods

10 months agodiscover-image: modernize image discovery around O_PATH 35513/head
Lennart Poettering [Mon, 9 Dec 2024 12:52:32 +0000 (13:52 +0100)] 
discover-image: modernize image discovery around O_PATH

let's always pin the image fd as early as we can, then derive all
properties off it, to have a consistent view on things.

10 months agodiscover-image: make sure quota logic works on O_PATH fds
Lennart Poettering [Mon, 9 Dec 2024 12:51:51 +0000 (13:51 +0100)] 
discover-image: make sure quota logic works on O_PATH fds

10 months agobtrfs-util: make sure btrfs_subvol_get_info_fd() works on O_PATH fds
Lennart Poettering [Mon, 9 Dec 2024 12:51:28 +0000 (13:51 +0100)] 
btrfs-util: make sure btrfs_subvol_get_info_fd() works on O_PATH fds

10 months agochattr-util: move O_PATH conversion from read_attr_at() to read_attr_fd()
Lennart Poettering [Mon, 9 Dec 2024 12:50:48 +0000 (13:50 +0100)] 
chattr-util: move O_PATH conversion from read_attr_at() to read_attr_fd()

10 months agoupdate TODO
Lennart Poettering [Tue, 17 Dec 2024 10:18:01 +0000 (11:18 +0100)] 
update TODO

10 months agotest: Add CHID matching test (#35532)
Yu Watanabe [Tue, 17 Dec 2024 04:21:04 +0000 (13:21 +0900)] 
test: Add CHID matching test (#35532)

10 months agocore: make ProtectHostname= optionally take a hostname (#35626)
Yu Watanabe [Tue, 17 Dec 2024 04:20:08 +0000 (13:20 +0900)] 
core: make ProtectHostname= optionally take a hostname (#35626)

Closes #35623.

10 months agosystemctl-edit: ignore ENOENT from unit_is_masked()
Yu Watanabe [Mon, 16 Dec 2024 03:37:17 +0000 (12:37 +0900)] 
systemctl-edit: ignore ENOENT from unit_is_masked()

If a specified unit does not exist, then it is definitely not masked.

Fixes #35632.

10 months agomeson: allow to customize the access mode for tty/pts devices
Yu Watanabe [Mon, 16 Dec 2024 02:50:53 +0000 (11:50 +0900)] 
meson: allow to customize the access mode for tty/pts devices

Then, switch the default value to "0600", due to general security
concerns about terminals being written to by other users.

Closing #35599.

10 months agonetworkd: show wireguard private key read error number
Lennart Poettering [Mon, 16 Dec 2024 16:19:59 +0000 (17:19 +0100)] 
networkd: show wireguard private key read error number

Noticed while looking at #35641

10 months agomkosi: temporarily disable panic_on_warn
Luca Boccassi [Mon, 16 Dec 2024 17:13:08 +0000 (17:13 +0000)] 
mkosi: temporarily disable panic_on_warn

Due to a BTRFS issue in kernel 6.12 (and backported in Ubuntu to 6.8)
there's a warning triggered by some tests, and it then causes a panic.

The BTRFS issue has a patch but it is not available in any distro yet,
so disable panic_on_warn until it reaches Arch and Ubuntu Noble. Bugs
have been filed.

10 months agotest: Add test-chid-match 35532/head
anonymix007 [Thu, 12 Dec 2024 17:32:24 +0000 (20:32 +0300)] 
test: Add test-chid-match