]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agochase: CHASE_MKDIR_0755 requires CHASE_NONEXISTENT and/or CHASE_PARENT 27252/head
Yu Watanabe [Fri, 14 Apr 2023 07:29:08 +0000 (16:29 +0900)] 
chase: CHASE_MKDIR_0755 requires CHASE_NONEXISTENT and/or CHASE_PARENT

When CHASE_MKDIR_0755 is specified without CHASE_NONEXISTENT and
CHASE_PARENT, then chase() succeeds only when the file specified by
the path already exists, and in that case, chase() does not create
any parent directories, and CHASE_MKDIR_0755 is meaningless.

Let's mention that CHASE_MKDIR_0755 needs to be specified with
CHASE_NONEXISTENT or CHASE_PARENT, and adds a assertion about that.

2 years agochase: use FLAGS_SET() macro
Yu Watanabe [Fri, 14 Apr 2023 07:28:54 +0000 (16:28 +0900)] 
chase: use FLAGS_SET() macro

2 years agoMerge pull request #27254 from poettering/cmsg-align-check
Yu Watanabe [Fri, 14 Apr 2023 04:49:04 +0000 (13:49 +0900)] 
Merge pull request #27254 from poettering/cmsg-align-check

socket-util: tighten CMSG_TYPED_DATA() alignment checks

2 years agoMerge pull request #27144 from enr0n/fix-scope-timer-on-coldplug
Luca Boccassi [Thu, 13 Apr 2023 23:25:06 +0000 (00:25 +0100)] 
Merge pull request #27144 from enr0n/fix-scope-timer-on-coldplug

scope: do not disable timer event source when state is SCOPE_RUNNING

2 years agouser units: implicitly enable PrivateUsers= when sandboxing options are set
Luca Boccassi [Tue, 1 Nov 2022 23:34:15 +0000 (23:34 +0000)] 
user units: implicitly enable PrivateUsers= when sandboxing options are set

Enabling these options when not running as root requires a user
namespace, so implicitly enable PrivateUsers=.
This has a side effect as it changes which users are visible to the unit.
However until now these options did not work at all for user units, and
in practice just a handful of user units in Fedora, Debian and Ubuntu
mistakenly used them (and they have been all fixed since).

This fixes the long-standing confusing issue that the user and system
units take the same options but the behaviour is wildly (and sometimes
silently) different depending on which is which, with user units
requiring manually specifiying PrivateUsers= in order for sandboxing
options to actually work and not be silently ignored.

2 years agoMerge pull request #27244 from bluca/uphold_retry
Luca Boccassi [Thu, 13 Apr 2023 20:33:06 +0000 (21:33 +0100)] 
Merge pull request #27244 from bluca/uphold_retry

Uphold/StopWhenUnneeded/BindsTo: add retry timer on rate limit

