Commit Graph
65961 Commits
Author SHA1 Message Date
Daan De Meyer 608aa606cf Merge pull request #28365 from DaanDeMeyer/udevadm-query
Various fixes and improvements
2023-07-12 21:48:04 +02:00
Daan De Meyer a9e536a6bc logs-show: Rename json_data to JsonData and add typedef 2023-07-12 20:05:20 +02:00
Daan De Meyer ee9d31a608 json: free array in json_variant_unref_many()
This allows using it with CLEANUP_ARRAY(). For the 2 call sites
where we don't need to free the array, we do a regular for loop
calling json_variant_unref() instead.
2023-07-12 20:05:20 +02:00
Daan De Meyer 2507731374 basic: Fix color + underline functions/macros
We currently concatenate ANSI_UNDERLINE to the color of our choice
in DEFINE_ANSI_FUNC_UNDERLINE() and DEFINE_ANSI_FUNC_UNDERLINE_256().
The first thing that ANSI_UNDERLINE does is reset all previous ansi
escape sequences, so you just get underlining without any colors.

Let's fix the issue by actually concatenating _UNDERLINE to the given
color macro name so this works properly.

Also add missing color macros that this uncovered.
2023-07-12 20:05:20 +02:00
Daan De Meyer a1af83728f device-util: Declare iterator variables inline 2023-07-12 20:05:18 +02:00
Mike Yuan 39939e7d02 core: refuse late merge only for anchor job when JOB_RESTART_DEPENDENCIES
Follow-up for 2a39b91459

The mentioned change makes all jobs in the transaction unmergeable
if mode == JOB_RESTART_DEPENDENCIES, but we only want the anchor job
to be re-enqueued.
2023-07-12 18:25:45 +02:00
Lennart Poettering 8620854aa1 Merge pull request #28344 from YHNdnzj/compare-device-node
hibernate-resume: add & use devnode_same to compare device nodes
2023-07-12 17:59:28 +02:00
Micah Abbott 2262cbf9fd docs: cleanups to ROOT_STORAGE_DAEMONS
There were a couple spelling/grammatical errors in the docs that made
it hard to read and understand parts of this doc. I cleaned up those
errors and reflowed the line breaks to keep to the 80 char limit.
2023-07-12 15:49:05 +01:00
Daan De Meyer 076deab75d mkosi: Make sure we build kernel headers
Required for building kernel selftests
2023-07-12 15:07:15 +01:00
Frantisek Sumsal c109cff9f9 test: copy out the necessary test data before we start overmounting stuff
Otherwise the get_testdata_dir() call fails if the source tree is under
/root (which is usually the case in CIs).

I got bitten by this after leaving the source tree under /root but moving the
$BUILD_DIR elsewhere. This used to work by accident, as load_testdata_env()
would try to read $BUILD_DIR/systemd-runtest.env, but would fail if the
$BUILD_DIR is also under /root and fall back to SYSTEMD_TEST_DATA
(/lib/systemd/tests/testdata), which usually exist as we install the just built
revision. However, if the $BUILD_DIR is outside of /root we'd read
$BUILD_DIR/systemd-runtest.env which contains
SYSTEMD_TEST_DATA=/path/to/source/tree/test and that source tree is not visible
once we overmount /root with tmpfs making the test fail:

/* test_run_tests_unprivileged */
Successfully forked off '(test-execute-unprivileged)' as PID 10672.
Changing mount flags / (MS_REMOUNT|MS_BIND "")...
Changing mount propagation / (MS_REC|MS_SHARED "")
Mounting tmpfs (tmpfs) on /dev/shm (MS_NOSUID|MS_NODEV "")...
Mounting tmpfs (tmpfs) on /root (MS_NOSUID|MS_NODEV "")...
Mounting tmpfs (tmpfs) on /tmp (MS_NOSUID|MS_NODEV "")...
Mounting tmpfs (tmpfs) on /var/tmp (MS_NOSUID|MS_NODEV "")...
Mounting tmpfs (tmpfs) on /var/lib (MS_NOSUID|MS_NODEV "")...
Mounting tmpfs (tmpfs) on /run/test-execute-unit-dir (MS_NOSUID|MS_NODEV "")...
ERROR: $SYSTEMD_TEST_DATA directory [/root/systemd/test] not accessible: No such file or directory
Assertion 'get_testdata_dir("test-execute/", &unit_dir) >= 0' failed at src/test/test-execute.c:1306, function prepare_ns(). Aborting.
(test-execute-unprivileged) terminated by signal ABRT.
2023-07-12 11:37:21 +00:00
Frantisek Sumsal e15ad182dd test: actually mount / read-only 2023-07-12 11:37:21 +00:00
Yu Watanabe 627cdcc785 tree-wide: fix typos reported by Fossies Codespell report 2023-07-12 10:14:50 +09:00
Yu Watanabe 16a07ffc64 man: move <varlistentry> in <variablelist> 2023-07-12 10:03:43 +09:00
Lennart Poettering 738e807e40 import-creds: don't import creds from SMBIOS/qemu in confidential VMs 2023-07-11 15:24:01 +01:00
Mike Yuan 0281927686 hibernate-resume: use devnode_same to compare device nodes
Addresses https://github.com/systemd/systemd/pull/28321#discussion_r1257866179

