]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 months agotools/check-version-history: skip test if lxml is not installed 32201/head
Antonio Alvarez Feijoo [Wed, 10 Apr 2024 09:08:25 +0000 (11:08 +0200)] 
tools/check-version-history: skip test if lxml is not installed

```
================================= 1070/1408 ==================================
test:         systemd:dist / check-version-history
start time:   07:55:05
duration:     0.03s
result:       exit status 1
...
----------------------------------- stderr -----------------------------------
Traceback (most recent call last):
  File "/mnt/work/systemd/upstream-fork/main/tools/check-version-history.py", line 6, in <module>
    import lxml.etree as tree
ModuleNotFoundError: No module named 'lxml'
==============================================================================
```

Follow-up for 3691e7fce70149ed19edc5d3003e2d7c936c147a

2 months agotest: add missing header to test.h
Antonio Alvarez Feijoo [Wed, 10 Apr 2024 09:07:32 +0000 (11:07 +0200)] 
test: add missing header to test.h

```
../src/shared/tests.h:361:28: error: implicit declaration of function ‘fork’ [-Werror=implicit-function-declaration]
  361 |                 int _pid = fork();                                                                              \
      |                            ^~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: error: implicit declaration of function ‘_exit’ [-Werror=implicit-function-declaration]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1115:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1115 |         ASSERT_SIGNAL(ASSERT_OK(-ENOANO), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/test/test-macro.c:1119:21: error: implicit declaration of function ‘getpid’; did you mean ‘getpt’? [-Werror=implicit-function-declaration]
 1119 |         ASSERT_TRUE(getpid());
      |                     ^~~~~~
```

Follow-up for #32189

2 months agosecure-boot: tighten enrollment logic a bit regarding file sizes
Lennart Poettering [Tue, 9 Apr 2024 10:39:28 +0000 (12:39 +0200)] 
secure-boot: tighten enrollment logic a bit regarding file sizes

It's OK the dbx file is not loaded, but let's explicitly check for that
(i.e. if the buffer is actually non-NULL), rather than the size of the
bufer, since empty files actually do exist.

Or in other words, let's not magically suppress enrollment of empty
files, but let uefi firmware handle these on their own.

Follow-up for: 57ea8012d6f0b9a3622d4a84d93020020a3aca3c

2 months agoboot: re-align table
Lennart Poettering [Tue, 9 Apr 2024 10:39:01 +0000 (12:39 +0200)] 
boot: re-align table

We like our tables aligned.

(Also suppres the final two fields, which are all zeroes anyway, to
declutter a bit)

2 months agoresolved: dns_name_equal() can fail, handle that reasonably
Lennart Poettering [Tue, 9 Apr 2024 15:29:33 +0000 (17:29 +0200)] 
resolved: dns_name_equal() can fail, handle that reasonably

Ignoring errors can be OK sometimes, but we should make this explicit.

2 months agoMerge pull request #32189 from mrc0mmand/test-tweaks
Yu Watanabe [Wed, 10 Apr 2024 07:57:00 +0000 (16:57 +0900)] 
Merge pull request #32189 from mrc0mmand/test-tweaks

Another batch of assorted test tweaks

2 months agoMerge pull request #32191 from yuwata/network-persistent-storage-follow-ups
Yu Watanabe [Wed, 10 Apr 2024 07:54:39 +0000 (16:54 +0900)] 
Merge pull request #32191 from yuwata/network-persistent-storage-follow-ups

network: follow-ups for persistent storage

2 months agondisc: use memzero() where appropriate
Lennart Poettering [Tue, 9 Apr 2024 16:45:56 +0000 (18:45 +0200)] 
ndisc: use memzero() where appropriate

2 months agosd-journal: make sure sd_journal_add_match() also accepts SIZE_MAX as size
Lennart Poettering [Tue, 9 Apr 2024 15:51:54 +0000 (17:51 +0200)] 
sd-journal: make sure sd_journal_add_match() also accepts SIZE_MAX as size

In many of our internal functions that take a pointer + a size we have
introduced the rule that SIZE_MAX as size means: take strlen().

sd_journal_add_match() has something similar, but the special value is
0, not SIZE_MAX. This is a bit ugly, since a zero size data block is
theoretically fine. The only reason sd_journal_add_match() gets away
with using this special value is because valid matches must consist of
at least 2 chars, hence cannot be zero.

But let's make this more robust and less surprising when compared to the
rest of our code, and *also* accept SIZE_MAX to mean strlen().

No actual code changes, just some clean-up.

2 months agocore: Serialize both pid and pidfd
Daan De Meyer [Fri, 5 Apr 2024 13:21:49 +0000 (15:21 +0200)] 
core: Serialize both pid and pidfd

If we try to deserialize only a pidfd that points to a process that
has been reaped, creating the pidref object will fail, which means that
we'll try to create a pidref object from the serialized pid that comes
next. If the pid has already been reused, this will succeed and we'll
now have a pidref that points to a different process.