2 years agoSynposis and description of networkctl man page reflecting only part of its functiona...
ZjYwMj [Thu, 13 Apr 2023 20:30:42 +0000 (20:30 +0000)] 
Synposis and description of networkctl man page reflecting only part of its functionality  (#27264)

* Fix inaccurate synposis, and description

Before the fix, they reflected only part of networkctl functionality.

2 years agocore/main: fix a typo for --log-target
Mike Yuan [Thu, 13 Apr 2023 15:04:49 +0000 (23:04 +0800)] 
core/main: fix a typo for --log-target

Follow-up for d2ebd50d7f9740dcf30e84efc75610af173967d2

Fixes #27105

2 years agotest: add some tests for RuntimeMaxSec 27144/head
Nick Rosbrook [Thu, 13 Apr 2023 15:29:32 +0000 (11:29 -0400)] 
test: add some tests for RuntimeMaxSec

Make sure the RuntimeMaxSec is applied correctly to service and scope
units when they are started, and also on coldplug.

2 years agoscope: do not disable timer event source when state is SCOPE_RUNNING
Nick Rosbrook [Tue, 4 Apr 2023 22:39:26 +0000 (18:39 -0400)] 
scope: do not disable timer event source when state is SCOPE_RUNNING

In scope_set_state(), the timer event source may be disabled depending
on the state. Currently, it will be disabled when the state is
SCOPE_RUNNING. This has the effect of new RuntimeMaxSec values being
ignored on coldplug.

Note that this issue is not currently present when scopes are started
because when scope_start() is called, scope_arm_timer() is called after
scope_set_state().

2 years agosystemd-confext: mount confexts as noexec and nosuid
Luca Boccassi [Thu, 6 Apr 2023 11:19:22 +0000 (12:19 +0100)] 
systemd-confext: mount confexts as noexec and nosuid

Confexts should not contain code, so mount confexts with noexec.
We cannot mount invidial extensions as noexec, as the overlay ignores
it and bypasses it, we need to use the flag on the whole overlay for
it to be effective.
But given there are legacy scripts still shipped in /etc, allow to
override it with --noexec=false.

2 years agomkosi: Update to latest
Daan De Meyer [Wed, 12 Apr 2023 15:27:06 +0000 (17:27 +0200)] 
mkosi: Update to latest

The Bootable= option was removed and mkosi installs less packages
by default now, so let's adapt our configs to those changes.

2 years agoUphold/StopWhenUnneeded/BindsTo: requeue when job finishes 27244/head
Luca Boccassi [Wed, 12 Apr 2023 20:37:45 +0000 (21:37 +0100)] 
Uphold/StopWhenUnneeded/BindsTo: requeue when job finishes

When a unit is upheld and fails, and there are no state changes in
the upholder, it will not be retried, which is against what the
documentation suggests.

Requeue when the job finishes. Same for the other two queues.

2 years agosystemd-cryptenroll: add string aliases for tpm2 PCRs
OMOJOLA JOSHUA DAMILOLA [Thu, 30 Mar 2023 07:55:41 +0000 (07:55 +0000)] 
systemd-cryptenroll: add string aliases for tpm2 PCRs
Fixes #26697. RFE.

2 years agotest: add several assertions
Yu Watanabe [Thu, 13 Apr 2023 05:29:51 +0000 (14:29 +0900)] 
test: add several assertions

Follow-up for 7947dbe322a922604f3a5b29693e58b370161ad5.

Fixes CID#1508781 and CID#1508783.

2 years agoMerge pull request #18789 from gportay/veritysetup-add-options-for-parity-with-crypts...
Lennart Poettering [Thu, 13 Apr 2023 09:32:57 +0000 (11:32 +0200)] 
Merge pull request #18789 from gportay/veritysetup-add-options-for-parity-with-cryptsetup-verity-utility

veritysetup: Add options for parity support with the cryptsetup's verity utility

2 years agoimage-policy: introduce parse_image_policy_argument() helper
Yu Watanabe [Wed, 12 Apr 2023 13:38:01 +0000 (22:38 +0900)] 
image-policy: introduce parse_image_policy_argument() helper

Addresses
https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1060130312,
https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067927293, and
https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067926416.

Follow-up for 84be0c710d9d562f6d2cf986cc2a8ff4c98a138b.

2 years agorepart: Discard from/to first/last usable lba
Sjoerd Simons [Thu, 23 Feb 2023 09:00:16 +0000 (10:00 +0100)] 
repart: Discard from/to first/last usable lba

Repart considers the start and end of the usable space to the first multiple
of grainsz (at least 4096 bytes). However the first usable LBA of a GPT
partition is at sector 34 (512 bytes sectors) which is not a multiple of 4096.
The backup GPT label at the end also takes up 33 sectors, meaning the last
usable LBA is at 34 sectors from the end, unlikely to be a 4096 multiple as
well.

This meant that the very first and last sectors were never discarded. However
more problematically if an existing partition started before the first
usable grainsz multiple its start didn't get taken into account as a valid
starting point and got its data discarded.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2 years agoudev,sd-device: use CMSG_FIND_DATA() more 27254/head
Lennart Poettering [Thu, 13 Apr 2023 08:49:15 +0000 (10:49 +0200)] 
udev,sd-device: use CMSG_FIND_DATA() more

2 years agotree-wide: port more code over to CMSG_TYPED_DATA()
Lennart Poettering [Thu, 13 Apr 2023 08:29:34 +0000 (10:29 +0200)] 
tree-wide: port more code over to CMSG_TYPED_DATA()

2 years agosocket-util: tighten aignment check for CMSG_TYPED_DATA()
Lennart Poettering [Thu, 13 Apr 2023 08:21:31 +0000 (10:21 +0200)] 
socket-util: tighten aignment check for CMSG_TYPED_DATA()

Apparently CMSG_DATA() alignment is very much undefined. Which is quite
an ABI fuck-up, but we need to deal with this. CMSG_TYPED_DATA() already
checks alignment of the specified pointer. Let's also check matching
alignment of the underlying structures, which we already can do at
compile-time.

See: #27241

(This does not fix #27241, but should catch such errors already at
compile-time instead of runtime)

2 years agoMerge pull request #27027 from dtardon/unit-file-list-cleanup
Lennart Poettering [Thu, 13 Apr 2023 07:10:17 +0000 (09:10 +0200)] 
Merge pull request #27027 from dtardon/unit-file-list-cleanup

Use _cleanup_ for UnitFileList hash

2 years agorepart: always take BSD lock when whole block device is opened
Yu Watanabe [Wed, 12 Apr 2023 17:43:52 +0000 (02:43 +0900)] 
repart: always take BSD lock when whole block device is opened

Fixes #27236.

2 years agoMerge pull request #27135 from poettering/pin-fdstore
Lennart Poettering [Thu, 13 Apr 2023 05:16:24 +0000 (07:16 +0200)] 
Merge pull request #27135 from poettering/pin-fdstore

Allow the per-service fdstore to be "pinned", i.e. preserved as long as the unit info remains in memory

2 years agotest: validate that fdstore pinning works 27135/head
Lennart Poettering [Tue, 4 Apr 2023 09:41:55 +0000 (11:41 +0200)] 
test: validate that fdstore pinning works

2 years agopid1: add some debug logging when stashing ds into the fdstore
Lennart Poettering [Wed, 12 Apr 2023 19:07:29 +0000 (21:07 +0200)] 
pid1: add some debug logging when stashing ds into the fdstore

2 years agoservice: rename service_close_socket_fd() → service_release_socket_fd()
Lennart Poettering [Tue, 4 Apr 2023 13:51:07 +0000 (15:51 +0200)] 
service: rename service_close_socket_fd() → service_release_socket_fd()

Just to match service_release_stdio_fd() and service_release_fd_store()
in the name, since they do similar things.

This follows the concept that we "release" resources, and this is all
generically wrapped in "service_release_resources()".

2 years agocore: move runtime directory removal into release_resource handler
Lennart Poettering [Tue, 4 Apr 2023 11:42:08 +0000 (13:42 +0200)] 
core: move runtime directory removal into release_resource handler

We already clear the various fds we keep from the release_resources()
handler, let's also destroy the runtime dir from there if this
preservation mode is selected.

This makes a minor semantic change: previously we'd keep a runtime
directory around if RuntimeDirectoryPreserve=restart is selected and at
least one JOB_START job was around. With this logic we'll keep it around
a tiny bit longer: as long as any job for the unit is around.

2 years agoservice: close fdstore asynchronously
Lennart Poettering [Tue, 4 Apr 2023 10:17:16 +0000 (12:17 +0200)] 
service: close fdstore asynchronously

The file descriptors we keep in the fdstore might be basically anything,
let's clean it up with our asynchronous closing feature, to not
deadlock on close().

(Let's also do the same for stdin/stdout/stderr fds, since they might
point to network services these days.)

2 years agoservice: allow freeing the fdstore via cleaning
Lennart Poettering [Wed, 29 Mar 2023 20:10:01 +0000 (22:10 +0200)] 
service: allow freeing the fdstore via cleaning

Now that we have a potentially pinned fdstore let's add a concept for
cleaning it explicitly on user requested. Let's expose this via
"systemctl clean", i.e. the same way as user directories are cleaned.

2 years agoservice: add ability to pin fd store
Lennart Poettering [Wed, 29 Mar 2023 20:07:22 +0000 (22:07 +0200)] 
service: add ability to pin fd store

Oftentimes it is useful to allow the per-service fd store to survive
longer than for a restart. This is useful in various scenarios:

1. An fd to some security relevant object needs to be stashed somewhere,
   that should not be cleaned automatically, because the security
   enforcement would be dropped then.

2. A user namespace fd should be allocated on first invocation and be
   kept around until the user logs out (i.e. systemd --user ends), á la
   #16328 (This does not implement what #16318 asks for, but should
   solve the use-case discussed there.)

