Commit graph

61592 commits

Author SHA1 Message Date
Frantisek Sumsal 0969bb4246 packit: drop/replace deprecated directives 2022-12-15 21:48:49 +09:00
Daan De Meyer 640c02d529 repart: Fix integration test 2022-12-15 21:48:30 +09:00
Yu Watanabe cd07f6e8e9
Merge pull request #25224 from poettering/measure-append
add --append= switch to systemd-measure
2022-12-15 21:47:29 +09:00
Yu Watanabe f4128c8d51
Merge pull request #25735 from yuwata/switch-root-follow-ups
mount-util: several follow-ups for recent mount_switch_root() changes
2022-12-15 21:39:40 +09:00
mvzlb 109197df7a
hwdb: Fix mount matrix for CSL Panther Tab HD (#25752)
Commit a76d7aca sets ACCEL_MOUNT_MATRIX to match the device's casing
(landscape) instead of the LCD panel (portrait).
2022-12-15 19:59:14 +09:00
Lennart Poettering c0e42509da update TODO 2022-12-15 11:40:21 +01:00
Lennart Poettering 6b41e0250f test: add integration test for systemd-measure --append= 2022-12-15 11:40:21 +01:00
Lennart Poettering a5c690a8b5 measure: add --append= switch for merging signatures
Often it's useful to add multiple signatures in the signature JSON file
to embedd in a single .pcrsig. (For example, a signature by key X for
boot phase "enter-initrd" and one by key Y for
"enter-initrd:leave-initrd" or so). Make this easy, by adding the
ability to append signatures to a previously generated JSON file.
2022-12-15 11:40:21 +01:00
Lennart Poettering 3bb326c558 json: add helper for adding variant to array suppressing duplicates 2022-12-15 11:39:57 +01:00
Lennart Poettering c68523e00d
Merge pull request #25350 from poettering/efi-guid-equal
efi: add efi_guid_equal() helper
2022-12-15 10:24:58 +01:00
Yu Watanabe 62650f4258
Merge pull request #25602 from fbuihuu/fix-TEST-73-LOCALE
localed: reload PID1 configuration after modifying /etc/locale.conf
2022-12-15 17:47:05 +09:00
Daan De Meyer 5c33b68652 repart: Rework Minimize= option settings
Instead of having Minimize= take a boolean let's allow for two
different ways to enable it. "best" means we want the most minimal
image possible, which currently is only possible for read-only
filesystems but can be extended in the future with bisection
to find the most minimal possible size.

We also add "guess", which is the current behavior, where we
populate once and use the sparse size to make a reasonable guess
on a size that fits all the sources without needing to O(log(n))
tries to find the most minimal size.
2022-12-15 15:09:09 +09:00
Yu Watanabe 9d50f8508b mount-util: make mount_switch_root() take a mount propagation flag 2022-12-15 14:17:22 +09:00
Yu Watanabe edac5c4636 mountpoint-util: introduce mount_propagation_flag_is_valid() 2022-12-15 14:15:59 +09:00
Yu Watanabe b205e59ad4 mountpoint-util: rename mount_propagation_flags_to_string() and friends as singular 2022-12-15 14:15:55 +09:00
Yu Watanabe 6c6eb219d5 mount-util: mount flag is unsigned long 2022-12-15 14:15:09 +09:00
Yu Watanabe b8b4f80a8a mount-util: drop unnecessary inline attributes 2022-12-15 14:15:09 +09:00
Yu Watanabe 993681def8
Merge pull request #25743 from yuwata/timesync-ipv6
timesync: ignore IPv6 addresses when the kernel does not support it
2022-12-15 12:57:54 +09:00
Zbigniew Jędrzejewski-Szmek 7a14db9cfd basic: do not output emojis if not on a proper terminal
$TERM would generally be set if we're connected to a proper graphical terminal
emulator. In all other cases, in particular if $TERM is not set, we almost
certainly are not connected to something that can output emojis. In particular
the text console is unlikely to ever do it correctly.

So let's invert the check, and only write emojis if $TERM is set.

Fixes #25521.
2022-12-15 12:56:03 +09:00
Yu Watanabe 60e84f0205
Merge pull request #25732 from enr0n/unit-test-machine-id-initialized
unit tests: do not fail when `/etc/machine-id` is empty
2022-12-15 12:55:04 +09:00
Yu Watanabe a6e16d949c
Merge pull request #25723 from keszybz/generators-tmp
Run generators with / ro and /tmp mounted
2022-12-15 12:53:49 +09:00
Yu Watanabe 1af1c95e30
Merge pull request #25693 from yuwata/binfmt
binfmt: several cleanups
2022-12-15 12:52:30 +09:00
Zbigniew Jędrzejewski-Szmek 750c605614 pam: actually align the columns
In 9efb224443 was supposed to align
them, but for some reason I just added a second space everywhere.
2022-12-15 00:11:11 +01:00
Mike Yuan 8f23229cae systemctl: is-enabled: document the return code change
Follow-up for #25689

We've added a new output ("not-found") in #25689.
2022-12-14 23:21:06 +01:00
Zbigniew Jędrzejewski-Szmek c41fff1e08 fstab-generator: use log message that matches reality
We *assume* that when /sys is read-only, we're running in a container. But
there can other reasons, for example root is mount ro and nobody has mounted
/sys yet, or somebody forgot to add /sys to the list of filesystem not to
remount ro in a sandbox. So let's actually say what we know instead of assuming.

systemd-fstab-generator was reporting that it's running in a container and I
spent a good few minutes trying to figure out why 'systemd-detect-virt -c'
disagrees, before noticing that it's just checking a different condition.
2022-12-14 22:12:44 +01:00
Zbigniew Jędrzejewski-Szmek 9f563f2792 tree-wide: use mode=0nnn for mount option
This is an octal number. We used the 0 prefix in some places inconsistently.
The kernel always interprets in base-8, so this has no effect, but I think
it's nicer to use the 0 to remind the reader that this is not a decimal number.
2022-12-14 22:12:44 +01:00
Zbigniew Jędrzejewski-Szmek ca6ce62d2a manager: execute generators in a mount namespace "sandbox"
When generators are executed during early boot, /tmp might not be available
yet. This causes problems with bash, because here-docs don't work. Even
non-shell code can often assume that /tmp is available. This limitation is
known to trip up people, and when the code is tested on a "normal" system,
everything works.

We can solve this nicely, and get another small benefit, by making most of the
file system read-only and "punching holes" for some dirs that should be
writable. The generator code runs with full privileges and can do anything it
wants by writing appropriate systemd units, so it doesn't make much sense to do
any significant sandboxing around generators. But making root read-only is nice
because it can catch stupid mistakes where the generator tries to write to a
wrong path or something like that. We effectively also get a "private /tmp" for
the generators, which protects them against existing files in /tmp.

The path does the following:
when executing generators, we fork, and the child unshares root and makes
it recursively read-only, with the exception of /sys and /run. Error handling
is permissive — if some of this setup fails, we're in the same state as
before the patch.

Fixes #24430.
2022-12-14 22:12:44 +01:00
Zbigniew Jędrzejewski-Szmek 61ef30515b shared: add new safe_fork flag FORK_PRIVATE_TMP
If the flag is set, we mount /tmp/ in a way that is suitable for generators and
other quick jobs.

Unfortunately I had to move some code from shared/mount-util.c to
basic/mountpoint-util.c. The functions that are moved are very thin wrappers
around mount(2), so this doesn't actually change much in the code split between
libbasic and libshared.

Implications for the host would be weird if a private mount namespace is not
used, so assert on FORK_NEW_MOUNTNS when the flag is used.
2022-12-14 22:12:44 +01:00
Nick Rosbrook 3a9ca23036 journal: skip part of test-journal-interleaving if no machine-id exists
When executed on a systemd with an empty /etc/machine-id,
test-journal-interleaving fails in test_sequence_numbers_one() when
re-opening the existing "two.journal". This is because opening the
existing journal file with managed_journal_file_open() causes
journal_file_verify_header() to be called. This function tries to
compare the current machine-id to the machine-id in the journal file
header, but does not handle the case where the machine-id is empty or
non-existent.

Check if we have an initialized machine-id before executing this portion
of the test.
2022-12-14 13:58:12 -05:00
Nick Rosbrook 2c6b738bad test-load-fragment: simplify machine-id check 2022-12-14 13:58:12 -05:00
Nick Rosbrook a635b6279c test-unit-name: simplify machine-id check 2022-12-14 13:58:12 -05:00
Nick Rosbrook 079fcdd04f test-fs-util: skip part of test_chase_symlinks if machine-id is not initialized
The part of test_chase_symlink in test-fs-util that calls
sd_id128_get_machine will fail if /etc/machine-id is empty, so skip this
block if the machine-id is not initialized.
2022-12-14 13:58:12 -05:00
Nick Rosbrook 415eb50570 test-id128: simplify machine-id check
This also ensures that the test is skipped when /etc/machine-id exists,
but is not initialized.
2022-12-14 13:58:12 -05:00
Yu Watanabe f74a7cb45c unit: check more specific path to be written by systemd-binfmt
Follow-up for 41807efb15.
Replaces #25690.
2022-12-15 03:36:27 +09:00
Yu Watanabe 94ba5b1532 binfmt: check if binfmt is mounted before applying rules 2022-12-15 03:36:27 +09:00
Yu Watanabe 5aaa79ce96 binfmt-util: also check if binfmt is mounted in read-write 2022-12-15 03:36:24 +09:00
Yu Watanabe 713e6e631d timesync: ignore IPv6 addresses when the kernel does not support IPv6
Fixes #25728.
2022-12-15 03:30:13 +09:00
Yu Watanabe a51a9684c9 binfmt-util: split out binfmt_mounted()
No functional changes, just refactoring and preparation for later
commits.
2022-12-15 03:26:39 +09:00
Yu Watanabe dc1752ea72 stat-util: introduce fd_is_read_only_fs()
Then, reimplement path_is_read_only_fs() by the function to avoid race.
2022-12-15 03:25:09 +09:00
Lennart Poettering a04709c1ac efi: add common implementation for loop finding EFI configuration tables 2022-12-14 19:16:54 +01:00
Lennart Poettering 50b0b0d351 efi: add efi_guid_equal() helper 2022-12-14 19:16:54 +01:00
Lennart Poettering 5c6c587ce2
Merge pull request #25575 from brauner/nspawn.socket_surgery
nspawn: reduce number of sockets
2022-12-14 18:36:44 +01:00
Yu Watanabe 30a3181504
Merge pull request #25734 from yuwata/sd-id128
sd-id128: several followups
2022-12-15 02:23:03 +09:00
Felix Riemann 9b4e04f0cd timesync: Keep trying to connect even if the socket cannot be opened
This makes sure that after a server could not be contacted due to a
socket error, other (possibly working) NTP servers in the list of
configured NTP servers are (re-)tried.

Fixes #25728.
2022-12-15 02:21:25 +09:00
MVZ Ludwigsburg a76d7acae1 hwdb: Add mount matrix for CSL Panther Tab HD 2022-12-15 02:20:43 +09:00
Siddhesh Poyarekar 7929e180aa Use dummy allocator to make accesses defined as per standard
systemd uses malloc_usable_size() everywhere to use memory blocks
obtained through malloc, but that is abuse since the
malloc_usable_size() interface isn't meant for this kind of use, it is
for diagnostics only.  This is also why systemd behaviour is flaky when
built with _FORTIFY_SOURCE.

One way to make this more standard (and hence safer) is to, at every
malloc_usable_size() call, also 'reallocate' the block so that the
compiler can see the larger size.  This is done through a dummy
reallocator whose only purpose is to tell the compiler about the larger
usable size, it doesn't do any actual reallocation.

Florian Weimer pointed out that this doesn't solve the problem of an
allocator potentially growing usable size at will, which will break the
implicit assumption in systemd use that the value returned remains
constant as long as the object is valid.  The safest way to fix that is
for systemd to step away from using malloc_usable_size() like this.

Resolves #22801.
2022-12-14 17:49:47 +01:00
Yu Watanabe f0d8358c24 man: update documents for sd_id128_get_invocation() 2022-12-15 00:07:17 +09:00
Yu Watanabe 75fa1f25c0 sd-id128: also refuse an empty invocation ID 2022-12-15 00:07:17 +09:00
Yu Watanabe 786b652c89 sd-id128: allow sd_id128_get_machine() and friend to be called with NULL
It may be useful to check if the machine ID or friends is set or not.
2022-12-15 00:07:17 +09:00
Yu Watanabe e8a6625422 sd-id128: make sd_id128_get_machine() or friends return -EUCLEAN when an ID is in an invalid format
EINVAL suggests that the caller passes an invalid argument. EIO is
for "input/output error", i.e. the error you'd get if the disk or
file system is borked, and this error code could be returned by the
underlying read/write functions.

Let's make the functions return an unambiguous error code.
2022-12-15 00:07:13 +09:00