Commit Graph
65513 Commits
Author SHA1 Message Date
Yu Watanabe c20d291416 meson: fix test dependency
Follow-up for daf4e78e48.
2023-06-22 14:37:45 +09:00
Yu Watanabe 1782534bb1 meson: shorten code a bit 2023-06-22 14:37:24 +09:00
Yu Watanabe e04e42312d meson: drop wrong and redundant assignment
Follow-up for b62ee354dd.
2023-06-22 14:20:32 +09:00
Yu Watanabe d37dee7450 meson: also build symbol tests for static-libsystemd=no-pic 2023-06-22 14:20:32 +09:00
Yu Watanabe 67b1c943cb meson: add dependency for udev runner to test 2023-06-22 14:20:32 +09:00
Yu Watanabe 50cf2032a0 sd-journal: verify journal file header in more detail
Fixes #27635.
2023-06-21 18:25:07 -06:00
Zbigniew Jędrzejewski-Szmek 27ccba2621 pam: add macro wrapper to make code shorter
The same pattern is repeated so many times that it seems worth making a
shorthand for it.

Follow-up for f71b55b510 and
2675747f3c.
2023-06-22 00:47:32 +01:00
Luca Boccassi 0b1e55a616 Merge pull request #28109 from mrc0mmand/more-journal-shenanigans
test: cover a couple of missed code paths in journalctl/journald
2023-06-22 00:46:06 +01:00
Ronan Pigott f24590df43 systemd-analyze: allow --quiet for condition checks
I figure these messages are rather unnecessary, so let the user quiet
them with the existing --quiet flag if desired. Makes systemd-analyze
condition a little more ergonomic in scripts.
2023-06-21 19:56:43 +01:00
Romain Geissler 21a2c735e2 elf-util: discard PT_LOAD segment early based on the start address.
Indeed when iterating over all the PT_LOAD segment of the core dump
while trying to look for the elf headers of a given module, we iterate
over them all and try to use the first one for which we can parse a
package metadata, but the start address is never taken into account,
so absolutely nothing guarantees we actually parse the right ELF header
of the right module we are currently iterating on.

This was tested like this:
 - Create a core dump using sleep on a fedora 37 container, with an
   explicit LD_PRELOAD of a library having a valid package metadata:

    podman run -t -i --rm -v $(pwd):$(pwd) -w $(pwd) fedora:37 bash -x -c \
        'LD_PRELOAD=libreadline.so.8 sleep 1000 & SLEEP_PID="$!" && sleep 1 && kill -11 "${SLEEP_PID}" && mv "core.${SLEEP_PID}" the-core'

 - Then from a fedora 38 container with systemd installed, the resulting
   core dump has been passed to systemd-coredump with and without this
   patch. Without this patch, we get:

       Module /usr/bin/sleep from rpm bash-5.2.15-3.fc38.x86_64
       Module /usr/lib64/libtinfo.so.6.3 from rpm coreutils-9.1-8.fc37.x86_64
       Module /usr/lib64/libc.so.6 from rpm coreutils-9.1-8.fc37.x86_64
       Module /usr/lib64/libreadline.so.8.2 from rpm coreutils-9.1-8.fc37.x86_64
       Module /usr/lib64/ld-linux-x86-64.so.2 from rpm coreutils-9.1-8.fc37.x86_64

   While with this patch we get:

       Module /usr/bin/sleep from rpm bash-5.2.15-3.fc38.x86_64
       Module /usr/lib64/libtinfo.so.6.3 from rpm ncurses-6.3-5.20220501.fc37.x86_64
       Module /usr/lib64/libreadline.so.8.2 from rpm readline-8.2-2.fc37.x86_64

So the parsed package metadata reported by systemd-coredump when the module
files are not found on the host (ie the case of crash inside a container) are
now correct. The inconsistency of the first module in the above example
(sleep is indeed not provided by the bash package) can be ignored as it
is a consequence of how this was tested.