3. There's interest in allow a concept of "userspace reboots" where the
   kernel stays running, and userspace is swapped out (i.e. all services
   exit, and the rootfs transitioned into a new version of it) while
   keeping some select resources pinned, very similar to how we
   implement a switch root. Thus it is useful to allow services to exit,
   while leaving their fds around till the very end.

This is exposed through a new FileDescriptorStorePreserve= setting that
is closely modelled after RuntimeDirectoryPreserve= (in fact it reused
the same internal type), since we want similar behaviour in the end, and
quite often they probably want to be used together.

2 years agoservice: rework how we release resources
Lennart Poettering [Wed, 29 Mar 2023 20:06:39 +0000 (22:06 +0200)] 
service: rework how we release resources

Let's normalize how we release service resources, i.e. the three types
of fds we maintain for each service:

1. the fdstore
2. the socket fd for per-connection socket activated services
3. stdin/stdout/stderr

The generic service_release_resources() hook now calls into
service_release_fd_store() + service_close_socket_fd()
service_release_stdio_fd() one after the other, releasing them all for
the generic "release_resources" infra of the unit lifecycle.

We do no longer close the socket fd from service_set_state(), moving
this exclusively into service_release_resources(), so that all fds are
closed the same way.

2 years agoservice: release resources from a seperate queue, not unit_check_gc()
Lennart Poettering [Wed, 29 Mar 2023 19:52:41 +0000 (21:52 +0200)] 
service: release resources from a seperate queue, not unit_check_gc()

The per-unit-type release_resources() hook (most prominent use: to
release a service unit's fdstore once a unit is entirely dead and has no
jobs more) was currently invoked as part of unit_check_gc(), whose
primary purpose is to determine if a unit should be GC'ed. This was
always a bit ugly, as release_resources() changes state of the unit,
while unit_check_gc() is otherwise (and was before release_resources()
was added) a "passive" function that just checks for a couple of
conditions.

unit_check_gc() is called at various places, including when we wonder if
we should add a unit to the gc queue, and then again when we take it out
of the gc queue to dtermine whether to really gc it now. The fact that
these checks have side effects so far wasn't too problematic, as the
state changes (primarily: that services would empty their fdstores) were
relatively limited and scope.