Let's avoid this issue by serializing both the pidfd and the pid and
creating the pidref object directly from both. This means we'll reuse
the deserialized pidfd instead of opening a new one. We'll then immediately
notice the pidfd is dead and do the appropriate follow up depending on
the unit type.

2 months agopo: update Japanese translation
Yu Watanabe [Tue, 9 Apr 2024 22:07:34 +0000 (07:07 +0900)] 
po: update Japanese translation

2 months agonetwork/varlink: fix error cause 32191/head
Yu Watanabe [Tue, 9 Apr 2024 19:55:59 +0000 (04:55 +0900)] 
network/varlink: fix error cause

Follow-up for e1254d0616f812d22753421bd791c4486c0a9128.

Addresses https://github.com/systemd/systemd/pull/31811#discussion_r1557552244.

2 months agonetwork: open persistent directory without O_PATH
Yu Watanabe [Tue, 9 Apr 2024 19:51:27 +0000 (04:51 +0900)] 
network: open persistent directory without O_PATH

Addresses https://github.com/systemd/systemd/pull/31811#discussion_r1557549629.

2 months agotest: wait until the test container is fully booted up 32189/head
Frantisek Sumsal [Tue, 9 Apr 2024 19:16:41 +0000 (21:16 +0200)] 
test: wait until the test container is fully booted up

TEST-69 still occasionally times out in CI and appears to be stuck on
boot, so let's see if this helps the situation a bit.

2 months agotest: disable background color for nspawn containers
Frantisek Sumsal [Tue, 9 Apr 2024 19:11:26 +0000 (21:11 +0200)] 
test: disable background color for nspawn containers

As it makes the logs really messy in certain tests.

2 months agotest: set pexpect's logfile early
Frantisek Sumsal [Tue, 9 Apr 2024 18:55:48 +0000 (20:55 +0200)] 
test: set pexpect's logfile early

So we capture the container's boot as well.

2 months agotest: give sd-resolved enough time to timeout
Frantisek Sumsal [Tue, 9 Apr 2024 18:15:36 +0000 (20:15 +0200)] 
test: give sd-resolved enough time to timeout

The timeout on sd-resolved's side is 5-10s (UDP or TCP), but dig's
default timeout is 5s. Let's give sd-resolved enough time to timeout
before either giving up or checking if it served stale data on dig's
side.

Resolves: #31639

2 months agotest: let curl show a potential error in silent mode
Frantisek Sumsal [Tue, 9 Apr 2024 15:04:50 +0000 (17:04 +0200)] 
test: let curl show a potential error in silent mode

I collected a couple of fails in this particular test, but without any
output they're impossible to debug. Let's make this slightly less
annoying and let curl show an error (if any) even in silent mode.

This patch uncovers that curl has been (silently) complaining about not
being able to write to the output destination, because `grep -q`
short-circuits on the first match and doesn't bother reading the rest,
so replace `grep -q` with `grep ... >/dev/null` to force grep to always
read the whole thing from curl.

2 months agotest: forward journal to console in TEST-24-CRYPTSETUP
Frantisek Sumsal [Tue, 9 Apr 2024 12:04:28 +0000 (14:04 +0200)] 
test: forward journal to console in TEST-24-CRYPTSETUP

If we fail to mount the encrypted /var during boot we're left with
nothing to debug, so let's do the same thing we do for TEST-08-INITRD
and forward journal to the console.

2 months agotest: add a couple of sanity tests for ASSERT_*() macros
Frantisek Sumsal [Mon, 8 Apr 2024 16:17:48 +0000 (18:17 +0200)] 
test: add a couple of sanity tests for ASSERT_*() macros

Also, introduce ASSERT_SIGNAL() macro that should help us test failing
cases of mentioned macros (which usually end with calling abort()).

2 months agotest: handle NULL correctly when passed to ASSERT_EQ()
Frantisek Sumsal [Mon, 8 Apr 2024 18:32:10 +0000 (20:32 +0200)] 
test: handle NULL correctly when passed to ASSERT_EQ()

strcmp() doesn't handle NULLs nicely, so switch to streq_ptr().

2 months agotree-wide: make sure net/if.h is included before any linux/ header
Frantisek Sumsal [Tue, 9 Apr 2024 10:44:46 +0000 (12:44 +0200)] 
tree-wide: make sure net/if.h is included before any linux/ header

The linux/ headers include linux/libc-compat.h that makes sure the
linux/ headers won't redeclare symbols already declared by net/if.h, but
glibc's net/if.h doesn't do that, so if the include order is reversed
we'll end up with a bunch of errors about redeclared stuff:

[3/519] Compiling C object test-network-tables.p/src_network_test-network-tables.c.o
FAILED: test-network-tables.p/src_network_test-network-tables.c.o
cc -Itest-network-tables.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -Isrc/libsystemd-network -I../src/libsystemd-network -Isrc/network -I../src/network -I../src/network/netdev -I../src/network/tc -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=strict-flex-arrays -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong -fstrict-flex-arrays --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fstrict-flex-arrays=1 -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -DTEST_CODE=1 -MD -MQ test-network-tables.p/src_network_test-network-tables.c.o -MF test-network-tables.p/src_network_test-network-tables.c.o.d -o test-network-tables.p/src_network_test-network-tables.c.o -c ../src/network/test-network-tables.c
In file included from ../src/basic/linux/if_bonding.h:47,
                 from ../src/network/netdev/bond.h:5,
                 from ../src/network/test-network-tables.c:3:
../src/basic/linux/if.h:111:41: error: redeclaration of enumerator ‘IFF_UP’
  111 | #define IFF_UP                          IFF_UP
      |                                         ^~~~~~
../src/basic/linux/if.h:84:9: note: previous definition of ‘IFF_UP’ with type ‘enum net_device_flags’
   84 |         IFF_UP                          = 1<<0,  /* sysfs */
      |         ^~~~~~
../src/basic/linux/if.h:112:41: error: redeclaration of enumerator ‘IFF_BROADCAST’
  112 | #define IFF_BROADCAST                   IFF_BROADCAST
      |                                         ^~~~~~~~~~~~~
...

This also drops remaining workarounds from the last time this issue was
brought up (6f270e6bd8) since they shouldn't be needed anymore if the
order of the includes is the "correct" one. I also added a comment to
each affected include when this is inevitably encountered again in the
future.

Resolves: #32160

2 months agotest-date: add missing header
Antonio Alvarez Feijoo [Tue, 9 Apr 2024 12:21:08 +0000 (14:21 +0200)] 
test-date: add missing header

```
[587/2863] Compiling C object test-date.p/src_test_test-date.c.o
FAILED: test-date.p/src_test_test-date.c.o
cc -Itest-date.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -DTEST_CODE=1 -MD -MQ test-date.p/src_test_test-date.c.o -MF test-date.p/src_test_test-date.c.o.d -o test-date.p/src_test_test-date.c.o -c ../src/test/test-date.c
../src/test/test-date.c: In function ‘main’:
../src/test/test-date.c:86:13: error: implicit declaration of function ‘access’; did you mean ‘accept’? [-Werror=implicit-function-declaration]
   86 |         if (access("/usr/share/zoneinfo/Asia/Seoul", F_OK) >= 0) {
      |             ^~~~~~
      |             accept
../src/test/test-date.c:86:13: warning: nested extern declaration of ‘access’ [-Wnested-externs]
../src/test/test-date.c:86:54: error: ‘F_OK’ undeclared (first use in this function)
   86 |         if (access("/usr/share/zoneinfo/Asia/Seoul", F_OK) >= 0) {
      |                                                      ^~~~
../src/test/test-date.c:86:54: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
```

Fixes ae4088b23e1658a6f6e940d6e1c8d0a14f93449b

2 months agoservice: explicitly add comment about donated reference on parameter
Lennart Poettering [Tue, 9 Apr 2024 10:16:08 +0000 (12:16 +0200)] 
service: explicitly add comment about donated reference on parameter

Follow-up for: d6a911e906e3fe0fdd357f2120209372574a8406

See my comment: https://github.com/systemd/systemd/pull/31916/commits/d6a911e906e3fe0fdd357f2120209372574a8406#r1557384101

2 months agopidref: 0 -> NULL for pointer
Mike Yuan [Tue, 9 Apr 2024 17:45:12 +0000 (01:45 +0800)] 
pidref: 0 -> NULL for pointer

2 months agomkosi; Fix permissions of mkosi.postinst script
Daan De Meyer [Tue, 9 Apr 2024 14:18:25 +0000 (16:18 +0200)] 
mkosi; Fix permissions of mkosi.postinst script

Must be executable.

2 months agoMerge pull request #32154 from DaanDeMeyer/mkosi
Luca Boccassi [Tue, 9 Apr 2024 12:30:59 +0000 (13:30 +0100)] 
Merge pull request #32154 from DaanDeMeyer/mkosi

mkosi: Make scripts more generic

2 months agobuild(deps): bump pkg/fedora from `2822a03` to `3f8c38e`
dependabot[bot] [Tue, 9 Apr 2024 09:45:45 +0000 (09:45 +0000)] 
build(deps): bump pkg/fedora from `2822a03` to `3f8c38e`

Bumps pkg/fedora from `2822a03` to `3f8c38e`.

---
updated-dependencies:
- dependency-name: pkg/fedora
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2 months agomkosi: Drop out-of-date comment 32154/head
Daan De Meyer [Tue, 9 Apr 2024 09:57:38 +0000 (11:57 +0200)] 
mkosi: Drop out-of-date comment

2 months agomkosi: Unify initrd post-install scripts
Daan De Meyer [Mon, 8 Apr 2024 11:57:48 +0000 (13:57 +0200)] 
mkosi: Unify initrd post-install scripts

Just like we already have $SYSTEMD_PACKAGES for systemd packages to
re-install in the main image, let's add $INITRD_PACKAGES for all
systemd packages to re-install in the initrd.

2 months agomkosi: Install openSUSE-release instead of distribution-release
Daan De Meyer [Mon, 8 Apr 2024 11:42:22 +0000 (13:42 +0200)] 
mkosi: Install openSUSE-release instead of distribution-release