In addition to this, this also fixes the performance issue of
systemd-coredump in case of the crashing process uses a large number of
shared libraries and having no package metadata, as reported in
https://sourceware.org/pipermail/elfutils-devel/2023q2/006225.html.
2023-06-21 19:07:20 +01:00
Daan De Meyer 33885343cf Merge pull request #27942 from DaanDeMeyer/root-ephemeral
core: Add RootEphemeral= setting
2023-06-21 17:24:39 +02:00
Frantisek Sumsal 51a05be9a2 test: cover a couple of missed code paths in journalctl/journald 2023-06-21 17:08:55 +02:00
Daan De Meyer cdad1f1407 test: Add RootEphemeral= integration test 2023-06-21 12:48:48 +02:00
Daan De Meyer d110169b65 test: Add touch into minimal verity test image 2023-06-21 12:48:48 +02:00
Daan De Meyer 9c0c670125 core: Add RootEphemeral= setting
This setting allows services to run in an ephemeral copy of the root
directory or root image. To make sure the ephemeral copies are always
cleaned up, we add a tmpfiles snippet to unconditionally clean up
/var/lib/systemd/ephemeral. To prevent in use ephemeral copies from
being cleaned up by tmpfiles, we use the newly added COPY_LOCK_BSD
and BTRFS_SNAPSHOT_LOCK_BSD flags to take a BSD lock on the ephemeral
copies which instruct tmpfiles to not touch those ephemeral copies as
long as the BSD lock is held.
2023-06-21 12:48:46 +02:00
Frantisek Sumsal 2411e990a4 journal-remote: fix typo in an error message 2023-06-21 11:09:12 +02:00
Zbigniew Jędrzejewski-Szmek 8a38b62f37 meson: update man rules
Fixup for 403082602d.
2023-06-21 07:29:23 +02:00
Zbigniew Jędrzejewski-Szmek c7d56f04fc Merge pull request #28079 from Geass-LL/comment
basic/env-file: also change to state PRE_KEY if we see NEWLINE in sta…
2023-06-21 01:40:36 +02:00
Luca Boccassi 01a6510a62 Merge pull request #28082 from mrc0mmand/more-journal-remote-tests
test: add a couple of tests for systemd-journal-{remote,upload}
2023-06-20 23:38:24 +01:00
Lennart Poettering 3a2077b295 Merge pull request #28095 from poettering/generic-valid-version
make version_is_valid() generic
2023-06-20 21:37:46 +02:00
Lennart Poettering e83fbf4b2a stat-util: add missing S_IFLNK entry in inode_type_to_string()
No idea what happened here, but it's a glaring omission.
2023-06-20 19:10:32 +01:00
Lennart Poettering ffe5aba60c analyze: also check for version string validity
It's highly interesting to see if tools such as systemd-sysupdate
consider a version valid, hence let's output that too (though
gracefully, not fatally)
2023-06-20 19:02:31 +02:00
Lennart Poettering f5c6b4f4d9 string-util: move version_is_valid() into generic code
While we are at it, replace the sloppy use of filename_is_valid() by the
less sloppy filename_part_is_valid() (as added by the preceeding
commit), since we don#t want to be too restrictive here. (After all,
version strings invalid as standalone filenames might be valid as part
of filenames, and hence we should allow them).
2023-06-20 19:02:31 +02:00
Lennart Poettering ec926463c0 path-util: split filename_is_valid() in two
Add a helper filename_part_is_valid() which does half of what
filename_is_valid() does: it checks for valid chars and length, but does
not filter out ".", ".." and "", as these are OK as parts of filenames,
just not alone.
2023-06-20 18:45:01 +02:00
Juno Computers 4687f001e6 hwdb: add support for Jun Tab2/Dere T11 to 60-sensor.hwdb (#28092) 2023-06-20 18:41:47 +02:00
Lennart Poettering 2b5eff67f5 hostnamectl: show age of firmware as time span, too
This converts the date into a relative timespan from the current time
on, and outputs it. It marks it yellow if older than two years, since
old firmware is probably a security risk. We don't make it red, since we
don't know though.
2023-06-20 18:40:30 +02:00
Lennart Poettering 4c834779cd Merge pull request #28080 from poettering/dmi-fixes
fix udev DMI rules – make sure hostnamectl shows correct hw info even after device trigger
2023-06-20 18:40:08 +02:00
Lennart Poettering d39d9348d3 Merge pull request #28089 from poettering/sleep-cleanups
sleep-config: various clean-ups
2023-06-20 18:39:49 +02:00
Lennart Poettering 574e5df9ae Merge pull request #28087 from poettering/transaction-flags
transaction: change four boolean funciton parameters into a single flags parameter
2023-06-20 16:21:05 +02:00
Frantisek Sumsal e43e60992e test: add a couple of tests for systemd-journal-{remote,upload} 2023-06-20 15:31:22 +02:00
Daan De Meyer dbc3cc8b83 tmpfiles: Add note to man page about guaranteed cleanup for files/directories 2023-06-20 15:22:47 +02:00
Daan De Meyer 08c25eee34 tmpfiles: Don't log about harmless errors when trying to lock file
Let's make sure we don't log if the file is a symlink or does not
exist.
2023-06-20 15:22:47 +02:00
Daan De Meyer b572e8da41 tmpfiles: Fix BSD lock logging messages 2023-06-20 15:22:47 +02:00
Daan De Meyer d31f8e0cb8 dissect-image: Log if verity signature partition is too large 2023-06-20 15:22:47 +02:00
Daan De Meyer 66130f0a55 namespace: Load sidecar verity settings in apply_mount_namespace()
Let's reduce the argument count of setup_namespace() a bit by loading
the sidecar verity settings in apply_mount_namespace(). This will also
make it possible to pass file descriptors to the root image/directory
into setup_namespace() as before this wasn't possible because the
verity settings logic looks for sidecar files next to the
root image which requires the path to be available.
2023-06-20 15:22:47 +02:00
Daan De Meyer 1a5f67aba3 Merge pull request #27863 from DaanDeMeyer/copy-lock
Add helpers to lock a directory before copying into it
2023-06-20 15:22:24 +02:00
Lennart Poettering 7dad6de158 hostnamed: when parsing day/month of firmware date, force decimal parsing
safe_atou() by default determines the base from the prefix 0x, 0b, 0o
and for compat with just 0 for octal. This is not what we want here,
since the date components are padded with zeroes yet still decimal.
Hence force decimal parsing (and while we are at it, prohibit a couple
of unexpected decorations).

WIthout this we'd fail to parse any the 8th and 9th day of each months, as
well aus aug and september of every year, because these look like octal
numbers but cannot actually parsed as such.

Let's change the testcase to check for a date that exposes this
bheaviour.
2023-06-20 15:18:58 +02:00
Lennart Poettering c65c2f0aa6 rules: drop weird spaces 2023-06-20 15:04:31 +02:00
Lennart Poettering e7932afe1b hostnamed: don't read DMI data within a container
If we run in a container we should show info about the container, not
the host.
2023-06-20 15:04:31 +02:00
Lennart Poettering dafd65b150 rules: split out DMI related rules from udev-default.rules
The DMI rules where so far guarded by an ACTION=="add" rule, but that
doesn't really make sense for setting properties (only for setting
access modes/ownership of nodes).