A later patch in this series is supposed to extend the service state
engine with a separate state distinct from SERVICE_DEAD that is very
much like it but indicates that the service still has active resources
(specifically the fdstore). For cases like that the releasing of the
fdstore would result in state changes (as we'd then return to a classic
SERVICE_DEAD state).  And this is where the fact that the
release_resources() is called as side-effect becomes problematic: it
would mean that unit state changes would instantly propagate to state
changes elsewhere, though we usually want this to be done through the
run queue for coalescing and avoidance of recursion.

Hence, let's clean this up: let's move the release_resources() logic
into a queue of its own, and then enqueue items into it from the general
state change notification handle in unit_notify().

2 years agocore: fix property getter method for NFileDescriptorStore bus property
Lennart Poettering [Wed, 12 Apr 2023 18:51:23 +0000 (20:51 +0200)] 
core: fix property getter method for NFileDescriptorStore bus property

Since da6053d0a7c16795e7fac1f9ba6694863918a597 this is a size_t, not an
unsigned. The difference doesn't matter on LE archs, but it matters on
BE (i.e. s390x), since we'll return entirely nonsensical data.

Let's fix that.

Follow-up-for: da6053d0a7c16795e7fac1f9ba6694863918a597

An embarassing bug introduced in 2018... That made me scratch my head
for way too long, as it made #27135 fail on s390x while it passed
everywhere else.

2 years agoveritysetup: add support for fec options 18789/head
Gaël PORTAY [Sun, 27 Dec 2020 13:55:09 +0000 (08:55 -0500)] 
veritysetup: add support for fec options

The verity fec_* parameters allows to use Forward Error Correction to
recover from corruption if hash verification fails.

This adds the options fec_device, fec_offset and fec_roots (sixth
argument) which are the equivalent of the options --fec-device,
--fec-offset and --fec-roots in the veritysetup world.
 - fec-device=FILE
 - fec-offset=BYTES
 - fec-roots=UINT64

See `veritysetup(8)` for more details.

2 years agoFix cross-reference of manual for LogsDirectory
Franklin Yu [Thu, 13 Apr 2023 00:29:43 +0000 (17:29 -0700)] 
Fix cross-reference of manual for LogsDirectory

2 years agoveritysetup: add support for superblock and underlying options
Gaël PORTAY [Wed, 23 Dec 2020 15:10:15 +0000 (10:10 -0500)] 
veritysetup: add support for superblock and underlying options

The verity parameter no_superblock allows to format/open an hash device
without the superblock. However, the superblock data must be set to open
the data-device.

This adds the option superblocks (sixth argument) and all the underlying
options which are implied to set the superblock manually if hash device
has no superblock:

 - superblock=BOOL
 - format=NUMBER (hash version type, 0 for original ChromeOS, 1 for
   modern)
 - data-block-size=BYTES (max page-size, multiple of 512)
 - hash-block-size=BYTES (max page-size, multiple of 512)
 - data-blocks=BLOCKS (size of data-device in blocks)
 - salt=HEXSTR (salt used at format, max 256 bytes)
 - uuid=UUID
 - hash=STR (algorithm name for dm-verity used at format, default is
   sha256)

See `veritysetup(8)` for more details.

2 years agoveritysetup: add support for hash-offset option
Gaël PORTAY [Fri, 25 Dec 2020 08:08:05 +0000 (03:08 -0500)] 
veritysetup: add support for hash-offset option

The verity parameter hash_area_offset allows to locate the superblock in
the hash device. It can be used to have a single device which contains
both data and hashes.

This adds the option hash-offset=BYTES (sixth argument) which is the
equivalent of the option --hash-offset in the veritysetup world.

See `veritysetup(8)` for more details.

2 years agopid1: fix coredump_filter setting
David Schroeder [Wed, 12 Apr 2023 23:48:21 +0000 (16:48 -0700)] 
pid1: fix coredump_filter setting

Correct what appears to be a copy/paste error in config_parse_exec_coredump_filter that is preventing the coredump_filter setting from working correctly.

2 years agoUphold/StopWhenUnneeded/BindsTo: add retry timer on rate limit
Luca Boccassi [Wed, 12 Apr 2023 19:14:17 +0000 (20:14 +0100)] 
Uphold/StopWhenUnneeded/BindsTo: add retry timer on rate limit

The Upholds= promise is that as long as unit A is up and Upholds=B,
B will be activated if failed or inactive. But there is a hard-coded,
non-configurable rate limit for this, so add a timed retry after the
ratelimit has expired.

Apply to BindsTo= and StopWhenUnneeded= as well.

2 years agoman: add util-linux to the package list for Fedora container
Michal Sekletar [Wed, 12 Apr 2023 16:58:21 +0000 (18:58 +0200)] 
man: add util-linux to the package list for Fedora container