When devnode_same() fails we only debug log about it, because
the device nodes might not have appeared by the time the generator
is run.

Fixes #28340
2023-07-11 18:04:22 +08:00
Mike Yuan 2d5c53fc34 shared/device-nodes: add devnode_same 2023-07-11 18:01:49 +08:00
Mike Yuan e3c9e09383 path-util: make path_equal_or_inode_same static inline
No functional change, just refactoring.
2023-07-11 18:01:49 +08:00
Yu Watanabe 26b682e816 seccomp: add arm_fadvise64_64 to system-service group
fadvise64 and fadvise64_64 are already in the group, but arm_ version
was not.

Fixes #28350.
2023-07-11 11:54:09 +02:00
Lennart Poettering 08617bb2d9 Merge pull request #28348 from YHNdnzj/async-close-waitpid
shared/async: don't use WEXITED for waitpid()
2023-07-11 11:53:03 +02:00
Mike Yuan 898f4da326 shared/async: don't use WEXITED for waitpid()
Follow-up for c26d7837bb

waitpid() doesn't support WEXITED and returns -1 (EINVAL),
which results in the intermediate close process not getting
reaped.

Fixes https://github.com/systemd/systemd/issues/26744#issuecomment-1628240782
2023-07-11 12:08:09 +08:00
Mike Yuan f7b1d37c77 shared/async: prefix process name with sd- 2023-07-11 12:08:09 +08:00
Yu Watanabe 4b3b330a32 Merge pull request #28343 from poettering/daemon-reload-common
tree-wide: add common implementation of Reload() bus call to PID 1
2023-07-11 08:42:19 +09:00
Daan De Meyer 05dc415015 Merge pull request #28333 from DaanDeMeyer/tpm-support-dlopen
tpm2-util: Only assume system support if we can dlopen() the tpm libraries
2023-07-10 18:14:17 +02:00
Lennart Poettering 0c13daee66 tree-wide: drop trailing newline from various log calls
We generate this implicitly, hence we generally don't include it
explicitly.
2023-07-10 16:40:30 +02:00
Lennart Poettering a93993584d bus-unit-util: add common code for reloading PID 1
We have this very similar code in various places, and it#s not entirely
obvious (since we want a prolonged timeout for the reload), hence unify
this at one place.
2023-07-10 16:39:16 +02:00
Luca Boccassi e290bdb77b test-fstab-generator: use test_env
When running from the build directory systemd-detect-virt might not be installed,
so tell meson to set up the PATH accordingly to point to the build directory.

Fixes https://github.com/systemd/systemd/issues/28316
2023-07-10 15:29:38 +01:00
Luca Boccassi d75ec33ed2 sd-gpt: add missing SD_GPT_*NATIVE* defines for mips/mips64/parisc
We already had the arch-specific UUIDs defined, but they were not wired up
2023-07-10 15:28:28 +01:00
Luca Boccassi 3891fe0f23 Merge pull request #28308 from bluca/casting
Fix compilation on mipsel, ia64 and x32
2023-07-10 15:27:13 +01:00
Frantisek Sumsal fab73dad84 test: reorder the machinectl signal tests
So the multiple-machines tests run last to avoid a race where the
checked signal would get ignored while the stub init is still processing
the previous signals:

[   17.380417] testsuite-13.sh[376]: + machinectl reboot long-running long-running long-running
[   17.389888] systemd-nspawn[495]: ++ touch /reboot
[   17.390904] testsuite-13.sh[376]: + rm -f /var/lib/machines/long-running/trap
[   17.393937] testsuite-13.sh[376]: + machinectl kill --signal=SIGTRAP --kill-whom=leader long-running
[   17.408905] testsuite-13.sh[376]: + timeout 10 bash -c 'while ! test -e /var/lib/machines/long-running/trap; do sleep .5; done'
[   27.413210] testsuite-13.sh[376]: + at_exit
...
[   27.993376] testsuite-13.sh[373]: + echo 'Subtest /usr/lib/systemd/tests/testdata/units/testsuite-13.machinectl.sh failed'
2023-07-10 15:26:32 +01:00
Daan De Meyer db1264a811 mkosi: Add tpm2-tools to the initrd
To provide tpm2_eventlog for PCR debugging.
2023-07-10 15:50:55 +02:00
Daan De Meyer 5fc97a5fde Merge pull request #28334 from DaanDeMeyer/network-generator
Network generator fixes
2023-07-10 15:49:42 +02:00
Daan De Meyer ed4a1e0b27 analyze-pcrs: Fix typo 2023-07-10 14:26:54 +02:00
Daan De Meyer 3393104984 tpm2-util: Check for dlopen() when calculating tpm2 support 2023-07-10 14:26:51 +02:00
Luca Boccassi 03b70f060f sleep: fix unused variable warning
log_level_ignored is used only inside the ifdef, so declare it there too
2023-07-10 11:39:35 +01:00
Luca Boccassi 840ac5cd1a process-util: use clone2 on ia64
glibc does not provide clone() on ia64, only clone2. But only as a
symbol in the shared library, there's no prototype in the gblic
headers, so we have to define it, copied from the manpage.
2023-07-10 11:39:35 +01:00
Luca Boccassi 5bf36ce524 Cast st_dev to dev_t when printing
st_dev is not the same as dev_t, and on O32 architectures like
mipsel it's an unsigned long, but dev_t is still unsigned long long,
so they don't match and compilation fails:

