]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agotest: ensure ProtectProc=invisible retains host submounts 28144/head
Lennart Poettering [Fri, 23 Jun 2023 16:27:45 +0000 (18:27 +0200)] 
test: ensure ProtectProc=invisible retains host submounts

2 years agonamespace: when mounting new proc instance, bind mount submounts of source over
Lennart Poettering [Fri, 23 Jun 2023 15:50:39 +0000 (17:50 +0200)] 
namespace: when mounting new proc instance, bind mount submounts of source over

Fixes: #28059
2 years agomount-util: add helper that can bind mount submounts of one dir to another
Lennart Poettering [Fri, 23 Jun 2023 15:50:17 +0000 (17:50 +0200)] 
mount-util: add helper that can bind mount submounts of one dir to another

2 years agomount-util: don't claim maybe-uninitialized was false that is valid
Lennart Poettering [Fri, 23 Jun 2023 15:52:31 +0000 (17:52 +0200)] 
mount-util: don't claim maybe-uninitialized was false that is valid

2 years agotmpfile-util: drop spurious double newline
Lennart Poettering [Fri, 23 Jun 2023 15:49:36 +0000 (17:49 +0200)] 
tmpfile-util: drop spurious double newline

2 years agoman: fix references to gethostname/sethostname
Antonio Alvarez Feijoo [Fri, 23 Jun 2023 14:34:55 +0000 (16:34 +0200)] 
man: fix references to gethostname/sethostname

2 years agoupdate TODO
Lennart Poettering [Fri, 23 Jun 2023 13:23:09 +0000 (15:23 +0200)] 
update TODO

2 years agotree-wide: use https for the 0pointer.de doc links
Frantisek Sumsal [Fri, 23 Jun 2023 11:08:57 +0000 (13:08 +0200)] 
tree-wide: use https for the 0pointer.de doc links

2 years agoresolved: if ipv6 is off patch hostname→address query with unspec family to ipv4
Lennart Poettering [Thu, 22 Jun 2023 20:26:23 +0000 (22:26 +0200)] 
resolved: if ipv6 is off patch hostname→address query with unspec family to ipv4

If the client never specified the address family, and IPv6 is off in the
kernel, then look only for A, never for AAAA RRs.

Fixes: #23951
2 years agoMerge pull request #28123 from poettering/threads-no-more
Luca Boccassi [Fri, 23 Jun 2023 12:24:41 +0000 (13:24 +0100)] 
Merge pull request #28123 from poettering/threads-no-more

get rid of any threads in PID 1

2 years agoelf-util: check for overflow when computing end of core's PT_LOAD segments
Romain Geissler [Thu, 22 Jun 2023 16:05:18 +0000 (16:05 +0000)] 
elf-util: check for overflow when computing end of core's PT_LOAD segments

2 years agoMerge pull request #28127 from poettering/coredump-loop-read
Luca Boccassi [Fri, 23 Jun 2023 11:28:40 +0000 (12:28 +0100)] 
Merge pull request #28127 from poettering/coredump-loop-read

coredump: fixes with overly large coredumps

2 years agobasic: drop unused include 28123/head
Lennart Poettering [Thu, 22 Jun 2023 20:24:30 +0000 (22:24 +0200)] 
basic: drop unused include

2 years agoprocess-util: add simple wrapper around PR_SET_CHILD_SUBREAPER
Lennart Poettering [Thu, 22 Jun 2023 20:24:04 +0000 (22:24 +0200)] 
process-util: add simple wrapper around PR_SET_CHILD_SUBREAPER

Let's a simple helper that knows how to deal with PID == 1.

2 years agodocs: document threading situation in coding style
Lennart Poettering [Thu, 22 Jun 2023 09:53:16 +0000 (11:53 +0200)] 
docs: document threading situation in coding style