/bin/login is shipped in util-linux, however, systemd.spec on Fedora has
"Requires: (util-linux-core or util-linux)". If the dependency is
fulfilled just by installation of util-linux-core then users won't be
able to log in into the container after it boots. Let's add util-linux
package to the package list so that /bin/login is always present.

2 years agoMerge pull request #27153 from poettering/varlin-fd-pass
Lennart Poettering [Wed, 12 Apr 2023 18:34:01 +0000 (20:34 +0200)] 
Merge pull request #27153 from poettering/varlin-fd-pass

varlink: implement file descriptor passing

2 years agoMerge pull request #27212 from DaanDeMeyer/notify-exit
Mike Yuan [Wed, 12 Apr 2023 17:12:03 +0000 (01:12 +0800)] 
Merge pull request #27212 from DaanDeMeyer/notify-exit

core: Propagate exit status via notify socket when running in VM

2 years agoMerge pull request #27229 from poettering/dissect-policy-confext
Mike Yuan [Wed, 12 Apr 2023 16:14:30 +0000 (00:14 +0800)] 
Merge pull request #27229 from poettering/dissect-policy-confext

dissect: follow-up for image policy merge

2 years agoman: link to Fedora 37
Zbigniew Jędrzejewski-Szmek [Wed, 12 Apr 2023 16:00:49 +0000 (18:00 +0200)] 
man: link to Fedora 37

Fedora 36 is a bit old at this point and will be EOL in about 6 weeks.
Fedora 38 is not out yet, so the cloud link wouldn't work.

2 years agotest: also test client-side operation if applicable 27027/head
David Tardon [Thu, 6 Apr 2023 10:22:36 +0000 (12:22 +0200)] 
test: also test client-side operation if applicable

2 years agosystemctl: fix a memory leak
David Tardon [Wed, 12 Apr 2023 14:59:21 +0000 (16:59 +0200)] 
systemctl: fix a memory leak

valgrind systemctl is-enabled --root=/ -l default.target >/dev/null
==746041== Memcheck, a memory error detector
==746041== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==746041== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==746041== Command: systemctl is-enabled --root=/ -l default.target
==746041==
==746041==
==746041== HEAP SUMMARY:
==746041==     in use at exit: 8,251 bytes in 4 blocks
==746041==   total heap usage: 3,440 allocs, 3,436 frees, 1,163,346 bytes allocated
==746041==
==746041== LEAK SUMMARY:
==746041==    definitely lost: 24 bytes in 1 blocks
==746041==    indirectly lost: 35 bytes in 1 blocks
==746041==      possibly lost: 0 bytes in 0 blocks
==746041==    still reachable: 8,192 bytes in 2 blocks
==746041==         suppressed: 0 bytes in 0 blocks
==746041== Rerun with --leak-check=full to see details of leaked memory
==746041==
==746041== For lists of detected and suppressed errors, rerun with: -s
==746041== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

2 years agoinstall: rename function
David Tardon [Wed, 12 Apr 2023 15:11:52 +0000 (17:11 +0200)] 
install: rename function

2 years agoinstall: drop unused function
David Tardon [Tue, 28 Mar 2023 07:41:56 +0000 (09:41 +0200)] 
install: drop unused function

2 years agotest: use _cleanup_ for UnitFileList hash
David Tardon [Tue, 28 Mar 2023 07:38:33 +0000 (09:38 +0200)] 
test: use _cleanup_ for UnitFileList hash

2 years agosystemctl-list-unit-files: drop workaround for Coverity
David Tardon [Tue, 28 Mar 2023 13:20:12 +0000 (15:20 +0200)] 
systemctl-list-unit-files: drop workaround for Coverity

This partially reverts commit 0da999fada225d2d74b62ec758cd437a3e2f6ebb .

2 years agosystemctl: drop stray assignment
David Tardon [Tue, 28 Mar 2023 07:36:35 +0000 (09:36 +0200)] 
systemctl: drop stray assignment

2 years agosystemctl: use _cleanup_ for UnitFileList hash
David Tardon [Tue, 28 Mar 2023 07:36:14 +0000 (09:36 +0200)] 
systemctl: use _cleanup_ for UnitFileList hash

This also fixes a memory leak in the old code.

valgrind systemctl -t socket --root=/ list-unit-files >/dev/null
==2601899== Memcheck, a memory error detector
==2601899== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2601899== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==2601899== Command: systemctl -t socket --root=/ list-unit-files
==2601899==
==2601899==
==2601899== HEAP SUMMARY:
==2601899==     in use at exit: 39,984 bytes in 994 blocks
==2601899==   total heap usage: 344,414 allocs, 343,420 frees, 2,001,612,404 bytes allocated
==2601899==
==2601899== LEAK SUMMARY:
==2601899==    definitely lost: 7,952 bytes in 497 blocks
==2601899==    indirectly lost: 32,032 bytes in 497 blocks
==2601899==      possibly lost: 0 bytes in 0 blocks
==2601899==    still reachable: 0 bytes in 0 blocks
==2601899==         suppressed: 0 bytes in 0 blocks
==2601899== Rerun with --leak-check=full to see details of leaked memory
==2601899==
==2601899== For lists of detected and suppressed errors, rerun with: -s
==2601899== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