distribution-release is a virtual package that is by default satisfied
by the openSUSE MicroOS-release package. Let's make sure we pull in the
generic openSUSE-release package instead by installing
patterns-base-minimal_base which has a Suggests dependency on
openSUSE-release which makes sure it takes priority over the MicroOS one.

2 months agomkosi: Make scripts more generic
Daan De Meyer [Mon, 8 Apr 2024 10:52:56 +0000 (12:52 +0200)] 
mkosi: Make scripts more generic

We might want to run the build scripts outside of mkosi as well at
some point, e.g. to build an rpm after booting the image, so let's
make them more generic by using /usr/lib/os-release to figure out
which pkg specs we should use instead of $PKG_SUBDIR. To make ubuntu
use the debian pkg spec, we add a symlink pkg/ubuntu which points to
debian/ in the same directory.

2 months agomkosi: Update to latest
Daan De Meyer [Mon, 8 Apr 2024 15:23:21 +0000 (17:23 +0200)] 
mkosi: Update to latest

2 months agomkosi: Update pkg/arch to latest and install systemd-tests
Daan De Meyer [Tue, 9 Apr 2024 08:24:06 +0000 (10:24 +0200)] 
mkosi: Update pkg/arch to latest and install systemd-tests

The arch PKGBUILD now packages the tests when building for upstream
so let's make sure we install the new package.

2 months agohibernate-resume-config: apply ENABLE_EFI ifdef correctly
Mike Yuan [Mon, 8 Apr 2024 20:04:21 +0000 (04:04 +0800)] 
hibernate-resume-config: apply ENABLE_EFI ifdef correctly

Currently, validate_efi_hibernate_location is
fully conditioned out if !ENABLE_EFI, but
get_efi_hibernate_location() still calls it.

2 months agotest: Various build environment fixes
Daan De Meyer [Mon, 8 Apr 2024 17:56:36 +0000 (19:56 +0200)] 
test: Various build environment fixes

All bets are off in build chroots, so let's handle more cases of
files or executables that might not be available in build chroots.

Specifically, these are all fixes to allow the unit tests to run
in the opensuse build chroot.

2 months agoresolve: really always initialize aux
Ronan Pigott [Mon, 8 Apr 2024 19:45:01 +0000 (12:45 -0700)] 
resolve: really always initialize aux

dns_transaction_request_dnssec_rr was already adjusted in 400171036592,
to allow for the return parameter to be passed uninitialized. However
this codepath was missed, meaning this function could sometimes return
success without having actually set the parameter.

Fixes: 400171036592 ("resolved: minor dnssec fixups")
Fixes: 47690634f157 ("resolved: don't request the SOA for every dns label")
2 months agonetwork/dhcp6: return earlier if no lease acquired
Yu Watanabe [Tue, 9 Apr 2024 01:49:32 +0000 (10:49 +0900)] 
network/dhcp6: return earlier if no lease acquired

Previously, even If an interface has not acquired a DHCPv6 lease,
networkd logs a misleading message:
===
Apr 09 10:44:57 systemd-networkd[3970750]: veth99: DHCPv6 lease lost
===
The function should do nothing when no lease acquired. Let's return
earlier and suppress the log message.

2 months agoMerge pull request #31997 from yuwata/network-ndisc-zero-lifetime
Yu Watanabe [Mon, 8 Apr 2024 22:52:28 +0000 (07:52 +0900)] 
Merge pull request #31997 from yuwata/network-ndisc-zero-lifetime

network: fixlets for zero lifetime

2 months agovmspawn: fix `sd_bus_message_append()` arguments and add missing error check
Antonio Alvarez Feijoo [Mon, 8 Apr 2024 15:08:52 +0000 (17:08 +0200)] 
vmspawn: fix `sd_bus_message_append()` arguments and add missing error check

2 months agodocs: Suggest soft-reboot to restart pid1 and all daemons in mkosi VM
Daan De Meyer [Mon, 8 Apr 2024 21:17:33 +0000 (23:17 +0200)] 
docs: Suggest soft-reboot to restart pid1 and all daemons in mkosi VM

2 months agoMerge pull request #32104 from yuwata/network-ndisc-redirect
Luca Boccassi [Mon, 8 Apr 2024 19:03:32 +0000 (20:03 +0100)] 
Merge pull request #32104 from yuwata/network-ndisc-redirect

network/ndisc: add support for Redirect message

2 months agoMerge pull request #32156 from YHNdnzj/mountfsd-followup
Mike Yuan [Mon, 8 Apr 2024 18:48:30 +0000 (02:48 +0800)] 
Merge pull request #32156 from YHNdnzj/mountfsd-followup

Some cleanup for uid-range

2 months agomkosi: Fix debian submodule commit
Daan De Meyer [Mon, 8 Apr 2024 15:08:39 +0000 (17:08 +0200)] 
mkosi: Fix debian submodule commit

This was accidentally changed in https://github.com/systemd/systemd/pull/32155