2 years agoasync: use FORK_DETACH for asynchronous syncs
Lennart Poettering [Thu, 22 Jun 2023 13:11:52 +0000 (15:11 +0200)] 
async: use FORK_DETACH for asynchronous syncs

To get proper "fire-and-forget" feeling we really want to make sure
noone has to reap the forked off process.

2 years agoasync: add explanatory comment
Lennart Poettering [Thu, 22 Jun 2023 13:09:50 +0000 (15:09 +0200)] 
async: add explanatory comment

2 years agoasync: drop the now unused asynchronous_job()
Lennart Poettering [Thu, 22 Jun 2023 10:04:46 +0000 (12:04 +0200)] 
async: drop the now unused asynchronous_job()

2 years agoasync: add generic implementation of asynchronous_rm_rf()
Lennart Poettering [Thu, 22 Jun 2023 09:55:59 +0000 (11:55 +0200)] 
async: add generic implementation of asynchronous_rm_rf()

This one doesn't use threads anymore. This is the last use of threads in
PID 1. Yay!

Fixes: #27287
2 years agoshared: move async.[ch] from src/basic/ → src/shared/
Lennart Poettering [Thu, 22 Jun 2023 09:54:51 +0000 (11:54 +0200)] 
shared: move async.[ch] from src/basic/ → src/shared/

That way we can later add an async wrapper for rm_rf() which is in
src/shared/, too.

2 years agoprocess-util: add FORK_DETACH flag for forking of detached child
Lennart Poettering [Thu, 22 Jun 2023 09:51:25 +0000 (11:51 +0200)] 
process-util: add FORK_DETACH flag for forking of detached child

A test for this is later added indirectly, via aynchronous_rm_rf() that
uses this and comes with a suitable test.

2 years agoautomont: rework expiry to use subprocess rather than thread
Lennart Poettering [Thu, 22 Jun 2023 08:57:31 +0000 (10:57 +0200)] 
automont: rework expiry to use subprocess rather than thread

One more step towards a thread-free PID1: let's do automount expiry in a
subprocess rather than a thread.

2 years agobasic: add comments about raw_clone() calls not supporting threads/malloc in child
Lennart Poettering [Thu, 22 Jun 2023 08:21:32 +0000 (10:21 +0200)] 
basic: add comments about raw_clone() calls not supporting threads/malloc in child

2 years agoasync: stop using threads for asynchronous_close()
Lennart Poettering [Thu, 22 Jun 2023 08:28:13 +0000 (10:28 +0200)] 
async: stop using threads for asynchronous_close()

