1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00
Commit Graph

64286 Commits

Author SHA1 Message Date
Lennart Poettering
4f65fbe990 generate-sym-test: search for missing symbols
This slightly extends the symbol file test and checks which symbols are
listed in one list but missing in the other. This is tremendously useful
to quickly determine which symbols wheren't exposed properly but should
have been.

(This is is implemented in pure C, no systemd helpers, to ensure we see
libsystemd.so API as any other tool would.)
2023-05-02 11:30:46 +02:00
Klaus
ab13274a19
docs: add correct pacman command (#27486)
The `pacman` command in order to install packages on Arch in the documentation is invalid.
This PR fixes the command.
2023-05-02 17:18:10 +08:00
Yu Watanabe
e94756c566 test: replace sleep with timeout
If the test environment is too slow, then sleeping 2 seconds may not be
sufficient.
2023-05-02 11:09:18 +02:00
Yu Watanabe
ecf82f74b6
Merge pull request #27455 from yuwata/test-lib-sym
test: check all public functions are listed in .sym file
2023-05-02 04:45:30 +09:00
Luca Boccassi
67713e37e6
Merge pull request #27442 from DaanDeMeyer/presets
mkosi: Switch to use mkosi presets with prebuilt initrds
2023-05-01 20:10:58 +01:00
Yu Watanabe
8e2449a5c9 test-network: add workaround for bug in iproute2 v6.2.0
Closes #27473.
2023-05-01 20:02:15 +02:00
Jan Janssen
669f16acf7 stub: Relocate kernels below 4G for EFI handover
Old kernels can fail to boot when they are located above the 4G
boundary even if they claim to support it.

Fixes: #27472
2023-05-01 19:08:12 +02:00
Jan Janssen
6fd3ee6916 boot: Fix EFI_SIZE_TO_PAGES macro 2023-05-01 19:08:12 +02:00
Daan De Meyer
d052cc8893 mkosi: Switch to use mkosi presets with prebuilt initrds
Instead of building the initrds for the mkosi images with dracut,
let's switch to using mkosi presets to build the initrd with mkosi
as well.

This commit splits up our single image build into three separate
mkosi presets:

1. The "base" preset. This image contains systemd and all its runtime
dependencies. The sole purpose of this image is to serve as a base image
for the initrd and the final image. It's also responsible for building
systemd from source with the build script. The results are installed into
the base image. Note that we install the systemd and udev packages into this
image as well to prevent package managers from overriding the systemd we built
from source with the distro packaged systemd if it's pulled in as a dependency
by another package from the initrd or final profiles.
2. The "initrd" preset. This image provides the initrd. It's trivial and does
nothing more than packaging the base image up as a zstd compressed initramfs and
adds /init and /etc/initrd-release symlinks to the image.
3. The "final" preset. This image builds on top of the base image and adds
a kernel and extra packages that are useful for testing and debugging.

We also split out the optional kernel build into a separate set of config files
that are only included if a kernel to build is actually provided.

Note that this commit doesn't really change anything about how mkosi is used.
The commands remain the same, except that mkosi will now build all the presets
in order. "mkosi summary" will show the summary of all the presets. "mkosi qemu,
boot, shell" will always boot the final preset. With "-f", all presets will be
built and the final one is booted. "-i" makes a cache of each preset.

The only thing to keep in mind is that specifying config via the mkosi CLI will
apply to each of the presets. e.g. any extra packages added with "-p" will be
installed in both the initrd and the final image. To apply local configuration
to a single preset, create a file 00-local.conf in
mkosi.presets/<profile>/mkosi.conf.d and put all the preset specific configuration
in there.
2023-05-01 15:39:50 +02:00
Daan De Meyer
d9081eb0ae meson: Search for find program
find is required by a few of the unit tests so let's make sure its
available when configuring the build.
2023-05-01 14:58:08 +02:00
Daan De Meyer
4d56d084d8 meson: Search for diff program
diff is required by a few of the unit tests so let's make sure its
available when configuring the build.
2023-05-01 14:58:08 +02:00
Yu Watanabe
5c519a56f5
Merge pull request #27458 from mrc0mmand/test-corrupted-journals
test: test journalctl with corrupted journals
2023-05-01 19:14:22 +09:00
Frantisek Sumsal
0f69a4e9ae test: test journalctl with corrupted journals
Last month I monkey-patched journald to produce a small (64K) but valid
journal and used that as an input to four AFL fuzzers. After a month it
generated quite a nice corpora (4738 test cases) and after filtering
and minimizing it I was left with 619 unique journals with various
levels of corruption that probe the journal code.

It seems to detect past issues like systemd#26567, etc.
2023-05-01 10:14:12 +02:00
Frantisek Sumsal
de965f4893 test: clean up the test script a bit 2023-05-01 15:47:04 +09:00
Yu Watanabe
a8fbcc0e3c sd-journal: introduce simple loop detection for entry array objects
If .next_entry_array_offset points to one of the previous entry or the
self entry, then the loop for entry array objects may run infinitely.
Let's assume that the offsets of each entry array object are in
increasing order, and check that in loop.

Fixes #27470.
2023-05-01 15:46:59 +09:00
Yu Watanabe
4c1b6e699f test: also test all _public_ functions are listed in .sym files
Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
2023-05-01 15:40:18 +09:00
Yu Watanabe
e758735d33 sd-journal: tighten variable scope 2023-05-01 14:25:38 +09:00
Yu Watanabe
d9b61db922 sd-journal: read entry array object again
Otherwise, the object may be invalidated by the previous call of
journal_file_move_to_object().
2023-05-01 14:25:38 +09:00
Yu Watanabe
b72fd2af86 sd-journal: check validity of object type more strictly
Otherwise, the object with invalid type may pass check_object_header()
when the requested type is OBJECT_UNUSED.
2023-05-01 14:25:38 +09:00
Yu Watanabe
3092eaa72e sd-journal: add _OBJECT_TYPE_INVALID as usual 2023-05-01 14:25:38 +09:00
Yu Watanabe
deb87cc80e sd-journal: align table 2023-05-01 14:25:38 +09:00
Yu Watanabe
5b895f56c6 sd-journal: check that the journal file is not stored in .newest_by_boot_id on free 2023-05-01 14:24:55 +09:00
Yu Watanabe
f11de491ca sd-journal: unset prioq index on failure
Otherwise, potentially, the assertion in
journal_file_unlink_newest_by_bood_id() will be triggered.
2023-05-01 14:24:55 +09:00
Yu Watanabe
e28d825127 sd-journal: fix use-after-free
As commented in the code, we need to replace the pointer to the key,
hence, hashmap_replace() must be used, instead of hashmap_update().

Fixes #27459.
2023-05-01 14:24:55 +09:00
Dan Streetman
9589824158 tpm2: move openssl-required ifdef code out of policy-building function 2023-05-01 00:52:28 +01:00
don bright
46b8c3f5b2
hwdb: add hardware rfkill key for Dell Latitude E6* models (#27462)
Hello

This pull req is adapting pull req #5772 (which fixed issue #5047), for the very similar computer Dell Latitude E6420 which has the same problem with the hardware switch to toggle wifi (aka rfkill). The symptom is the following repeated msgs in dmesg

[  309.010284] atkbd serio0: Use 'setkeycodes e008 <keycode>' to make it known.
[  309.016020] atkbd serio0: Unknown key pressed (translated set 2, code 0x88 on isa0060/serio0).

Adding this line to include E6 models causes these messages to stop showing in dmesg

Thank you
2023-04-30 11:33:13 +08:00
Brad Fitzpatrick
cd18d98349 man: clarify RoutingPolicyRule.TypeOfService docs 2023-04-30 04:30:35 +09:00
Yu Watanabe
ebd6384d57
Merge pull request #27461 from bluca/coredumpctl_completion
coredumpctl: fix bash completion
2023-04-30 04:28:45 +09:00
Luca Boccassi
448ed94dd9 coredumpctl: add --file/--root/--image to bash completion 2023-04-29 18:47:34 +01:00
Luca Boccassi
20ed583e35 coredumpctl: fix bash completion matching
When multi-word matching string is quoted, __contains_word compares
it as a whole to the passed option, so it doesn't work.
2023-04-29 18:47:34 +01:00
Frantisek Sumsal
992e06df08 test: make sure the test units have a test- prefix
So when collecting coverage the test-.service dropin works as
expected.

Follow-up to 969f5f3cea.
2023-04-29 16:59:08 +02:00
Frantisek Sumsal
edea0d6ac5 test: match all messages with the FILE field
As the systemd-pstore process is quite short lived, it might sometimes
lack the necessary metadata to make matching against a unit or a syslog
tag work. Since we already use a cursor file to make the matching window
small as possible, let's just drop the unit match completely and hope
for the best.

Resolves: #27453
2023-04-29 16:58:40 +02:00
Yu Watanabe
9857de4f1c libsystemd: add missing _public_ attributes 2023-04-29 21:25:12 +09:00
Yu Watanabe
9857bc4cea libsystemd: drop _public_ attribute for non-exported functions 2023-04-29 21:25:08 +09:00
Luca Boccassi
708d63c0e7
Merge pull request #27451 from yuwata/core-path-trigger-notify
core/path: do not install new job in .trigger_notify()
2023-04-29 12:35:24 +01:00
Yu Watanabe
8c59feed5e missing_fs: also define struct file_clone_range
Follow-up for b640e274a7.

Addresses b640e274a7 (r110996661).
2023-04-29 07:03:09 +02:00
Yu Watanabe
843cb225ad test: add tests for "systemctl stop" vs triggering by path unit 2023-04-29 09:10:28 +09:00
Yu Watanabe
2e701a7946 test: create temporary units under /run 2023-04-29 09:10:28 +09:00
Yu Watanabe
bc6377762c core/path: do not enqueue new job in .trigger_notify callback
Otherwise,
1. X.path triggered X.service, and the service has waiting start job,
2. systemctl stop X.service
3. the waiting start job is cancelled to install new stop job,
4. path_trigger_notify() is called, and may reinstall new start job,
5. the stop job cannot be installed, and triggeres assertion.

So, instead, let's add a defer event source, then enqueue the new start
job after the stop (or any other type) job finished.

Fixes https://github.com/systemd/systemd/issues/24577#issuecomment-1522628906.
2023-04-29 08:54:29 +09:00
Yu Watanabe
34a4e22e97 core/path: align table 2023-04-29 08:45:06 +09:00
Lennart Poettering
c23e9b6a64 pid1: unify implemenation of /run/ disk space safety check a bit
reload/reexec currently used a separate implementation of the /run/ disk
space check, different from the one used for switch-root, even though
the code is mostly the same. The one difference is that the former
checks are authoritative, the latter are just informational (that's
because refusing a reload/reexec is relatively benign, but refusing a
switch-root quite troublesome, since this code is entered when it's
already "too late" to turn turn back, i.e. when the preparatory
transaction to initiate the switch root are already fully executed.

Let's share some code, and unify codepaths.

(This is preparation for later addition of a "userspace reboot" concept)

No change in behaviour, just refactoring.
2023-04-28 23:27:20 +01:00
Lennart Poettering
5ae89ef347 core/systemctl: when switching root default to /sysroot/
We hardcode the path the initrd uses to prepare the final mount point at
so many places, let's also imply it in "systemctl switch-root" if not
specified.

This adds the fallback both to systemctl and to PID 1 (this is because
both to — different – checks on the path).
2023-04-28 23:26:20 +01:00
Daan De Meyer
77b7026668 libsystemd: Add missing memory pressure functions to public symbols 2023-04-28 21:19:38 +02:00
Mike Yuan
0102857b52
Merge pull request #27445 from poettering/reflink-fix
remove duplication reflink ioctl invocation
2023-04-29 01:33:21 +08:00
Lennart Poettering
4b7fda8731 systemctl: rework 'if' to 'switch' statement 2023-04-29 01:23:24 +08:00
Luca Boccassi
398d858d1c
Merge pull request #27437 from mrc0mmand/pstore
test: add a couple of tests for systemd-pstore
2023-04-28 16:14:09 +01:00
Lennart Poettering
535358ad2e copy: shortcut reflink_range() to reflink() in some cases 2023-04-28 15:16:30 +02:00
Lennart Poettering
427ad121c2 copy: don't call clone ioctls twice
The btrfs name and the generic name have the same values, hence there's
no point in bothering with the former.
2023-04-28 15:10:24 +02:00
Frantisek Sumsal
6858e32d73 test: add a couple of tests for systemd-pstore 2023-04-28 13:16:45 +02:00
Luca Boccassi
91010bd6cc
Merge pull request #27440 from yuwata/reflink-follow-ups
copy: follow ups for reflink()
2023-04-28 11:34:41 +01:00