2 months agoI made more unit test to use the test macro
Usman Akinyemi [Mon, 8 Apr 2024 10:54:16 +0000 (06:54 -0400)] 
I made more unit test to use the test macro

2 months agouserdbctl: correct uid_range_covers check 32156/head
Mike Yuan [Mon, 8 Apr 2024 12:24:23 +0000 (20:24 +0800)] 
userdbctl: correct uid_range_covers check

The third param should be the number of uids.

2 months agouserdbctl: use FOREACH_ARRAY more
Mike Yuan [Mon, 8 Apr 2024 12:24:02 +0000 (20:24 +0800)] 
userdbctl: use FOREACH_ARRAY more

2 months agouserdbctl: avoid NULL pointer deref
Mike Yuan [Mon, 8 Apr 2024 12:19:57 +0000 (20:19 +0800)] 
userdbctl: avoid NULL pointer deref

Error from uid_range_load_userns is ignored,
so 'p' could be NULL.

2 months agouid-range: place 'ret' param at last
Mike Yuan [Mon, 8 Apr 2024 11:38:29 +0000 (19:38 +0800)] 
uid-range: place 'ret' param at last

2 months agouid-range: use FOREACH_ARRAY at one more place
Mike Yuan [Mon, 8 Apr 2024 11:48:01 +0000 (19:48 +0800)] 
uid-range: use FOREACH_ARRAY at one more place

2 months agolabeler: add mountfsd and nsresource
Mike Yuan [Mon, 8 Apr 2024 12:09:54 +0000 (20:09 +0800)] 
labeler: add mountfsd and nsresource

2 months agodocs: Add note on RuntimeBuildSources= to hacking guide
Daan De Meyer [Mon, 8 Apr 2024 10:14:47 +0000 (12:14 +0200)] 
docs: Add note on RuntimeBuildSources= to hacking guide

2 months agoMerge pull request #32141 from DaanDeMeyer/mkosi
Daan De Meyer [Mon, 8 Apr 2024 09:59:16 +0000 (11:59 +0200)] 
Merge pull request #32141 from DaanDeMeyer/mkosi

Install build dependencies into final image

2 months agoMerge pull request #32140 from YHNdnzj/socket-per-peer-source
Luca Boccassi [Mon, 8 Apr 2024 09:38:07 +0000 (10:38 +0100)] 
Merge pull request #32140 from YHNdnzj/socket-per-peer-source

Minor tweaks to socket manual & shorten the code a bit

2 months agomkosi: Update submodules to latest 32141/head
Daan De Meyer [Mon, 8 Apr 2024 09:36:59 +0000 (11:36 +0200)] 
mkosi: Update submodules to latest

2 months agomkosi: Fix environment variable in arch prepare script
Daan De Meyer [Mon, 8 Apr 2024 09:35:38 +0000 (11:35 +0200)] 
mkosi: Fix environment variable in arch prepare script

2 months agoInstall build dependencies into final image
Daan De Meyer [Sun, 7 Apr 2024 18:23:56 +0000 (20:23 +0200)] 
Install build dependencies into final image

This allows us to build and install after booting without having to
build a new image. Together with
https://github.com/systemd/mkosi/pull/2601 and after enabling
RuntimeBuildSources=yes, after booting, "meson install -C /work/build"
can be used to do an incremental build and install. This won't build
proper packages, but will be invaluable for having a quick compile,
edit, test cycle without having to rebuild the image all the time.

2 months agoUpdate pkg/debian/ to latest
Luca Boccassi [Mon, 8 Apr 2024 09:17:53 +0000 (10:17 +0100)] 
Update pkg/debian/ to latest

lz4-tool, nsresourced, kmod changes

2 months agonsresource: fix FD leak
Luca Boccassi [Mon, 8 Apr 2024 01:33:27 +0000 (02:33 +0100)] 
nsresource: fix FD leak

Also fix return code, namespace_open_by_type uses RET_NERRNO

CID#1542923

Follow-up for 54452c7b2aa

2 months agonetworkd: report error if lease file cannot be loaded and ignore
Zbigniew Jędrzejewski-Szmek [Sat, 6 Apr 2024 17:01:56 +0000 (19:01 +0200)] 
networkd: report error if lease file cannot be loaded and ignore

On my system, networkd would report that interface ve-rawhide is "Failed"
without anything in the logs:
systemd-networkd[651095]: ve-rawhide: Trying to reconfigure the interface.
systemd-networkd[651095]: ve-rawhide: Gained IPv6LL
systemd-networkd[651095]: ve-rawhide: Link DOWN
systemd-networkd[651095]: ve-rawhide: Lost carrier
systemd-networkd[651095]: ve-rawhide: Configuring with /usr/lib/systemd/network/80-container-ve.network.
systemd-networkd[651095]: ve-rawhide: Link UP
systemd-networkd[651095]: ve-rawhide: Gained carrier
systemd-networkd[651095]: ve-rawhide: Failed

At debug level:
systemd-networkd[799993]: dhcp-server-lease/ve-rawhide:1:1: Missing object field 'Address'.