Let's work towards PID1 being purely single threaded again. Let's rework
asynchronous_close() on top of clone() with CLONE_FILES (so that we
can manipulate PID1's fd table correctly).

One less use of pthread_create() in PID 1.

2 years agoprocess-util: add clone_with_nested_stack() helper
Lennart Poettering [Thu, 22 Jun 2023 08:27:17 +0000 (10:27 +0200)] 
process-util: add clone_with_nested_stack() helper

This wraps glibc's clone() but deals with the 'stack' parameter in a
sensible way. Only supports invocations without CLONE_VM, i.e. when
child is a CoW copy of parent.

2 years agoprocess-util: add helper that detects if we are a reaper process
Lennart Poettering [Thu, 22 Jun 2023 09:52:06 +0000 (11:52 +0200)] 
process-util: add helper that detects if we are a reaper process

2 years agoMerge pull request #28129 from poettering/userdb-ratelimit
Lennart Poettering [Fri, 23 Jun 2023 07:53:21 +0000 (09:53 +0200)] 
Merge pull request #28129 from poettering/userdb-ratelimit

userdbd: make sure we don't exit under pressure

2 years agoman: correct and extend JournalSizeMax= 28127/head
Lennart Poettering [Thu, 22 Jun 2023 15:10:14 +0000 (17:10 +0200)] 
man: correct and extend JournalSizeMax=

The man page claimed the default was 10M, but that's not true, it's
767M.

Also mention there's no point in increasing it further.

See: #26748

2 years agocoredump: clamp JournalSizeMax= to maximum journald would accept
Lennart Poettering [Thu, 22 Jun 2023 15:11:00 +0000 (17:11 +0200)] 
coredump: clamp JournalSizeMax= to maximum journald would accept

See: #26748

2 years agocoredump: use loop_read() for reading coredump into memory
Lennart Poettering [Thu, 22 Jun 2023 14:48:48 +0000 (16:48 +0200)] 
coredump: use loop_read() for reading coredump into memory

Fixes: #26748
2 years agotpm2-util: look for tpm2-pcr-signature.json directly in /.extra/
Lennart Poettering [Thu, 22 Jun 2023 14:26:15 +0000 (16:26 +0200)] 
tpm2-util: look for tpm2-pcr-signature.json directly in /.extra/

So far we relied on tmpfiles.d to copy tpm2-pcr-signature.json from
/.extra/ into /run/systemd/. This is racy however if cryptsetup runs too
early, and we cannot unconditionally run it after tmpfiles completed.

hence, let's teach cryptsetup to directly look for the file in /.extra/,
in order to simplify this, and remove the race. But do so only in the
initrd (as only there /.extra/ is a concept).

We generally prefer looking in /run/systemd/, since things are under
user control then. In the regular system we exclusively want that
userspace looks there.

Fixes: #26490
2 years agotree-wide: getpid() → getpid_cached()
Lennart Poettering [Mon, 10 Aug 2020 14:33:02 +0000 (16:33 +0200)] 
tree-wide: getpid() → getpid_cached()

This doesn't really matter, but let's be systematic and prefer
getpid_cached() in our codebase.

2 years agouserdbd: when we hit a flood of requests to start more workers, don't exit 28129/head
Lennart Poettering [Thu, 22 Jun 2023 16:51:34 +0000 (18:51 +0200)] 
userdbd: when we hit a flood of requests to start more workers, don't exit

Let's tweak what we do if we detect a flood of requests to start more
workers: if none of the workers ever sticks (i.e. the worker count is
zero) then let's just give up, as before.

Otherwise, let's just not start more workers for a while, and do so
again after a while. Thus spawning ofr workers will "cool off" for a
while.

Fixes: #27028
2 years agouserdbd: prefix parameters with their names more
Lennart Poettering [Thu, 22 Jun 2023 16:50:43 +0000 (18:50 +0200)] 
userdbd: prefix parameters with their names more

2 years agouserdbd: drastically raise ratelimit we apply on requests for more worker processes
Lennart Poettering [Thu, 22 Jun 2023 16:48:41 +0000 (18:48 +0200)] 
userdbd: drastically raise ratelimit we apply on requests for more worker processes

These requests might come in during lookup floods very quickly, since
multiple worker processes might detect that things should be scaled up
at the same time. Hence, let's substantially raise the limit so that it
doesn't get hit in real-life scenarios and acts more like a safety net.

2 years agomeson: merge two similar loops for unit files
Yu Watanabe [Fri, 16 Jun 2023 01:38:25 +0000 (10:38 +0900)] 
meson: merge two similar loops for unit files

This also merges two arrays units and in_units, and uses dictionary
for declaring units.

This also fixes the condition handling, that previously only two
conditions were handled and rests were ignored.

2 years agodocs: describe $TESTFUNCS briefly
Lennart Poettering [Thu, 22 Jun 2023 14:10:06 +0000 (16:10 +0200)] 
docs: describe $TESTFUNCS briefly

Follow-up for f1a83e41ae985bd17056b3a9fe285cc196358183

2 years agotests: teach tests boilerplate to run selected tests only
Lennart Poettering [Wed, 21 Jun 2023 13:02:59 +0000 (15:02 +0200)] 
tests: teach tests boilerplate to run selected tests only

sometimes its useful to only run a specific test (or multiple) instead
of all implemented in a test. Allow the test name(s) to be specified on the
in a $TESTFUNCS env var, separated by colons.

2 years agoMerge pull request #28104 from DaanDeMeyer/emergency-kexec-halt
Lennart Poettering [Thu, 22 Jun 2023 14:07:35 +0000 (16:07 +0200)] 
Merge pull request #28104 from DaanDeMeyer/emergency-kexec-halt

core: Add halt and kexec emergency actions

2 years agohwdb: Don't generate hwdb if no hwdb files are found
Daan De Meyer [Wed, 21 Jun 2023 11:17:01 +0000 (13:17 +0200)] 
hwdb: Don't generate hwdb if no hwdb files are found

2 years agocore: restrict ImportCredential= globbing
Lennart Poettering [Wed, 21 Jun 2023 08:53:24 +0000 (10:53 +0200)] 
core: restrict ImportCredential= globbing

Let's restrict how we apply credential globbing in ImportCredential=, so
that we have some flexibility in automatically extending the glob
expression with per-instance data eventually without getting into
conflict with the globbing parts.

In our current uses we only allow globbing at the end of the expression,
and this is a new, unreleased feature hence let's be restrictive on this
initially. We can still relax this later if we feel the need to after
all.

Fixes: #28022
2 years agopid1: use FORK_DEATHSIG where appropriate
Lennart Poettering [Thu, 22 Jun 2023 10:38:57 +0000 (12:38 +0200)] 
pid1: use FORK_DEATHSIG where appropriate

2 years agoman: correct reference to sd_id128_get_boot_app_specific
Jan Luebbe [Thu, 22 Jun 2023 10:59:33 +0000 (12:59 +0200)] 
man: correct reference to sd_id128_get_boot_app_specific

The function sd_id128_get_boot_app_specific is the app specific variant of
sd_id128_get_boot.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
2 years agoMerge pull request #28115 from yuwata/meson-tiny-fixes
Daan De Meyer [Thu, 22 Jun 2023 09:49:36 +0000 (11:49 +0200)] 
Merge pull request #28115 from yuwata/meson-tiny-fixes

meson: several tiny fixes

2 years agounits: Use built-in halt and kexec features instead of systemctl 28104/head
Daan De Meyer [Thu, 22 Jun 2023 09:33:18 +0000 (10:33 +0100)] 
units: Use built-in halt and kexec features instead of systemctl

2 years agocore: Add halt and kexec emergency actions
Daan De Meyer [Wed, 21 Jun 2023 09:59:27 +0000 (11:59 +0200)] 
core: Add halt and kexec emergency actions

Let's complete the picture by adding the missing halt and kexec
emergency actions.

2 years agosleep-util: mention that offset is in memory pages
Lennart Poettering [Thu, 22 Jun 2023 08:29:50 +0000 (10:29 +0200)] 
sleep-util: mention that offset is in memory pages

2 years agorpm: fix lua trigger priority for sysusers
Franck Bui [Wed, 21 Jun 2023 08:32:57 +0000 (10:32 +0200)] 
rpm: fix lua trigger priority for sysusers

Commit cd621954ed643c6ee0d869132293e26056a48826 probably forgot to fix the lua
implementation.

2 years agomeson: fix test dependency 28115/head
Yu Watanabe [Mon, 19 Jun 2023 23:20:12 +0000 (08:20 +0900)] 
meson: fix test dependency

Follow-up for daf4e78e4841a527ba62da48fd00e2e6b8805193.

2 years agomeson: shorten code a bit
Yu Watanabe [Mon, 19 Jun 2023 23:06:43 +0000 (08:06 +0900)] 
meson: shorten code a bit

2 years agomeson: drop wrong and redundant assignment
Yu Watanabe [Mon, 19 Jun 2023 21:28:56 +0000 (06:28 +0900)] 
meson: drop wrong and redundant assignment

Follow-up for b62ee354dd68349812f0526622c4e164b4a89f5f.

2 years agomeson: also build symbol tests for static-libsystemd=no-pic
Yu Watanabe [Mon, 19 Jun 2023 21:08:17 +0000 (06:08 +0900)] 
meson: also build symbol tests for static-libsystemd=no-pic

2 years agomeson: add dependency for udev runner to test
Yu Watanabe [Mon, 19 Jun 2023 21:05:53 +0000 (06:05 +0900)] 
meson: add dependency for udev runner to test

2 years agosd-journal: verify journal file header in more detail
Yu Watanabe [Tue, 16 May 2023 18:29:23 +0000 (03:29 +0900)] 
sd-journal: verify journal file header in more detail

Fixes #27635.

2 years agopam: add macro wrapper to make code shorter
Zbigniew Jędrzejewski-Szmek [Mon, 12 Jun 2023 07:47:00 +0000 (09:47 +0200)] 
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 f71b55b51075e7ce42fa0ad4ae5569ba1aea6ee2 and
2675747f3cdd6f1e6236bbb2f79abfa53fb307f1.

2 years agoMerge pull request #28109 from mrc0mmand/more-journal-shenanigans
Luca Boccassi [Wed, 21 Jun 2023 23:46:06 +0000 (00:46 +0100)] 
Merge pull request #28109 from mrc0mmand/more-journal-shenanigans

test: cover a couple of missed code paths in journalctl/journald

2 years agosystemd-analyze: allow --quiet for condition checks
Ronan Pigott [Wed, 21 Jun 2023 02:47:47 +0000 (19:47 -0700)] 
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.

2 years agoelf-util: discard PT_LOAD segment early based on the start address.
Romain Geissler [Tue, 20 Jun 2023 16:06:31 +0000 (16:06 +0000)] 
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.

2 years agoMerge pull request #27942 from DaanDeMeyer/root-ephemeral
Daan De Meyer [Wed, 21 Jun 2023 15:24:39 +0000 (17:24 +0200)] 
Merge pull request #27942 from DaanDeMeyer/root-ephemeral

core: Add RootEphemeral= setting

2 years agotest: cover a couple of missed code paths in journalctl/journald 28109/head
Frantisek Sumsal [Wed, 21 Jun 2023 11:14:54 +0000 (13:14 +0200)] 
test: cover a couple of missed code paths in journalctl/journald

2 years agotest: Add RootEphemeral= integration test 27942/head
Daan De Meyer [Tue, 20 Jun 2023 11:54:07 +0000 (13:54 +0200)] 
test: Add RootEphemeral= integration test

2 years agotest: Add touch into minimal verity test image
Daan De Meyer [Tue, 20 Jun 2023 11:53:45 +0000 (13:53 +0200)] 
test: Add touch into minimal verity test image

2 years agocore: Add RootEphemeral= setting
Daan De Meyer [Tue, 6 Jun 2023 15:44:09 +0000 (17:44 +0200)] 
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.

2 years agojournal-remote: fix typo in an error message
Frantisek Sumsal [Wed, 21 Jun 2023 09:09:12 +0000 (11:09 +0200)] 
journal-remote: fix typo in an error message

2 years agomeson: update man rules
Zbigniew Jędrzejewski-Szmek [Tue, 20 Jun 2023 23:46:45 +0000 (17:46 -0600)] 
meson: update man rules

Fixup for 403082602d4230c224529c46e2d8a392f3a50e49.

2 years agoMerge pull request #28079 from Geass-LL/comment
Zbigniew Jędrzejewski-Szmek [Tue, 20 Jun 2023 23:40:36 +0000 (01:40 +0200)] 
Merge pull request #28079 from Geass-LL/comment

basic/env-file: also change to state PRE_KEY if we see NEWLINE in sta…

2 years agoMerge pull request #28082 from mrc0mmand/more-journal-remote-tests
Luca Boccassi [Tue, 20 Jun 2023 22:38:24 +0000 (23:38 +0100)] 
Merge pull request #28082 from mrc0mmand/more-journal-remote-tests

test: add a couple of tests for systemd-journal-{remote,upload}

2 years agoMerge pull request #28095 from poettering/generic-valid-version
Lennart Poettering [Tue, 20 Jun 2023 19:37:46 +0000 (21:37 +0200)] 
Merge pull request #28095 from poettering/generic-valid-version

make version_is_valid() generic

2 years agostat-util: add missing S_IFLNK entry in inode_type_to_string()
Lennart Poettering [Tue, 20 Jun 2023 15:03:47 +0000 (17:03 +0200)] 
stat-util: add missing S_IFLNK entry in inode_type_to_string()

No idea what happened here, but it's a glaring omission.

2 years agoanalyze: also check for version string validity 28095/head
Lennart Poettering [Tue, 20 Jun 2023 16:30:40 +0000 (18:30 +0200)] 
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)

