Commit Graph
100 Commits
Author SHA1 Message Date
Yu WatanabeandEvgeny Vereshchagin 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
Yu Watanabe 96e5612d9f core/import-creds: trivial modernizations (#39652) 2025-11-10 05:26:37 +09: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
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
https://github.com/torvalds/linux/commit/8cba9576df601c384abd334a503c3f6e1e29eefb
2025-11-09 04:52:20 +09:00
Yu Watanabe 61fffbfa58 meson: sysupdate requires systemd-pull and friends
Fixes #39635.
2025-11-08 08:54:42 +09: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
Yu Watanabe 9d6c34a297 network: fix typo
Follow-up for dd2934d44e.
2025-11-08 04:27:57 +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
Yu Watanabe d8e38d4aaa reread-partition-table: trigger change events when we failed to lock device
Before aa47d8ade1, when we failed to lock
the device node, we simply trigger change events for the device and its
partitions. But the commit killed the fallback logic. Let's restore that.

Fixes #39544.
2025-11-07 16:35:44 +09:00
Yu Watanabe fe263e9302 logind: handle session leader termination during deserialization more gracefully (#39607)
Closes https://github.com/systemd/systemd/issues/39556
2025-11-07 16:35:32 +09:00
Yu Watanabe d1676fdfbd Two fixes for homectl (#39591) 2025-11-07 05:52:20 +09:00
Yu Watanabe 454ce42305 test-network: disable several more sandbox features when running with sanitizers
These settings also imply seccomp.
Hopefully fixes #39567.
2025-11-06 00:50:11 +09:00
Yu Watanabe da665b708a test-network: read default values from environment variables
Nowadays, the test script is run as a service, and no argument about
sanitizers are passed. Let's read them from the environment variables.
2025-11-06 00:22:17 +09:00
Yu Watanabe 3a2c46dfbe core/manager: small cleanups (#39562) 2025-11-05 21:17:54 +09:00
Yu Watanabe 5468cd269f tpm2-setup: fix typo
Follow-up for 8a6e77f1a8.
2025-11-05 18:18:49 +09:00
Yu Watanabe f91fd8d5a1 tar-util: fix typo
Follow-up for 4ded7f7a43.
2025-11-05 18:17:23 +09:00
Yu Watanabe 8457f2a395 TEST-64-UDEV-STORAGE: generate debugging logs
Let's see if it provides something useful for debugging issue #39544.
2025-11-05 05:16:48 +09:00
Yu Watanabe bb1c5449fb sd-dns-resolver: move header to src/systemd
This also adds missing license header.

Follow-up for ee2108dcd5.
2025-11-05 05:16:34 +09:00
Yu Watanabe 89040373dd libsystemd: drop unused header
Follow-up for 2dbf1c0f15.
2025-11-05 05:16:34 +09:00
Yu Watanabe 5963cdf498 tree-wide: add missing '#pragma once' 2025-11-05 05:16:34 +09:00
Yu Watanabe 71d64f0527 core/service: reload fixlets (#39376)
Fixes https://github.com/systemd/systemd/issues/37515
2025-11-05 02:54:38 +09:00
Yu Watanabe d954161f9b core/exec-invoke: gracefully handle lack of privilege for initgroups() in user mode (#39039)
Fixes #39038
2025-11-05 02:53:05 +09:00
Yu Watanabe cfc7fd426d sysext: Check for /etc/initrd-release in given --root= tree (#39473) 2025-11-05 02:51:25 +09:00
Yu Watanabe 82b6dc1a17 sd-json: accept NULL path in sd_json_parse_file_at() too, port one manual fdopen() to it (#39538) 2025-11-05 01:40:27 +09:00
Yu Watanabe c29e304562 Several OpenSSL related cleanups (#39455) 2025-11-02 17:21:51 +09:00
Yu Watanabe eeedea94da repart: fix typo
Follow-up for 15734190c7.
2025-11-02 17:03:03 +09:00
Yu Watanabe 4f589e8a50 resolvectl: fix typo
Follow-up for 7517e41a49.
2025-11-02 17:00:23 +09:00
Yu Watanabe b7d752a67e openssl-util: drop unnecessary functions when OpenSSL support is disabled 2025-11-02 16:07:46 +09:00
Yu Watanabe 84946f12b5 openssl-util: sort cleanup functions 2025-11-02 16:07:46 +09:00
Yu Watanabe c604b78b92 repart: drop OpenSSL specific logics when OpenSSL support is disabled 2025-11-02 16:07:46 +09:00
Yu Watanabe e3ae29ead7 repart: merge common conditions
No functional change, just refactoring.
2025-11-02 16:07:46 +09:00
Yu Watanabe 6e91c5d8ea repart: make sign_verity_roothash() take Context
No functional change, just refactoring.
2025-11-02 16:07:46 +09:00
Yu Watanabe 0158eabb01 repart: load x509 certificate and private key after Context is allocated
This splits out context_load_keys() from parse_argv().
No functional change, just refactoring.
2025-11-02 16:07:46 +09:00
Yu Watanabe 219a67c131 bootctl: return earlier when secure boot auto-enrollment is requested but OpenSSL support is disabled 2025-11-02 16:07:46 +09:00
Yu Watanabe 1b48b63b51 bootctl: move conditions into corresponding functions 2025-11-02 16:07:46 +09:00
Yu Watanabe 61d1f394cc openssl-util: drop unused fake type definitions when OpenSSL is disabled 2025-11-02 16:07:46 +09:00
Yu Watanabe 09ae1c8ade pe-binary: drop pe_hash() and friends when OpenSSL support is disabled
These three functions are currently only used by sbsign, which requires
OpenSSL. Moreover, pe_hash() and uki_hash() anyway do not work if
OpenSSL is disabled. Let's only declare them when OpenSSL support is
enabled.
2025-11-02 16:07:46 +09:00
Yu Watanabe ab9b3bec6a openssl-util: drop unused string_hashsum() and friends when OpenSSL is disabled 2025-11-02 16:07:46 +09:00
Yu Watanabe a47a403ca2 resolvectl: return earlier from openpgp command when OpenSSL support is disabled
When OpenSSL is disabled, string_hashsum_sha256()/_sha224() in
resolve_openpgp() will fail anyway. Let's return earlier.
2025-11-02 16:07:46 +09:00
Yu Watanabe a7807e66b7 coredump: several cleanups, modernizations, fixlets for corner cases (#39418) 2025-11-02 10:13:53 +09:00
Yu Watanabe ee3cd7890d Several cleanups for libcryptsetup dependency (#39452) 2025-11-02 08:07:15 +09:00
Yu Watanabe db1f63463a cryptsetup-util: sym_crypt_free() and friends are unused when libcryptsetup is disabled 2025-11-02 05:50:31 +09:00
Yu Watanabe 6afaa7fb3a cryptsetup-util: sort loaded function prototypes 2025-11-02 05:50:31 +09:00
Yu Watanabe f8c33b1274 libcryptsetup: drop several unnecessary checks for existences of functions by libcryptsetyp
The functions crypt_set_metadata_size() and friends are supported since
libcryptsetup-2.0.

This also merges checks for functions used for supporting libcryptsetup
plugins with others.
Moreover, check existence of one more function (crypt_logf) that is used in
libcryptsetup plugins.
2025-11-02 05:49:29 +09:00
Yu Watanabe 3cc3b469cc Ignore --now when systemctl enable is called in a chroot (#39456) 2025-11-02 04:48:53 +09:00
Yu Watanabe 7829c9cc48 discover-image: introduce bus_property_get_image_is_read_only() with BUS_DEFINE_PROPERTY_GET() macro
This also makes image_is_read_only() return bool.

Follow-up for ee327e086e.
2025-11-01 18:11:18 +09:00
Yu Watanabe cbd8a12bce Several cleanups around strv_extendf() (#39508) 2025-11-01 18:10:42 +09:00
Yu Watanabe 23fbaa463a analyze: add missing help entry
Follow-up for 0fe29d0672.
2025-10-31 21:03:16 +00:00
Yu Watanabe 9011b1cfc0 reread-partition-table: take exclusive lock when requested
Before aa47d8ade1, we took an exclusive lock
for the whole block device, but with the commit, a shared lock is taken.
That causes, during we requesting the kernel to reread partition table,
udev workers can process the block device or its partitions.

Let's make udev workers not process block devices during rereading
partition table again.

Follow-up for aa47d8ade1.
2025-10-31 17:12:44 +01:00
Yu Watanabe 154de15bdf vmspawn: replace strv_extendf() with strv_extend_joined() when concatenating strings 2025-11-01 00:59:41 +09:00
Yu Watanabe 323fafbb55 vmspawn: use strv_extendf() at one more place 2025-11-01 00:59:41 +09:00
Yu Watanabe 2b2b04d6d0 dns-rr: use strv_extendf() at one more place 2025-11-01 00:59:41 +09:00
Yu Watanabe bafbcd3b27 core/exec-invoke: use heap allocation to build environment variables
We sometimes forget to increase the size N_ENV_VARS. Let's use heap
allocation.
2025-11-01 00:59:41 +09:00
Yu Watanabe 19bbcd35d7 strv: introduce strv_extend_joined() and strv_extend_joined_with_size() 2025-11-01 00:59:36 +09:00
Yu Watanabe 69350ee3e3 string-util: introduce strextendv_with_separator() 2025-11-01 00:58:42 +09:00
Yu Watanabe 3c66f40262 strv: introduce strv_extendf_with_size() 2025-11-01 00:58:39 +09:00
Yu Watanabe 0885e4a6e7 Various --bind-user= fixes (#39498) 2025-10-31 20:43:54 +09:00
Yu Watanabe b1ba55a8a7 network: do not restart DHCPv4 client on stopping/restarting networkd
Follow-up for fc35a9f8d1 (v255).
Fixes #39299.
2025-10-31 17:59:22 +09:00
Yu Watanabe 3f9db926e4 network: propagate error in link_carrier_lost()
Follow-up for 07021ed4f5 (v258).
2025-10-31 17:33:58 +09:00
Yu Watanabe 404d9bfb62 mount-setup: Add memory_hugetlb_accounting to cgroupfs mount (#39486)
This mount option will count HugeTLB memory usage towards the cgroup’s
overall memory usage for the memory controller.

See
https://lore.kernel.org/all/20231006184629.155543-4-nphamcs@gmail.com/T/#u
for the patch introducing the new mount option.
2025-10-31 15:20:10 +09:00
Yu Watanabe b5d63191ca network/sysctl: logs when per-link IPMasquerade= setting changes the global IPv6Forwarding= setting
All other cases, settings on different interfaces are completely
independent. But IPMasquerade=yes on an interface enables the global
IPv6Forwarding= setting, and hence affects other interfaces.
Let's log about that.

Prompted by https://github.com/systemd/systemd/issues/39304#issuecomment-3430382233.
2025-10-30 14:58:16 +01:00
Yu Watanabe 6454fde83e TEST-07-PID1: wait for systemd-resolved being stopped
As 'systemctl stop' is called with --no-block, previously systemd-resolved
might not be stopped when 'resolvectl' is called, and the DBus connection
might be closed during the call:
```
TEST-07-PID1.sh[5643]: + systemctl stop --no-block systemd-resolved.service
TEST-07-PID1.sh[5643]: + resolvectl
TEST-07-PID1.sh[5732]: Failed to get global data: Remote peer disconnected
```

Follow-up for 8eefd0f4de.
Fixes https://github.com/systemd/systemd/pull/39388#issuecomment-3439277442.
2025-10-28 13:26:15 +00:00
Yu Watanabe 16e52afad2 man: handle leading/trailing/repeating whitespaces in anchor links (#39423)
So even if a <term> section contains newlines, we get a reasonable
anchor link to it.

Before:
```
<dt id="
  bind
  UNIT
  PATH
  [PATH]
"><span class="term">
...
<a class="headerlink" title="Permalink to this term" href="#%0A%20%20%20%20%20%20%20%20%20%20%20%20bind%0A%20%20%20%20%20%20%20%20%20%20%20%20UNIT%0A%20%20%20%20%20%20%20%20%20%20%20%20PATH%0A%20%20%20%20%20%20%20%20%20%20%20%20[PATH]%0A%20%20%20%20%20%20%20%20%20%20">¶</a>
```

After:
```
<dt id="bind UNIT PATH [PATH]"><span class="term">
...
<a class="headerlink" title="Permalink to this term" href="#bind%20UNIT%20PATH%20[PATH]">¶</a>
```

Resolves: https://github.com/systemd/systemd/issues/39196

---

The reverts are not strictly necessary here (as already pointed out in
https://github.com/systemd/systemd/pull/39154#issuecomment-3360118164)
but they were helpful in checking if the fix works as expected. I can
drop them if needed.
2025-10-28 15:28:54 +09:00
Yu Watanabe bdbd902606 logind: support deserializing session leader through pidfdid (#39440)
Fixes #39437
2025-10-28 15:28:09 +09:00
Yu Watanabe 84f3f30e72 udev-watch: allow to log from child process
Otherwise, it is hard to debug issues in reread_partition_table().

This also drop unnecessary FORK_RLIMIT_NOFILE_SAFE flag.
2025-10-28 15:22:21 +09:00
Yu Watanabe de438df275 coredump-send: do not forward when the service manager in container crashed
In that case, even if we forward coredump to the container namespace,
the socket unit will never triggered.
2025-10-28 14:31:41 +09:00
Yu Watanabe ab999c9280 coredump: enter mount namespace even when the crashed process is in the same PID namespace
Otherwise, we may not get stacktrace of the crashed process when it is
in running a mount namespace, especially when it is in a portable
service or service that uses RootImage=/RootDirectory=.
2025-10-28 14:31:41 +09:00
Yu Watanabe 91840f324e coredump-context: cache if the crashed process in the same PID namespace 2025-10-28 14:31:41 +09:00
Yu Watanabe 7df4841e94 coredump-context: several cleanups
- Renames Context to CoredumpContext.
- Renames enum meta_argv_t to MetadataField, and use the correct type at
  several pleaces, especially in loop.
- Parses argv (when invoked as kernel helper or with '--backtrace') or
  iov (when invoked through socket) and store values in the context.
  Previously we use the passed string as is, but let's make them in a
  type safe way.
- Stores received or built iovw in the context. Also store input fd and
  mountfs fd in the context.
- Introduces coredump_context_is_pid1() and _is_journald() helper
  functions.
- Adds COREDUMP_PIDFDID= field when the kernel passed pidfd of the
  crashed process.

No effective funtional change. Just refactoring.
2025-10-28 14:31:41 +09:00
Yu Watanabe d7755c9caf coredump: allow to control log level and so on via command line 2025-10-28 14:31:41 +09:00
Yu Watanabe 4d73712ef7 coredump: shortcut to start backtrace mode
When running as backtrace mode, it is not necessary to use kmsg, not
necessary to disable coredump from the command, and unexpectedly
passed file descriptors can be silently ignored.
2025-10-28 14:31:37 +09:00
Yu Watanabe e09543b87b coredump-config: several modernizations
- introduce CoredumpConfig object that stores all configuration
  parameters parsed from coredump.conf,
- use gperf to generate conf parser table,
- parse coredump.conf only when necessary: when systemd-coredump is
  invoked as kernel helper or by socket actiavation.
2025-10-28 14:29:22 +09:00
Yu Watanabe e772db52c3 core/exec-invoke: use strnpcpy() where appropriate (#39446) 2025-10-26 09:43:14 +09:00
Yu Watanabe f03b49b079 core/exec-invoke: relax restriction for process name length
Previously, we limit the length of process name by 8.
This relax the restriction then at least process comm or
program_invocation_name contains the untrucated process name.

Closes #38367.
2025-10-25 18:50:32 +02:00
Yu Watanabe 44b4caad6c test: extend start limit interval
As the modified service requires about ~10 seconds for stopping, the
service never hit the start limit even if we tried to restart the
service more than 5 times.

This also checks that the service is actually triggered by dbus method
call.

Follow-up for 8eefd0f4de.
2025-10-25 22:23:59 +09:00
Yu Watanabe 687bb9e2ce test: sort libraries in test-dlopen-so 2025-10-25 14:03:13 +09:00
Yu Watanabe 5e385fe16e locale: use include directory for libxkbcommon
To support the case the headers are installed at an unusual place.
2025-10-25 13:06:02 +09:00
Yu Watanabe 85fb6ad573 meson: add all 'cflags' dependencies to libshared
This should not change any behavior in most common setups.
But, may be useful when headers are installed at non-default places.
2025-10-25 12:52:23 +09:00
Yu Watanabe 910e3843fd pwquality: drop 'sym_' prefix from cleanup function
This also drops unnecessary symbols in header.
2025-10-25 11:54:21 +09:00
Yu Watanabe 7d7b1755e9 passwdqc: drop 'sym_' prefix from cleanup function
This also drops unnecessary symbols in header.
2025-10-25 11:53:41 +09:00
Yu Watanabe 56b52c00e3 qrcode-util: drop 'sym_' prefix from cleanup function 2025-10-25 11:45:20 +09:00
Yu Watanabe 63649394cc pcre2-util: drop trivial pattern_free() wrapper 2025-10-25 11:43:00 +09:00
Yu Watanabe 8aadb82966 pcre2-util: drop 'sym_' prefix from cleanup functions 2025-10-25 11:28:30 +09:00
Yu Watanabe 76afd4dc4a elf-util: drop 'sym_' prefix from cleanup function 2025-10-25 11:26:39 +09:00
Yu Watanabe 53dceb8a6d xkbcommon-util: drop 'sym_' prefix from cleanup functions 2025-10-25 11:25:41 +09:00
Yu Watanabe fc945d22d5 libarchive-util: drop 'sym_' prefix from cleanup functions 2025-10-25 11:25:19 +09:00
Yu Watanabe afb9b7c581 apparmor-util: drop 'sym_' prefix from cleanup functions 2025-10-25 11:21:12 +09:00
Yu Watanabe 78c86080ec compress: drop 'sym_' prefix from cleanup functions 2025-10-25 11:18:52 +09:00
Yu Watanabe 744d0e4422 pkcs11-util: drop 'sym_' prefix from cleanup functions 2025-10-25 11:15:05 +09:00
Yu Watanabe d0520b1ee7 module-util: drop 'sym_' prefix from cleanup functions 2025-10-25 11:12:16 +09:00