$ jq </var/lib/systemd/network/dhcp-server-lease/ve-rawhide
{
  "BootID": "5d86b34b98894322bfd4ae8443ce59b3",
  "Leases": [
    {
      "ClientId": [ ... ],
      "Address": [ 192, 168, 120, 179 ],
      "Hostname": "rawhide",
      "ExpirationUSec": 966046821158,
      "ExpirationRealtimeUSec": 1711203197266940
    }
  ]
}

I'm not sure why "Address" is missing, but anyway, in this case, we should ignore the
lease file rather than refusing to configure the interface. Also, warn at the point
where we know what the filename is.

2 months agocore: fix typo
Antonio Alvarez Feijoo [Mon, 8 Apr 2024 08:04:32 +0000 (10:04 +0200)] 
core: fix typo

2 months agotree-wide: drop several remaining license headers
Yu Watanabe [Fri, 5 Apr 2024 04:08:05 +0000 (13:08 +0900)] 
tree-wide: drop several remaining license headers

And downgrade the license of utf8.c to LGPL-2.0-or-later, to follow the
original license.

2 months agomountfsd: fix typo
Yu Watanabe [Mon, 8 Apr 2024 00:22:03 +0000 (09:22 +0900)] 
mountfsd: fix typo

Follow-up for 702a52f4b5d49cce11e2adbc740deb3b644e2de0.

2 months agonsresourced: fix typo
Yu Watanabe [Mon, 8 Apr 2024 00:20:17 +0000 (09:20 +0900)] 
nsresourced: fix typo

Follow-up for 8aee931e7ae1adb01eeac0e1e4c0aef6ed3969ec.

2 months agodissect: fix typo
Yu Watanabe [Mon, 8 Apr 2024 00:17:50 +0000 (09:17 +0900)] 
dissect: fix typo

Follow-up for 9444e54e56b3d9ea81135700abe0792ead7f69ae.

2 months agonspawn: fix typo
Yu Watanabe [Mon, 8 Apr 2024 00:12:06 +0000 (09:12 +0900)] 
nspawn: fix typo

Follow-up for 0af7e294343b29d769c1bae6a8d390236560ec1a.

2 months agoMerge pull request #32136 from YHNdnzj/nextroot-auto-mountpoint
Luca Boccassi [Sun, 7 Apr 2024 22:32:18 +0000 (23:32 +0100)] 
Merge pull request #32136 from YHNdnzj/nextroot-auto-mountpoint

systemctl-logind: auto soft-reboot only if /run/nextroot/ is mountpoint

2 months agotest-execute: check for s390x first and duplicate test
Luca Boccassi [Sun, 7 Apr 2024 15:24:38 +0000 (16:24 +0100)] 
test-execute: check for s390x first and duplicate test

s390x will define both s390x and s390, so exec-personality-s390.service is ran
in both cases but fails on s390x, as the personality returned is s390x.
Split the test and check specifically for s390x.

2 months agohibernate-util: check 'noresume' before reading resume setting
Mike Yuan [Sat, 6 Apr 2024 18:59:07 +0000 (02:59 +0800)] 
hibernate-util: check 'noresume' before reading resume setting

Also hibernation_is_safe() should really take this
into consideration too.

2 months agoMerge pull request #26826 from poettering/mntfsd
Luca Boccassi [Sun, 7 Apr 2024 18:43:34 +0000 (19:43 +0100)] 
Merge pull request #26826 from poettering/mntfsd

unprivileged DDI mounts + dynamic userns range allocation via IPC

2 months agoman/systemd.socket: be explicit that MaxConnectionsPerSource=0 means disabled 32140/head
Mike Yuan [Sun, 7 Apr 2024 17:49:33 +0000 (01:49 +0800)] 
man/systemd.socket: be explicit that MaxConnectionsPerSource=0 means disabled

2 months agocore/service: use GREEDY_REALLOC_APPEND
Mike Yuan [Sun, 7 Apr 2024 17:35:24 +0000 (01:35 +0800)] 
core/service: use GREEDY_REALLOC_APPEND

2 months agomkosi: Install dnf5 in Fedora image
Daan De Meyer [Sun, 7 Apr 2024 13:51:57 +0000 (15:51 +0200)] 
mkosi: Install dnf5 in Fedora image

2 months agoMerge pull request #32135 from keszybz/compiler-warning-cleanup
Luca Boccassi [Sun, 7 Apr 2024 15:33:38 +0000 (16:33 +0100)] 
Merge pull request #32135 from keszybz/compiler-warning-cleanup

Compiler warning cleanup

2 months agosystemctl-logind: auto soft-reboot only if /run/nextroot/ is mountpoint 32136/head
Mike Yuan [Sun, 7 Apr 2024 11:33:37 +0000 (19:33 +0800)] 
systemctl-logind: auto soft-reboot only if /run/nextroot/ is mountpoint

Consider the following case: a user sets up a minimum rootfs for
file system maintenance work in /run/nextroot/ dir directly. When
they're done, they expect 'systemctl reboot' to perform a full reboot.
But they keep soft-rebooting back to the tmpfs root, until they
find out about $SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT.