2 years agostring-util: move version_is_valid() into generic code
Lennart Poettering [Thu, 2 Mar 2023 10:09:42 +0000 (11:09 +0100)] 
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).

2 years agopath-util: split filename_is_valid() in two
Lennart Poettering [Fri, 3 Mar 2023 17:15:39 +0000 (18:15 +0100)] 
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.

2 years agohwdb: add support for Jun Tab2/Dere T11 to 60-sensor.hwdb (#28092)
Juno Computers [Tue, 20 Jun 2023 16:41:47 +0000 (12:41 -0400)] 
hwdb: add support for Jun Tab2/Dere T11 to 60-sensor.hwdb (#28092)

2 years agohostnamectl: show age of firmware as time span, too
Lennart Poettering [Tue, 20 Jun 2023 13:26:19 +0000 (15:26 +0200)] 
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.

2 years agoMerge pull request #28080 from poettering/dmi-fixes
Lennart Poettering [Tue, 20 Jun 2023 16:40:08 +0000 (18:40 +0200)] 
Merge pull request #28080 from poettering/dmi-fixes

fix udev DMI rules – make sure hostnamectl shows correct hw info even after device trigger

2 years agoMerge pull request #28089 from poettering/sleep-cleanups
Lennart Poettering [Tue, 20 Jun 2023 16:39:49 +0000 (18:39 +0200)] 
Merge pull request #28089 from poettering/sleep-cleanups

sleep-config: various clean-ups

2 years agoMerge pull request #28087 from poettering/transaction-flags
Lennart Poettering [Tue, 20 Jun 2023 14:21:05 +0000 (16:21 +0200)] 
Merge pull request #28087 from poettering/transaction-flags

transaction: change four boolean funciton parameters into a single flags parameter

2 years agotest: add a couple of tests for systemd-journal-{remote,upload} 28082/head
Frantisek Sumsal [Mon, 19 Jun 2023 15:12:39 +0000 (17:12 +0200)] 
test: add a couple of tests for systemd-journal-{remote,upload}

2 years agotmpfiles: Add note to man page about guaranteed cleanup for files/directories
Daan De Meyer [Tue, 20 Jun 2023 10:59:24 +0000 (12:59 +0200)] 
tmpfiles: Add note to man page about guaranteed cleanup for files/directories

2 years agotmpfiles: Don't log about harmless errors when trying to lock file
Daan De Meyer [Tue, 6 Jun 2023 15:23:10 +0000 (17:23 +0200)] 
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.

2 years agotmpfiles: Fix BSD lock logging messages
Daan De Meyer [Tue, 6 Jun 2023 14:55:14 +0000 (16:55 +0200)] 
tmpfiles: Fix BSD lock logging messages

2 years agodissect-image: Log if verity signature partition is too large
Daan De Meyer [Tue, 6 Jun 2023 14:54:24 +0000 (16:54 +0200)] 
dissect-image: Log if verity signature partition is too large

2 years agonamespace: Load sidecar verity settings in apply_mount_namespace()
Daan De Meyer [Thu, 23 Mar 2023 12:48:42 +0000 (13:48 +0100)] 
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.

2 years agoMerge pull request #27863 from DaanDeMeyer/copy-lock
Daan De Meyer [Tue, 20 Jun 2023 13:22:24 +0000 (15:22 +0200)] 
Merge pull request #27863 from DaanDeMeyer/copy-lock

Add helpers to lock a directory before copying into it

2 years agohostnamed: when parsing day/month of firmware date, force decimal parsing 28080/head
Lennart Poettering [Tue, 20 Jun 2023 13:00:07 +0000 (15:00 +0200)] 
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.

2 years agorules: drop weird spaces
Lennart Poettering [Mon, 19 Jun 2023 16:49:05 +0000 (18:49 +0200)] 
rules: drop weird spaces

2 years agohostnamed: don't read DMI data within a container
Lennart Poettering [Mon, 19 Jun 2023 16:46:36 +0000 (18:46 +0200)] 
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.

2 years agorules: split out DMI related rules from udev-default.rules
Lennart Poettering [Mon, 19 Jun 2023 16:44:54 +0000 (18:44 +0200)] 
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.

2 years agoupdate TODO
Lennart Poettering [Tue, 20 Jun 2023 12:41:08 +0000 (14:41 +0200)] 
update TODO

2 years agosleep: rename sleep-config.[ch] → sleep-util.[ch] 28089/head
Lennart Poettering [Tue, 20 Jun 2023 12:18:52 +0000 (14:18 +0200)] 
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.

2 years agosleep-config: reduce scope of DMI object path a bit
Lennart Poettering [Tue, 20 Jun 2023 12:15:42 +0000 (14:15 +0200)] 
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.

2 years agobtrfs-util: Add BTRFS_SNAPSHOT_LOCK_BSD 27863/head
Daan De Meyer [Tue, 28 Mar 2023 10:32:51 +0000 (12:32 +0200)] 
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.

2 years agosleep-config: rename .device field to .path
Lennart Poettering [Tue, 20 Jun 2023 11:21:28 +0000 (13:21 +0200)] 
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.)

2 years agosleep-config: don't use 'device_id' moniker for a dev_t entity
Lennart Poettering [Tue, 20 Jun 2023 10:34:09 +0000 (12:34 +0200)] 
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).