../src/journal/cat.c: In function ‘run’:
../src/basic/format-util.h:46:19: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
   46 | #  define DEV_FMT "%" PRIu64
      |                   ^~~
../src/journal/cat.c:168:34: note: in expansion of macro ‘DEV_FMT’
  168 |                 if (asprintf(&s, DEV_FMT ":" INO_FMT, st.st_dev, st.st_ino) < 0)
      |                                  ^~~~~~~
In file included from ../src/systemd/sd-journal.h:20,
                 from ../src/journal/cat.c:11:
/usr/include/inttypes.h:105:41: note: format string is defined here
  105 | # define PRIu64         __PRI64_PREFIX "u"
2023-07-10 11:39:15 +01:00
Daan De Meyer c9d85c2206 network-generator: Add missing umask(0022) 2023-07-10 12:30:35 +02:00
Daan De Meyer 8b24bcdfa8 network-generator: Add missing log_setup() 2023-07-10 12:30:15 +02:00
Jan Janssen 7ea44f1733 boot: Fix build for x32
When building on a x32 system we need to explicitly pass `-m64` to get
the right ABI as the kernel and EFI are still 64bit. For this to
actually work, a suitable multilib compiler, 32bit libc headers and
libgcc need to be installed (similar to ia32 builds on x86_64).
2023-07-10 11:09:28 +01:00
Luca Boccassi f692c4a6cf Print ssize_t as %zd
On some architectures (x32) ssize_t is int, not long int.

../src/basic/confidential-virt.c: In function ‘msr’:
../src/basic/confidential-virt.c:133:27: error: format ‘%ld’ expects argument of type ‘long int’, but argument 7 has type ‘ssize_t’ {aka ‘int’} [-Werror=format=]
  133 |                 log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134 |                           rv,
      |                           ~~
      |                           |
      |                           ssize_t {aka int}
../src/basic/log.h:214:86: note: in definition of macro ‘log_full_errno_zerook’
  214 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                                                                                      ^~~~~~~~~~~
../src/basic/log.h:242:28: note: in expansion of macro ‘log_full’
  242 | #define log_debug(...)     log_full(LOG_DEBUG,   __VA_ARGS__)
      |                            ^~~~~~~~
../src/basic/confidential-virt.c:133:17: note: in expansion of macro ‘log_debug’
  133 |                 log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
      |                 ^~~~~~~~~
../src/basic/confidential-virt.c:133:41: note: format string is defined here
  133 |                 log_debug("Short read %ld bytes from MSR device %s (index %" PRIu64 "), ignoring",
      |                                       ~~^
      |                                         |
      |                                         long int
      |                                       %d
2023-07-10 10:57:16 +01:00
Luca Boccassi e1819eb062 test: mount_option_supported() returns EAGAIN when new mount API is not supported
Don't fail test-mountpoint-util if we get EAGAIN as it's expected on old
kernels
2023-07-10 13:12:11 +09:00
Luca Boccassi 4729e84e01 efi: skip libefitest if 'bootloader' is explicitly set to false
On x32 efi_arch will be set as the kernel architecture is just x86_64,
but there's no userland support to build the EFI ABI. When -Dbootloader=false
is set, skip libefitest too.
2023-07-10 00:13:42 +01:00
Luca Boccassi fca5c720be Merge pull request #28321 from YHNdnzj/hibernate-resume-compare-dev
hibernate-resume: follow-ups
2023-07-10 00:13:08 +01:00
Mike Yuan 4427194292 hibernate-resume: compare device nodes using path_equal_or_inode_same
Follow-up for 9deeca1275
2023-07-10 00:54:13 +08:00
Mike Yuan ee1369d789 hibernate-resume: add missing newline to the generated unit 2023-07-10 00:35:31 +08:00
Mike Yuan c089af84c4 hibernate-resume: refuse resume if resume_offset= is set but not resume= 2023-07-09 12:13:16 +01:00
Mike Yuan 906682a1de coccinelle/take-fd: match for -EBADF instead of -1
Follow-up for 254d1313ae
2023-07-09 14:07:48 +09:00
Mike Yuan 49ddb4757b LICENSES/README.md: fix syntax 2023-07-08 22:33:53 +00:00
Xeonacid ca15fc4820 seccomp: add riscv_hwprobe to @default
This syscall is for probing hardware capabilities from userspace and should do no harm.
Added in https://github.com/torvalds/linux/commit/ea3de9ce8aa280c5175c835bd3e94a3a9b814b74
2023-07-09 02:26:51 +08:00
Mike Yuan 5b0bcea892 Merge pull request #28309 from weblate/weblate-systemd-master
Translations update from Fedora Weblate
2023-07-09 01:47:01 +08:00