So currently, when /run/nextroot/ is a normal dir, pid1 automatically
turns it into a bind mount to soft-reboot into. This is good, but when
combined with automatic soft-reboot it has an arguably unexpected
behavior, since /run/nextroot/ can never go away in such a case.
OTOH, if /run/nextroot/ is a mountpoint in the first place, the mount
is *moved* so a second reboot would not trigger auto soft-reboot.
Let's just make things more friendly to users, and do auto soft-reboot
only if /run/nextroot/ is also a mountpoint.

2 months agologind-dbus: use FLAGS_SET more
Mike Yuan [Sun, 7 Apr 2024 11:26:56 +0000 (19:26 +0800)] 
logind-dbus: use FLAGS_SET more

2 months agocore: use log_unit_debug in *_set_state
Mike Yuan [Sat, 6 Apr 2024 14:04:17 +0000 (22:04 +0800)] 
core: use log_unit_debug in *_set_state

2 months agorun: query for SoftRebootsCount only for system scope runs
Luca Boccassi [Fri, 5 Apr 2024 23:00:41 +0000 (00:00 +0100)] 
run: query for SoftRebootsCount only for system scope runs

Only the system manager records soft reboots, and the user session is
restarted anyway so it doesn't suffer from the ID clash issue

Follow-up for ed358516937780b524a2cfa833427da3df1bc87f

2 months agosd-bus: rework assert to make the gcc happy 32135/head
Zbigniew Jędrzejewski-Szmek [Sun, 7 Apr 2024 09:13:06 +0000 (11:13 +0200)] 
sd-bus: rework assert to make the gcc happy

With gcc-14.0.1-0.13.fc40, when compiling with -O2, the compiler doesn't understand
that sd_bus_error_setf() always returns negative on error when <name> is provided:

[28/576] Compiling C object systemd-resolved.p/src_resolve_resolved-bus.c.o
../src/resolve/resolved-bus.c: In function ‘call_link_method’:
../src/resolve/resolved-bus.c:1763:16: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
 1763 |         return handler(message, l, error);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~
../src/resolve/resolved-bus.c:1749:15: note: ‘l’ was declared here
 1749 |         Link *l;
      |               ^
../src/resolve/resolved-bus.c: In function ‘bus_method_get_link’:
../src/resolve/resolved-bus.c:1822:13: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
 1822 |         p = link_bus_path(l);
      |             ^~~~~~~~~~~~~~~~
../src/resolve/resolved-bus.c:1810:15: note: ‘l’ was declared here
 1810 |         Link *l;
      |               ^
...

Let's make the assertion a bit more explicit. With this, the warning goes away,
but I think it's more obvious to a human reader too.

2 months agoask-password: minor shortening
Zbigniew Jędrzejewski-Szmek [Sun, 7 Apr 2024 09:08:22 +0000 (11:08 +0200)] 
ask-password: minor shortening

2 months agocore: silence gcc warning about unitialized variable
Zbigniew Jędrzejewski-Szmek [Sun, 7 Apr 2024 09:05:42 +0000 (11:05 +0200)] 
core: silence gcc warning about unitialized variable

When compiled with -O2, the compiler is not happy about dynamic_user_pop() and
would warn about the output variables not being set. It does have a point:
we were doing a cast from ssize_t to int, and theoretically there could be
wraparound. So let's add an explicit check that the cast to int is fine.