2 years agosleep-config: pin swap device while operating via O_PATH
Lennart Poettering [Tue, 20 Jun 2023 10:32:21 +0000 (12:32 +0200)] 
sleep-config: pin swap device while operating via O_PATH

2 years agosleep-config: replace SwapEntry's .type field with a proper enum
Lennart Poettering [Tue, 20 Jun 2023 10:31:10 +0000 (12:31 +0200)] 
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.

2 years agosleep-config: check if we operate on regular file in swap_device_to_device_id() in...
Lennart Poettering [Tue, 20 Jun 2023 10:26:46 +0000 (12:26 +0200)] 
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.

2 years agosleep-config: replace useless fstat() by useful fd_verify_regular()
Lennart Poettering [Tue, 20 Jun 2023 10:23:58 +0000 (12:23 +0200)] 
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.

2 years agosleep-config: rename can_sleep_state() parameter
Lennart Poettering [Tue, 20 Jun 2023 10:22:28 +0000 (12:22 +0200)] 
sleep-config: rename can_sleep_state() parameter

Just some trivial renaming, to indicate that these are not the supported
but the requested sleep states.

2 years agotransaction: drop bus error arg from transaction_add_propagate_reload_jobs() 28087/head
Lennart Poettering [Tue, 20 Jun 2023 11:07:53 +0000 (13:07 +0200)] 
transaction: drop bus error arg from transaction_add_propagate_reload_jobs()

We erase the error anyway always, hence no point in even passing
anything in from callers.