2 years agoMerge pull request #27217 from yuwata/boot-entry-at
Yu Watanabe [Wed, 12 Apr 2023 13:59:54 +0000 (22:59 +0900)] 
Merge pull request #27217 from yuwata/boot-entry-at

boot-entry: introduce _at() variant

2 years agovarlink: honour "sensitive" flag of json variant objects all the way into the socket 27153/head
Lennart Poettering [Wed, 12 Apr 2023 09:21:01 +0000 (11:21 +0200)] 
varlink: honour "sensitive" flag of json variant objects all the way into the socket

Let's honour the flag if it is set, just to be safe.

(This only handles the case for the writing side: whenever the client
code hands us a json object with the flag set we'll honour it till the
it's out of reach for us. This does *not* handle the reading side, which
is left for a later patch once needed. We probably should add a
per-connection flag that simply globally enables the sensitive logic for
all messages coming in on a specific varlink conneciton.)

2 years agotest: add varlink fd passing test
Lennart Poettering [Wed, 5 Apr 2023 13:54:52 +0000 (15:54 +0200)] 
test: add varlink fd passing test

2 years agovarlink: implement file descriptor passing
Lennart Poettering [Wed, 5 Apr 2023 14:03:38 +0000 (16:03 +0200)] 
varlink: implement file descriptor passing

Let's add infrastructure to implement fd passing in varlink, when used
over AF_UNIX.

This will optionally associate one or more fds with a message sent via
varlink and deliver it to the server.

2 years agovarlink: add helper that clears the currently processed incoming message JSON object
Lennart Poettering [Wed, 5 Apr 2023 14:08:15 +0000 (16:08 +0200)] 
varlink: add helper that clears the currently processed incoming message JSON object

Some minor refactoring. This adds a helper call whose only job is to
unref the JSON object of the currently processed incoming message.

This doesn't make too much sense on its own, given this just replaces
one line by another. However, in a later patch when we'll add fd passing
we'll extend the function to also destroy associated fds, and then it
will start to make more sense.

2 years agovarlink: get rid of "reply" field
Lennart Poettering [Wed, 5 Apr 2023 13:57:44 +0000 (15:57 +0200)] 
varlink: get rid of "reply" field

So far, if we do a synchronous varlink call from the client side via
varlink_call(), we'll
move the returned json object from "v->current" into "v->reply", and
keep it referenced there until the next call. We then return a pointer
to it. This ensures that the json object remains valid between two
varlink_call() invocations.

But the thing is, we don't need a separate field for that, we can just
leave the data in "v->current". This means VARLINK_IDLE_CLIENT state
will be permitted with and without v->current initialized. Initially,
after connection setup it will be set to NULL, but after the first
varlink_call() it will be set to the most recent response, pinning it
into memory.

2 years agovarlink: add some comments explaining what by various errors are defined
Lennart Poettering [Wed, 5 Apr 2023 13:53:55 +0000 (15:53 +0200)] 
varlink: add some comments explaining what by various errors are defined

2 years agocore: Send ERRNO= via notify socket on exit 27212/head
Daan De Meyer [Wed, 12 Apr 2023 10:08:27 +0000 (12:08 +0200)] 
core: Send ERRNO= via notify socket on exit

2 years agocore: Propagate exit status via notify socket when running in VM
Daan De Meyer [Tue, 11 Apr 2023 11:17:13 +0000 (13:17 +0200)] 
core: Propagate exit status via notify socket when running in VM

When running in a container, we can propagate the exit status of
pid1 as usual via the process exit status. This is not possible
when running in a VM. Instead, let's send EXIT_STATUS=%i via the
notify socket if one is configured. The user running the VM can then
pick up the exit status from the notify socket after the VM has shut
down.

2 years agonotify: Add EXIT_STATUS field
Daan De Meyer [Wed, 12 Apr 2023 09:56:00 +0000 (11:56 +0200)] 
notify: Add EXIT_STATUS field

Whenever one of our tools or daemons exits, let's send the exit status
via sd-notify in the EXIT_STATUS field.

2 years agosysext: define a default image dissection policy for confext images 27229/head
Lennart Poettering [Wed, 12 Apr 2023 12:27:20 +0000 (14:27 +0200)] 
sysext: define a default image dissection policy for confext images

2 years agodiscover-image: bring discover path list up-to-date.
Lennart Poettering [Wed, 12 Apr 2023 12:26:56 +0000 (14:26 +0200)] 
discover-image: bring discover path list up-to-date.

While merge 3af48a86d99b3117a44bc22258ab4d34d0ba7655 was for a working
PR it was based on an older version of git main. Let's catch up with the
search path changes from de862276eddbbe76b436213b4d427205356d1886.