Hence let's move this into its own file, that guards properly on
ACTION!="remove".

Before this change the hardware vendor/model info would be dropped
whenever the device was retriggered.
2023-06-20 14:44:36 +02:00
Lennart Poettering 459d84076f update TODO 2023-06-20 14:41:28 +02:00
Lennart Poettering 4014172a8b sleep: rename sleep-config.[ch] → sleep-util.[ch]
The file long ceased to be exclusively about configuration of the sleep
operation. It contains many many calls for other purposes, hence give it
a more generic name.
2023-06-20 14:18:52 +02:00
Lennart Poettering c1583ca16a sleep-config: reduce scope of DMI object path a bit
We need this in a single function only, hence move it there, and make it
a static field so that it has local scope.

While we are at it, rename s/readsize to buf/bufsize, to make
relationship clear. In particular as the data read is actually binary
and "s" hence a misnomer, since it suggests it was a string.
2023-06-20 14:16:28 +02:00
Daan De Meyer d54f60c2af btrfs-util: Add BTRFS_SNAPSHOT_LOCK_BSD
When making ephemeral snapshots of subvolumes whose cleanup depends on
whether they're locked or not, it's necessary to have the lock from the
very beginning, so let's support that with a new BTRFS_SNAPSHOT_LOCK_BSD
flag.
2023-06-20 13:42:41 +02:00
Lennart Poettering 8601ecbc7c sleep-config: rename .device field to .path
This has been badly named given the path doesn't refer to a device quite
likely, but to a path to a regular file. Hence let's be more precise
with naming.

(.device kinda suggests this was an sd_device object of sorts, but it
really isn't.)
2023-06-20 13:21:28 +02:00
Lennart Poettering 3595a9b7b8 sleep-config: don't use 'device_id' moniker for a dev_t entity
We usually call dev_t entities "devnum" or "devno". That's redundant
enough, let's not call this "device_id". In particular as that's
something else (in udev context).
2023-06-20 13:14:38 +02:00
Lennart Poettering 98034eb0ea sleep-config: pin swap device while operating via O_PATH 2023-06-20 13:14:38 +02:00
Lennart Poettering 1296b427a7 sleep-config: replace SwapEntry's .type field with a proper enum
Following our usual rule: let's parse this early into internal
representation, and stick to that. don't pass unparsed strings around
needlessly.
2023-06-20 13:14:06 +02:00
Lennart Poettering 08e0ed300a sleep-config: check if we operate on regular file in swap_device_to_device_id() in swap file code path
Similar to the previous commit: before we continue doing swap file
operations let's ensure this actually is a swap file.
2023-06-20 13:13:54 +02:00
Lennart Poettering 1cf78c8f78 sleep-config: replace useless fstat() by useful fd_verify_regular()
For some reason there was an fstat() call here whose results was
entirely ignored. Let's remove it. Let's add a call to
fd_verify_regular() instead, because this is a code path for swap files,
hence let's make sure we actually operate on a file, and nothing else.
2023-06-20 13:11:53 +02:00