Commit Graph

84639 Commits

Author SHA1 Message Date
Yu Watanabe
a736d4ec9c oss-fuzz: install libcrypt-dev in i386 image
This is preparation for bumping base image of oss-fuzz to Ubuntu 24.04.

Closes #39395.

Co-authored-by: Evgeny Vereshchagin <evvers@ya.ru>
2025-11-10 10:45:42 +09:00
Yu Watanabe
e3ea1cfd5e tree-wide: add several missing includes
- test-reread-partition-table.c: sys/file.h for LOCK_EX
- coredump: unistd.h for STDIN_FILENO
2025-11-10 09:36:52 +09:00
Yu Watanabe
97ad10c9aa profile: skip setting PS0 when PROMPT_COMMAND= is cleared
Fixes #39639.
2025-11-10 06:05:15 +09:00
Maximilian Bosch
4dabc30050 service: setup credentials for ExecCondition
Closes #35788

This gives access to credentials within ExecCondition=. As described in
ticket #35788, I do have a use-case for this and as noted in the
commit that dropped this[1], this is OK to be revisited if there are
use-cases.

[1] a145623bc4
2025-11-10 05:27:00 +09:00
Yu Watanabe
96e5612d9f core/import-creds: trivial modernizations (#39652) 2025-11-10 05:26:37 +09:00
Mike Yuan
40054039e6 labeler: catch up with recent changes (#39653) 2025-11-09 20:25:45 +01:00
Mike Yuan
c2715eed58 labaler: add "shell profile" 2025-11-09 18:57:20 +01:00
Mike Yuan
dcb717a53a labeler: match per-user machined units too 2025-11-09 18:57:01 +01:00
Mike Yuan
4f7695fa21 labeler: be more specific when matching for "import" 2025-11-09 18:56:15 +01:00
Mike Yuan
63edae360f core/import-creds: use RET_GATHER 2025-11-09 18:46:37 +01:00
Mike Yuan
61e018dfad core/import-creds: use FOREACH_ARRAY at one more place 2025-11-09 18:46:37 +01:00
Mike Yuan
d0fcb614cb core/import-creds: rename import_credentials_context_free() to _done()
This is allocated on stack, hence rename as per our coding style.
While at it, make sure the struct name is consistent with funcs.
2025-11-09 18:46:36 +01:00
Yu Watanabe
445b7073c7 repart: Correctly handle btrfs compression (#39597)
systemd-repart is incorrectly choosing the loop-mount
code path to copy files after formatting, instead of using the --rootdir
path, which is required by mkfs.btrfs to apply compression (since it's
on files, not the fs).

So two fixes (and an integ test):

1. If Btrfs compression is requested without a root directory (e.g.,
Compression= without CopyFiles=), we now log a warning and skip the
--compress flag. This prevents the mkfs.btrfs failure, and it's
meaningless anyway without any files.
2. The logic in repart now uses the --rootdir code path whenever the
partition is btrfs and compression is requested. Otherwise it still
won't work even in the legitimate case because use the loop mounting
code, which is too late to use --compress.

Fixes: https://github.com/systemd/systemd/issues/39584
2025-11-10 01:52:19 +09:00
Chris Down
2091caddb8 test: Add integration test for btrfs compression in repart
Add testcase_btrfs_compression() to verify that btrfs partitions with
Compression= and CopyFiles= directives work correctly.

The test verifies the fix for issue #39584, where mkfs.btrfs would fail
with "ERROR: --compression must be used with --rootdir" when repart
tried to create compressed btrfs filesystems.

The test creates a partition definition with Format=btrfs,
Compression=zstd, and CopyFiles=, then validates:

1. systemd-repart output shows "Rootdir from:" and "Compress:",
   confirming that the --rootdir code path is used
2. mkfs.btrfs is invoked with both --compress and --rootdir options
3. The file is successfully copied to the filesystem
4. Compression is actually applied (verified via compsize output
   containing "zstd")
2025-11-09 21:14:22 +08:00
Yu Watanabe
b3c117172f bpf-compat: coding style cleanups 2025-11-09 18:13:44 +09:00
Yu Watanabe
7304557ea9 reread-partition-table: fix error code check
flock() sets EAGAIN rather than EBUSY when a node is already locked.

Follow-up for d8e38d4aaa.
Fixes #39544.
2025-11-09 18:12:38 +09:00
Yu Watanabe
0213b68969 libarchive-util: several cleanups
- use loop for checking existence of functions,
- rename HAVE_LIBARCHIVE_XYZ -> HAVE_ARCHIVE_XYZ to make them match with
  the function name,
- do not conditionally include user-util.h in libarchive-util.h,
- sort library function symbols.
2025-11-09 18:09:31 +09:00
Yu Watanabe
3519b73b70 meson: several cleanups (#39644) 2025-11-09 18:05:22 +09:00
Yu Watanabe
5123d9d38c meson: refuse to build when gcrypt support is enabled bu libgpg-error not found
Follow-up for 066e603ac6.
2025-11-09 09:21:19 +09:00
Yu Watanabe
242088e98b meson: drop redundant HAVE_ZLIB check
ENABLE_IMPORTD requires HAVE_ZLIB, and it is already checked at the very
beginning of the file.
2025-11-09 05:42:21 +09:00
Yu Watanabe
dee82ead3c README: align features after 'for' 2025-11-09 04:53:46 +09:00
Yu Watanabe
2202ba286d README: memory_hugetlb_accounting is since kernel v6.7
8cba9576df
2025-11-09 04:52:20 +09:00
Lennart Poettering
aae054e1ab nsresource: allow multiple userns from the same process in parallel
When generating a name for a transient userns automatically we so far
just included our PID to make it unique. That doens't really work if
multiple userns shall be kept in parallel by a single process. Let's hence
include a counter as well.
2025-11-08 18:32:37 +01:00
Lennart Poettering
14d9f58823 import: various smaller tweaks and fixes, preparation for OCI download support in importd (#39620) 2025-11-08 18:31:11 +01:00
Lennart Poettering
729e1f24c5 pull-job: port .payload field to struct iovec
struct iovec is really how we should encode any form of arbitrary blob
data
2025-11-08 09:28:50 +01:00
Lennart Poettering
33f49312f8 pull-job: use http_status_etag_exists() at a second place 2025-11-08 09:28:50 +01:00
Lennart Poettering
f56531c25c pull: there's no need to keep the downloaded image in memory, except for the sha256sums/gpg file
This seems to be a mistake, in place since the first commit: we only
want the downloaded data in memory if this is a sha256sums or gpg file,
which we need to prorcess ourselves.
2025-11-08 09:28:50 +01:00
Lennart Poettering
7aa847933f pull: use ASSERT_PTR() to shorten code a tiny bit 2025-11-08 09:28:50 +01:00
Lennart Poettering
5bba33f5e9 pull: now that PullJob can verify expected digests, let's rely on it for tar/raw pulling
Instead of authenticating the downloaded image explicity in the tar and
in the raw downloader, we can now rely on the checksum checking in the
generic PullJob code. Hence do so: drop tep the checksum field from
TarPull and RawPull, and just initialized the ->expected_checksum in the
relevant PullJob instead.
2025-11-08 09:28:50 +01:00
Lennart Poettering
6f16ab4893 pull-job: optionally store an expected checksum in PullJob object 2025-11-08 09:28:50 +01:00
Lennart Poettering
e825635af6 import: rework pull logic to store download digests in binary form rather than string
We generally want to store data in parsed form, not formatted form,
hence let's follow our own rules on this, and store the message digest
as "struct iovec" rather than as string. This is generally more
efficient and safer, simply because of case issues.
2025-11-08 09:28:50 +01:00
Lennart Poettering
cb1caab98e pull-job: optionally take expected content length and compare it with what we are downloading 2025-11-08 09:27:46 +01:00
Lennart Poettering
bf51a545a4 pull-job: always implicitly NUL terminate downloaded payload stored in memory
Just as a safety measure, let's always NUL terminate what we are
downloading, maybe future code will parse it as string, and is sloppy by
accident.

(We have similar logic in read_full_file(), and I think it's a really
good rule, to always implicitly NUL terminate blobs we acquire that
might very well be used as text later on)
2025-11-08 09:27:46 +01:00
Mike Yuan
f8293452b6 meson: drop dangling reference to gcrypt
... which was also a typo ;)

Follow-up for e9d4b88b81
2025-11-08 02:11:05 +01:00
Yu Watanabe
61fffbfa58 meson: sysupdate requires systemd-pull and friends
Fixes #39635.
2025-11-08 08:54:42 +09:00
Mike Yuan
89e74275ad core/execute: morph exec_output_is_* to _forward_to_*
Follow-up for 379d9ae222

After the commit, the functions are only used to determine
whether journals shall be forwarded to selected targets,
hence rename as such and remove effectively unused condition
on EXEC_OUTPUT_TTY.
2025-11-08 08:54:13 +09:00
Luca Boccassi
2db3e403ae test: rotate journal before invocation test
Occasionally there are truncated journals failing this test:

[  884.181701] H TEST-04-JOURNAL.sh[12104]: ++ journalctl --no-hostname -n 1 -t bash --invocation=fe8122a7d8eb42c7bf357ac5fafa95e1
[  884.181749] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1' 'Nov 06 17:27:10 bash[11985]: invocation 1 fe8122a7d8eb42c7bf357ac5fafa95e1'
[  884.181773] H TEST-04-JOURNAL.sh[12105]: + set +ex
[  884.181819] H TEST-04-JOURNAL.sh[12091]: + read -r idx invocation _
[  884.181819] H TEST-04-JOURNAL.sh[12091]: + i=2
[  884.181865] H TEST-04-JOURNAL.sh[12106]: ++ journalctl --no-hostname -n 1 -t bash --invocation=2 -u invocation-id-test-20992
[  884.181865] H TEST-04-JOURNAL.sh[12106]: Journal file /var/log/journal/936183a66e7c47939693ae37a967e4fd/system.journal is truncated, ignoring file.
[  884.181865] H TEST-04-JOURNAL.sh[12106]: No journal entry found for the invocation (+2).
[  884.181952] H TEST-04-JOURNAL.sh[12091]: + assert_in 'invocation 2 07d0bd6b5c654b148541d798abccaa96' ''
[  884.181972] H TEST-04-JOURNAL.sh[12107]: + set +ex
[  884.181972] H TEST-04-JOURNAL.sh[12107]: FAIL: 'invocation 2 07d0bd6b5c654b148541d798abccaa96' not found in:

Rotate it at the beginning of the test case to try and avoid this.

Fixes https://github.com/systemd/systemd/issues/39601
2025-11-07 21:35:45 +00:00
Yu Watanabe
f0fdb69a8d core: assign TTY to PAM context when TTYPath= is specified
Fixes #38486 again, which was fixed by
1405d46bf9, but regressed again by
f875a8026e.

This also make it use exec_input_is_terminal().

Follow-up for f875a8026e.
2025-11-08 06:12:20 +09:00
Frantisek Sumsal
6d510012b7 test: move the system time to exactly the timer's elapse time
When we moved the time to 1 minute after the timer would've elapsed,
systemd could pick RandomizedDelaySec= <= 1 minute which would then
cause the timer to elapse immediately and the InactiveExitTimestamp=
to get recalculated including a new next elapse time that would be for
the next "window":

systemd[1]: timer-RandomizedDelaySec-30785.timer: Adding 3.634672s random time.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Realtime timer elapses at Fri 2025-11-07 00:10:03 UTC.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Timer elapsed.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Changed waiting -> running
systemd[1]: Found unit timer-RandomizedDelaySec-30785.timer at /run/systemd/system/timer-RandomizedDelaySec-30785.timer (regular file)
systemd[1]: Preset files say disable timer-RandomizedDelaySec-30785.timer.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Got notified about unit deactivation.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Adding 8h 39min 26.166418s random time.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Realtime timer elapses at Sat 2025-11-08 08:49:26 UTC.
systemd[1]: timer-RandomizedDelaySec-30785.timer: Changed running -> waiting
...
TEST-53-TIMER.sh[1008]: InactiveExitTimestamp=Thu 2025-11-06 23:00:00 UTC
TEST-53-TIMER.sh[1010]: ++ systemctl show -P NextElapseUSecRealtime timer-RandomizedDelaySec-30785.timer
TEST-53-TIMER.sh[905]: + NEXT_ELAPSE_REALTIME='Sat 2025-11-08 08:49:26 UTC'
TEST-53-TIMER.sh[1011]: ++ date '--date=Sat 2025-11-08 08:49:26 UTC' +%s
TEST-53-TIMER.sh[905]: + NEXT_ELAPSE_REALTIME_S=1762591766
TEST-53-TIMER.sh[905]: + : 'Next elapse timestamp should be Fri 2025-11-07 00:10:00 UTC <= Sat 2025-11-08 08:49:26 UTC <= Fri 2025-11-07 22:10:00 UTC'
TEST-53-TIMER.sh[905]: + assert_ge 1762591766 1762474200
TEST-53-TIMER.sh[1012]: + set +ex
TEST-53-TIMER.sh[905]: + assert_le 1762591766 1762553400
TEST-53-TIMER.sh[1013]: + set +ex
TEST-53-TIMER.sh[1013]: FAIL: '1762591766' > '1762553400'

Technically, the race is still there, but the window for it should be
_much_ smaller now (< 1s on a reasonably fast system). Let's hope that's
enough.

Resolves: #39594
2025-11-07 20:04:59 +00:00
Yu Watanabe
9d6c34a297 network: fix typo
Follow-up for dd2934d44e.
2025-11-08 04:27:57 +09:00
Luca Boccassi
057fe0a6ca NEWS: announce RootImageOptions= et al. incompatible changes 2025-11-08 03:24:47 +09:00
Yu Watanabe
7547c3e06a core/exec-invoke: pass the correct pid (1) to processes in pidns (#39575) 2025-11-08 02:41:14 +09:00
Yu Watanabe
88f6611260 tar-util: make sure we can unpack hardlinked symlinks (#39619) 2025-11-08 00:08:44 +09:00
Anton Tiurin
dd2934d44e network: expose Describe Varlink, use for networkctl list & status
Both `list` and `status` with `--json=pretty|short` show the description.
It is fetched via D-Bus by org.freedesktop.network1.Manager.Describe

This change exposes the same data via Varlink API `io.systemd.Network.Describe`
and migrates networkctl list and status commands to use Varlink API.

Update GetStates IDL to use enums for link states.
2025-11-08 00:08:00 +09:00
Zbigniew Jędrzejewski-Szmek
7240ec54ea Fixes for the OSC prompt script (#39588) 2025-11-07 14:53:13 +01:00
Zbigniew Jędrzejewski-Szmek
705e2ef194 profile/osc-context: move and extend check for TERM=dumb
Let's do the check early and skip most of the file if appropriate. Also, treat
missing $TERM same as "dumb". We're almost certainly at a dump terminal in that
case.
2025-11-07 14:47:49 +01:00
Francesco Valla
840549989f modules-load: implement parallel module loading
Load modules in parallel using a pool of worker threads. The number of
threads is equal to the number of CPUs, with a maximum of 16 (to avoid
too many threads being started during boot on systems with many an high
core count, since the number of modules loaded on boot is usually on
the small side).

The number of threads can optionally be specified manually using the
SYSTEMD_MODULES_LOAD_NUM_THREADS environment variable; in this case,
no limit is enforced. If SYSTEMD_MODULES_LOAD_NUM_THREADS is set to 0,
probing happens sequentially.

Co-authored-by: Eric Curtin <ecurtin@redhat.com>
2025-11-07 14:12:56 +01:00
jouyouyun
df79e5b97e pcrextend: fix wrong format in log
`name` is string type, should use `%s` replace `%u`
2025-11-07 14:08:35 +01:00
Lennart Poettering
36e10dc5a5 tar-util: make sure we can unpack hardlinked symlinks
This is something ostree does. Yuck. But let's make t work.
2025-11-07 14:04:36 +01:00
Lennart Poettering
0ab316ff14 chase: fix typo in log message
(While we are at it, add quotes around user provided strings)
2025-11-07 14:04:19 +01:00