2 years agoFix compilation error
Daan De Meyer [Wed, 12 Apr 2023 12:11:23 +0000 (14:11 +0200)] 
Fix compilation error

2 years agonspawn: container network interface naming
Thierry Martin [Mon, 5 Sep 2022 13:02:06 +0000 (15:02 +0200)] 
nspawn: container network interface naming

systemd-nspawn now optionally supports colon-separated pair of
host interface name and container interface name for --network-macvlan, --network-ipvlan and --network-interface options.
Also supported in .nspawn configuration files (i.e Interface=, MACVLAN=, IPVLAN= parameters).

man page changed for ntwk interface naming

2 years agoMerge pull request #25608 from poettering/dissect-moar
Lennart Poettering [Wed, 12 Apr 2023 11:46:08 +0000 (13:46 +0200)] 
Merge pull request #25608 from poettering/dissect-moar

dissect: add dissection policies

2 years agoMerge pull request #27165 from poettering/fdstore-envvar
Luca Boccassi [Wed, 12 Apr 2023 11:13:43 +0000 (12:13 +0100)] 
Merge pull request #27165 from poettering/fdstore-envvar

service: tell service processes that the fdstore is available via an e…

2 years agoboot-entry: introduce boot_entry_token_ensure_at() 27217/head
Yu Watanabe [Sat, 8 Apr 2023 17:42:47 +0000 (02:42 +0900)] 
boot-entry: introduce boot_entry_token_ensure_at()

2 years agoMerge pull request #27223 from dtardon/install-changes
Yu Watanabe [Wed, 12 Apr 2023 10:30:51 +0000 (19:30 +0900)] 
Merge pull request #27223 from dtardon/install-changes

Simplify use of bus_deserialize_and_dump_unit_file_changes()

2 years agoMerge pull request #27220 from yuwata/sd-device-follow-ups-for-devlink
Daan De Meyer [Wed, 12 Apr 2023 09:49:08 +0000 (11:49 +0200)] 
Merge pull request #27220 from yuwata/sd-device-follow-ups-for-devlink

sd-device: several follow-ups about devlink creation

2 years agoman: rebreak all of sd_notify(3) 27165/head
Lennart Poettering [Wed, 12 Apr 2023 08:29:14 +0000 (10:29 +0200)] 
man: rebreak all of sd_notify(3)

No change of contents, just some rebreaking of the full file to match
our current line break settings.

2 years agoservice: tell service processes that the fdstore is available via an env var
Lennart Poettering [Wed, 5 Apr 2023 13:48:31 +0000 (15:48 +0200)] 
service: tell service processes that the fdstore is available via an env var

2 years agosystemctl: reduce variable scope 27223/head
David Tardon [Tue, 11 Apr 2023 15:35:38 +0000 (17:35 +0200)] 
systemctl: reduce variable scope

2 years agotree-wide: drop unneeded output params
David Tardon [Tue, 11 Apr 2023 15:25:42 +0000 (17:25 +0200)] 
tree-wide: drop unneeded output params

Neither of the callers of bus_deserialize_and_dump_unit_file_changes()
touches the changes array, so let's simplify things and keep it internal
to the function.

2 years agoMerge pull request #27033 from dtardon/array-cleanup
Yu Watanabe [Wed, 12 Apr 2023 07:43:39 +0000 (16:43 +0900)] 
Merge pull request #27033 from dtardon/array-cleanup

Use CLEANUP_ARRAY more

2 years agoboot-entry: use chase_and_fopen_unlocked() to open /etc/kernel/entry-token
Yu Watanabe [Wed, 12 Apr 2023 07:15:03 +0000 (16:15 +0900)] 
boot-entry: use chase_and_fopen_unlocked() to open /etc/kernel/entry-token

Otherwise, when 'root' is specified, the file may be a symlink to a host
file, and we may read wrong entry.

2 years agoudev-test: add more testcases for SYMLINK 27220/head
Yu Watanabe [Wed, 12 Apr 2023 01:27:07 +0000 (10:27 +0900)] 
udev-test: add more testcases for SYMLINK

2 years agotest: drop binary stripping stuff
Frantisek Sumsal [Tue, 11 Apr 2023 15:23:23 +0000 (17:23 +0200)] 
test: drop binary stripping stuff

Stripping the binaries in the test images makes potential stack straces
quite useless, so let's drop the stripping stuff to make test fails a bit
more developer friendly.

Related: https://github.com/systemd/systemd-centos-ci/pull/616

2 years agosd-device: absolute devlink must start with /dev/
Yu Watanabe [Wed, 12 Apr 2023 00:01:45 +0000 (09:01 +0900)] 
sd-device: absolute devlink must start with /dev/

This also makes device node path is handled with the same logic.

Addresses https://github.com/systemd/systemd/pull/27169#discussion_r1162739511.

Follow-up for 2c5f119c3cc78bd7da0c7c56b57eca43bac464c1.