[540/2509] Compiling C object src/core/libsystemd-core-256.so.p/dynamic-user.c.o
../src/core/dynamic-user.c: In function ‘dynamic_user_close.isra’:
../src/core/dynamic-user.c:580:9: warning: ‘uid’ may be used uninitialized [-Wmaybe-uninitialized]
  580 |         unlink_uid_lock(lock_fd, uid, d->name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/core/dynamic-user.c:560:15: note: ‘uid’ was declared here
  560 |         uid_t uid;
      |               ^~~
../src/core/dynamic-user.c: In function ‘dynamic_user_realize’:
../src/core/dynamic-user.c:476:29: warning: ‘new_uid’ may be used uninitialized [-Wmaybe-uninitialized]
  476 |                         num = new_uid;
      |                         ~~~~^~~~~~~~~
../src/core/dynamic-user.c:398:23: note: ‘new_uid’ was declared here
  398 |                 uid_t new_uid;
      |                       ^~~~~~~

2 months agoupdate TODO 26826/head
Lennart Poettering [Mon, 4 Dec 2023 16:57:06 +0000 (17:57 +0100)] 
update TODO

2 months agotest: add integration test for unpriv mountfsd/nsresourced
Lennart Poettering [Tue, 23 Jan 2024 15:20:10 +0000 (16:20 +0100)] 
test: add integration test for unpriv mountfsd/nsresourced

2 months agonspawn: make nspawn work without privileges
Lennart Poettering [Tue, 12 Dec 2023 10:00:19 +0000 (11:00 +0100)] 
nspawn: make nspawn work without privileges

2 months agocore: implement RootImage= via mountfsd in unprivileged environments
Lennart Poettering [Wed, 6 Dec 2023 15:39:39 +0000 (16:39 +0100)] 
core: implement RootImage= via mountfsd in unprivileged environments

2 months agodissect-tool: allow systemd-dissect to talk to mountfsd
Lennart Poettering [Thu, 20 Apr 2023 17:07:10 +0000 (19:07 +0200)] 
dissect-tool: allow systemd-dissect to talk to mountfsd

2 months agodissect-image: add a generic varlink client side for mountfsd
Lennart Poettering [Mon, 4 Dec 2023 21:09:15 +0000 (22:09 +0100)] 
dissect-image: add a generic varlink client side for mountfsd

2 months agomountfsd: add new systemd-mountfsd component
Lennart Poettering [Thu, 9 Mar 2023 11:27:29 +0000 (12:27 +0100)] 
mountfsd: add new systemd-mountfsd component

2 months agonsresourced: add client-side helpers around nsresourced APIs
Lennart Poettering [Mon, 4 Dec 2023 16:57:22 +0000 (17:57 +0100)] 
nsresourced: add client-side helpers around nsresourced APIs

This adds simple functions that wrap the Varlink IPC calls.

2 months agonsresourced: add new daemon for granting clients user namespaces and assigning resour...
Lennart Poettering [Thu, 20 Apr 2023 17:07:33 +0000 (19:07 +0200)] 
nsresourced: add new daemon for granting clients user namespaces and assigning resources to them

This adds a small, socket-activated Varlink daemon that can delegate UID
ranges for user namespaces to clients asking for it.

The primary call is AllocateUserRange() where the user passes in an
uninitialized userns fd, which is then set up.

There are other calls that allow assigning a mount fd to a userns
allocated that way, to set up permissions for a cgroup subtree, and to
allocate a veth for such a user namespace.

Since the UID assignments are supposed to be transitive, i.e. not
permanent, care is taken to ensure that users cannot create inodes owned
by these UIDs, so that persistancy cannot be acquired. This is
implemented via a BPF-LSM module that ensures that any member of a
userns allocated that way cannot create files unless the mount it
operates on is owned by the userns itself, or is explicitly
allowelisted.

BPF LSM program with contributions from Alexei Starovoitov.

2 months agobuild-sys: pick up vmlinux.h from running kernel BTF or user
Lennart Poettering [Wed, 6 Dec 2023 17:37:31 +0000 (18:37 +0100)] 
build-sys: pick up vmlinux.h from running kernel BTF or user

2 months agodissect-image: document one more dissected_image_decrypt() error code
Lennart Poettering [Tue, 23 Jan 2024 15:19:38 +0000 (16:19 +0100)] 
dissect-image: document one more dissected_image_decrypt() error code

2 months agodissect-image: make dissected_image_acquire_metadata() operate within a userns if...
Lennart Poettering [Mon, 4 Dec 2023 17:23:31 +0000 (18:23 +0100)] 
dissect-image: make dissected_image_acquire_metadata() operate within a userns if possible

This opens the door for making the call work without privileges: if we
pass in a userns fd and DissectedImage that has mount fds then we can
acquire all information without privs.

2 months agodissect-image: add a new helper that checks if VeritySettings has anything set at all
Lennart Poettering [Mon, 4 Dec 2023 17:12:58 +0000 (18:12 +0100)] 
dissect-image: add a new helper that checks if VeritySettings has anything set at all

2 months agodissect-image: add dissected_image_close() that closes all references to resources
Lennart Poettering [Tue, 14 Mar 2023 21:46:56 +0000 (22:46 +0100)] 
dissect-image: add dissected_image_close() that closes all references to resources

2 months agodiscover-image: export search paths array
Lennart Poettering [Wed, 26 Apr 2023 19:22:06 +0000 (21:22 +0200)] 
discover-image: export search paths array

This way we can use it to validate image paths later.

2 months agocgroup-setup: add fd-based version of cg_attach()
Lennart Poettering [Tue, 12 Dec 2023 10:02:59 +0000 (11:02 +0100)] 
cgroup-setup: add fd-based version of cg_attach()

2 months agocgroup-util: add helpers for opening cgroup by id
Lennart Poettering [Tue, 12 Dec 2023 09:44:57 +0000 (10:44 +0100)] 
cgroup-util: add helpers for opening cgroup by id

2 months agolock-util: make global lock return parameter to image_path_lock() optional
Lennart Poettering [Fri, 8 Dec 2023 09:47:38 +0000 (10:47 +0100)] 
lock-util: make global lock return parameter to image_path_lock() optional

When adding unprivileged nspawn support we don't really want a global
lock file, since we cannot even access the dir they are stored in, hence
make the concept optional.

Some minor other modernizations.

2 months agobpf-dlopen: pick up more symbols from libbpf
Lennart Poettering [Fri, 1 Mar 2024 16:31:06 +0000 (17:31 +0100)] 
bpf-dlopen: pick up more symbols from libbpf