2 years agoboot-entry: prioritize machine ID only when it is not randomly generated
Yu Watanabe [Wed, 29 Mar 2023 02:14:02 +0000 (11:14 +0900)] 
boot-entry: prioritize machine ID only when it is not randomly generated

Preparation for later commits. The parameter will be used in
kernel-install later.

2 years agoMerge pull request #27214 from DaanDeMeyer/firstboot
Daan De Meyer [Tue, 11 Apr 2023 20:30:09 +0000 (22:30 +0200)] 
Merge pull request #27214 from DaanDeMeyer/firstboot

firstboot: Use root directory file descriptor for everything

2 years agoModified to use STRV_MAKE() in strv_env_name_is_valid() function listed in env-util.c
Tanishka [Tue, 4 Apr 2023 13:00:31 +0000 (18:30 +0530)] 
Modified to use STRV_MAKE() in strv_env_name_is_valid() function listed in env-util.c

2 years agoMerge pull request #27209 from jamacku/patch-1
Zbigniew Jędrzejewski-Szmek [Tue, 11 Apr 2023 18:44:48 +0000 (20:44 +0200)] 
Merge pull request #27209 from jamacku/patch-1

Don't run release workflow on `systemd-security` & drop checkout action

2 years agosystemctl: suppress error for try-* if unit is masked
Mike Yuan [Tue, 4 Apr 2023 14:12:32 +0000 (22:12 +0800)] 
systemctl: suppress error for try-* if unit is masked

Closes #16521

2 years agoboot: Fix alignment of long long inside structs on x86
Jan Janssen [Mon, 10 Apr 2023 09:43:56 +0000 (11:43 +0200)] 
boot: Fix alignment of long long inside structs on x86

On x86 EFI follows the windows ABI, which expects 8-byte aligned long
long. The x86 sysv ELF ABI expects them to be 8-byte aligned when used
alone, but 4-byte aligned when they appear inside of structs:

    struct S {
        int i;
        long long ll;
    };

    // _Static_assert(sizeof(struct S) == 12, "x86 sysv ABI");
    _Static_assert(sizeof(struct S) == 16, "EFI/MS ABI");

To get the behavior we need when building with sysv ELF ABI we need to
pass '-malign-double' to the compiler as done by EDK2.

This in turn will make ubsan unhappy as the stack may not be properly
aligned on entry, so we have to tell the compiler explicitly to re-align
the stack on entry to efi_main.

This fixes loading EFI drivers on x86 that were previously always
rejected as the EFI_LOADED_IMAGE_PROTOCOL had a wrong memory layout.

See also: https://github.com/rhboot/shim/pull/516

2 years agoci: drop checkout from release workflow 27209/head
Jan Macku [Tue, 11 Apr 2023 07:33:46 +0000 (09:33 +0200)] 
ci: drop checkout from release workflow

It's not required as per comment - https://github.com/systemd/systemd/pull/27110#issuecomment-1499653913

2 years agoci: don't run release wf on `systemd-security`
Jan Macku [Tue, 11 Apr 2023 07:30:15 +0000 (09:30 +0200)] 
ci: don't run release wf on `systemd-security`

2 years agoportabled-image-bus: use CLEANUP_ARRAY 27033/head
David Tardon [Tue, 28 Mar 2023 11:44:16 +0000 (13:44 +0200)] 
portabled-image-bus: use CLEANUP_ARRAY

2 years agoportabled-image-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:39:04 +0000 (13:39 +0200)] 
portabled-image-bus: use CLEANUP_ARRAY

2 years agoportabled-image-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:38:18 +0000 (13:38 +0200)] 
portabled-image-bus: use CLEANUP_ARRAY

2 years agoportabled-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:33:48 +0000 (13:33 +0200)] 
portabled-bus: use CLEANUP_ARRAY

2 years agosd-bus: use _cleanup_
David Tardon [Tue, 28 Mar 2023 11:30:26 +0000 (13:30 +0200)] 
sd-bus: use _cleanup_

2 years agosd-bus: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 11:27:02 +0000 (13:27 +0200)] 
sd-bus: use CLEANUP_ARRAY

2 years agoexecute: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:28:13 +0000 (11:28 +0200)] 
execute: use CLEANUP_ARRAY

2 years agoexecute: use more automatic cleanup
David Tardon [Tue, 28 Mar 2023 09:22:35 +0000 (11:22 +0200)] 
execute: use more automatic cleanup

2 years agohwdb: add matrix for Asus BR1100F (#27197)
Bill Peterson [Tue, 11 Apr 2023 14:11:16 +0000 (09:11 -0500)] 
hwdb: add matrix for Asus BR1100F (#27197)

2 years agoexecute: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:17:09 +0000 (11:17 +0200)] 
execute: use CLEANUP_ARRAY

2 years agosystemctl-set-default: use CLEANUP_ARRAY
David Tardon [Tue, 28 Mar 2023 09:05:06 +0000 (11:05 +0200)] 
systemctl-set-default: use CLEANUP_ARRAY