]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
13 months agoMerge pull request #27346 from poettering/pam-fixes
Luca Boccassi [Thu, 27 Apr 2023 19:31:57 +0000 (20:31 +0100)] 
Merge pull request #27346 from poettering/pam-fixes

pam-systemd: be more careful with sharing bus connections

13 months agoshutdown: paranoia – close all fds we might get passed in
Lennart Poettering [Thu, 27 Apr 2023 13:33:01 +0000 (15:33 +0200)] 
shutdown: paranoia – close all fds we might get passed in

We don't expect any fds (beyond 0…2) to be passed from the service
manager into systemd-shutdown, but let's better be safe then sorry.

13 months agopam-systemd: disconnect bus connection when leaving session hook, even on error 27346/head
Lennart Poettering [Thu, 20 Apr 2023 12:02:39 +0000 (14:02 +0200)] 
pam-systemd: disconnect bus connection when leaving session hook, even on error

This adds support for systematically destroying connections in
pam_sm_session_open() even on failure, so that under no circumstances
unserved dbus connection are around while the invoking process waits for
the session to end.  Previously we'd only do this on success, now do it
in all cases.

This matters since so far we suggested people hook pam_systemd into
their pam stacks prefixed with "-", so that login proceeds even if
pam_systemd fails. This however means that in an error case our
cached connection doesn't get disconnected even if the session then is
invoked. This fixes that.

13 months agopam-util: include PID in PAM data field id
Lennart Poettering [Mon, 24 Apr 2023 12:32:54 +0000 (14:32 +0200)] 
pam-util: include PID in PAM data field id

Let's systematically avoid sharing cached busses between processes (i.e.
from parent and child after fork()), by including the PID in the field
name.

With that we're never tempted to use a bus object the parent created in
the child.

(Note this is about *use*, not about *destruction*. Destruction needs to
be checked by other means.)

13 months agotest: dont use anchor char '$' to match a part of a string
Franck Bui [Thu, 27 Apr 2023 07:04:00 +0000 (09:04 +0200)] 
test: dont use anchor char '$' to match a part of a string

When anchoring the pattern using '$' regular expression operator it forces '=~'
operator to match the entire string.

13 months agoMerge pull request #25622 from YHNdnzj/tmpfiles-X-bit-support
Mike Yuan [Thu, 27 Apr 2023 14:40:09 +0000 (22:40 +0800)] 
Merge pull request #25622 from YHNdnzj/tmpfiles-X-bit-support

tmpfiles: add conditionalized execute permission (X) support

13 months agoMerge pull request #27376 from poettering/subcgroup
Lennart Poettering [Thu, 27 Apr 2023 14:37:06 +0000 (16:37 +0200)] 
Merge pull request #27376 from poettering/subcgroup

pid1: add DelegateSubgroup= option

13 months agotest: extend test 19 to also verify DelegateSubgroup= works 27376/head
Lennart Poettering [Thu, 27 Apr 2023 12:15:50 +0000 (14:15 +0200)] 
test: extend test 19 to also verify DelegateSubgroup= works

13 months agonspawn: port over to /supervisor/ subcgroup being delegated to nspawn
Lennart Poettering [Mon, 24 Apr 2023 08:19:28 +0000 (10:19 +0200)] 
nspawn: port over to /supervisor/ subcgroup being delegated to nspawn

Let's make use of the new DelegateSubgroup= feature and delegate the
/supervisor/ subcgroup already to nspawn, so that moving the supervisor
process there is unnecessary.

13 months agoudev: port to DelegateSubgroup=
Lennart Poettering [Fri, 21 Apr 2023 19:06:22 +0000 (21:06 +0200)] 
udev: port to DelegateSubgroup=

13 months agounits: make system service manager create init.scope subcgroup for user service manager
Lennart Poettering [Mon, 24 Apr 2023 08:11:46 +0000 (10:11 +0200)] 
units: make system service manager create init.scope subcgroup for user service manager

This one is basically for free, since the service manager is already
prepared for being invoked in init.scope. Hence let's start it in the
right cgroup right-away.

13 months agocore: change ownership of subcgroup we create recursively, it shall be owned by the...
Lennart Poettering [Mon, 24 Apr 2023 08:05:10 +0000 (10:05 +0200)] 
core: change ownership of subcgroup we create recursively, it shall be owned by the user delegated to

If we create a subcroup (regardless if the '.control' subgroup we
always created or one configured via DelegateSubgroup=) it's inside of
the delegated territory of the cgroup tree, hence it should be owned
fully by the unit's users. Hence do so.

13 months agoexecute: don't apply journal + oomd xattrs to subcgroup
Lennart Poettering [Mon, 24 Apr 2023 08:05:04 +0000 (10:05 +0200)] 
execute: don't apply journal + oomd xattrs to subcgroup

We don't need to apply the journal/oomd xattrs to the subcgroups we add,
since those daemons already look for the xattrs up the tree anyway.
Hence remove this.

This is in particular relevant as it means later changes to the xattr
don#t need to be replicated on the subcgroup either.

13 months agocore: add DelegateSubgroup= setting
Lennart Poettering [Fri, 21 Apr 2023 16:22:35 +0000 (18:22 +0200)] 
core: add DelegateSubgroup= setting

This implements a minimal subset of #24961, but in a lot more
restrictive way: we only allow one level of subcgroup (as that's enough
to address the no-processes in inner cgroups rule), and does not change
anything about threaded cgroup logic or similar, or make any of this new
behaviour mandatory.

All this does is this: all non-control processes we invoke for a unit
we'll invoke in a subgroup by the specified name.

We'll later port all our current services that use cgroup delegation
over to this, i.e. user@.service, systemd-nspawn@.service and
systemd-udevd.service.

13 months agocgroup: rework how we validate/escape cgroups
Lennart Poettering [Fri, 21 Apr 2023 16:14:53 +0000 (18:14 +0200)] 
cgroup: rework how we validate/escape cgroups

Let's clean up validation/escaping of cgroup names. i.e. split out code
that tests if name needs escaping. Return proper error codes, and extend
test a bit.

13 months agotest: tmpfiles: add tests on conditionalized execute bit 25622/head
Mike Yuan [Thu, 9 Mar 2023 12:13:34 +0000 (20:13 +0800)] 
test: tmpfiles: add tests on conditionalized execute bit

13 months agotmpfiles: add conditionalized execute bit (X) support
Mike Yuan [Fri, 16 Dec 2022 16:44:06 +0000 (00:44 +0800)] 
tmpfiles: add conditionalized execute bit (X) support

According to setfacl(1), "the character X stands for
the execute permission if the file is a directory
or already has execute permission for some user."

After this commit, parse_acl() would return 3 acl
objects. The newly-added acl_exec object contains
entries that are subject to conditionalized execute
bit mangling. In tmpfiles, we would iterate the acl_exec
object, check the permission of the target files,
and remove the execute bit if necessary.

Here's an example entry:
A /tmp/test - - - - u:test:rwX

Closes #25114

13 months agoMerge pull request #27413 from yuwata/core-job-cleanups
Yu Watanabe [Thu, 27 Apr 2023 03:29:29 +0000 (12:29 +0900)] 
Merge pull request #27413 from yuwata/core-job-cleanups

core/job: cleanups for job ID

13 months agounits: restrict hugepages fs a bit
Lennart Poettering [Wed, 26 Apr 2023 14:55:42 +0000 (16:55 +0200)] 
units: restrict hugepages fs a bit

suid binaries and device nodes should not be placed there, hence forbid
it.

Of all the API VFS we mount from PID 1 or via a unit file this one is
the only one where we didn't add MS_NODEV/MS_NOSUID. Let's address that,
since there's really no reason why device nodes or suid binaries would
be placed in hugetlbfs.

13 months agocore/service: make service_add_fd_store() always consume provided fd
Yu Watanabe [Sat, 22 Apr 2023 12:03:56 +0000 (21:03 +0900)] 
core/service: make service_add_fd_store() always consume provided fd

No functional change, just refactoring.

13 months agoimage-policy: split out code that "extends" underspecified partition policy flags
Lennart Poettering [Wed, 26 Apr 2023 19:45:35 +0000 (21:45 +0200)] 
image-policy: split out code that "extends" underspecified partition policy flags

When encoding partition policy flags we allow parts of the flags to be
"unspecified" (i.e. entirely zeros), which when actually checking the
policy we'll automatically consider equivalent to "any" (i.e. entirely
ones). This "extension" of the flags was so far done as part of
partition_policy_normalized_flags(). Let's split this logic out into a
new function partition_policy_flags_extend() that simply sets all bits
in a specific part of the flags field if they were entirely zeroes so
far.

When comparing policy objects for equivalence we so far used
partition_policy_normalized_flags() to compare the per-designator flags,
which thus meant that "underspecified" flags, and fully specified ones
that are set to "any" were considered equivalent. Which is great.
However, we forgot to do that for the fallback policy flags, the flags
that apply to all partitions for which no explicit policy flags are
specified.

Let's use the new partition_policy_flags_extend() call to compare them
in extended form, so that there two we can hide the difference between
"underspecified" and "any" flags.

13 months agoman: use ukify more in systemd-measure examples
Zbigniew Jędrzejewski-Szmek [Thu, 12 Jan 2023 08:02:08 +0000 (09:02 +0100)] 
man: use ukify more in systemd-measure examples

ukify supports signing with multiple keys, so show an example of this, and just
let ukify print the calls to systemd-measure that will be done.

This also does other small cleanups:
- Use more realistic names in examples
- Use $ as the prompt for commands that don't require root (most don't).
  Once we switch to operations that don't require a TPM, we should be able to get
  rid of the remaining calls that require root.
- Ellipsize or linebreak various parts
- Use --uname. We warn if it is not specified and we have to do autodetection, so
  let's nudge people towards including it rather than not.

Follow-up for e069c57f0616d39363d36ac7f9c3e6ec8be01ab1.

13 months agoMerge pull request #26877 from yuwata/fuzz-journal-remote
Luca Boccassi [Wed, 26 Apr 2023 23:05:01 +0000 (00:05 +0100)] 
Merge pull request #26877 from yuwata/fuzz-journal-remote

fuzz-journal-remote: several cleanups

13 months agoMerge pull request #27355 from fbuihuu/kbd-improve-vc2x11-conversion
Luca Boccassi [Wed, 26 Apr 2023 22:37:53 +0000 (23:37 +0100)] 
Merge pull request #27355 from fbuihuu/kbd-improve-vc2x11-conversion

locale: improve vc -> x11 keyboard conversion

13 months agoMerge pull request #27421 from bluca/coredump_filter
Luca Boccassi [Wed, 26 Apr 2023 22:22:59 +0000 (23:22 +0100)] 
Merge pull request #27421 from bluca/coredump_filter

CoredumpFilter: fix stack overflow and invalid assignment with 'all'

13 months agoimage-policy: correct two comments
Lennart Poettering [Wed, 26 Apr 2023 19:21:37 +0000 (21:21 +0200)] 
image-policy: correct two comments

13 months agoupdate TODO
Lennart Poettering [Wed, 26 Apr 2023 19:23:42 +0000 (21:23 +0200)] 
update TODO

13 months agoMerge pull request #27415 from DaanDeMeyer/verity-minimize
Daan De Meyer [Wed, 26 Apr 2023 16:55:51 +0000 (18:55 +0200)] 
Merge pull request #27415 from DaanDeMeyer/verity-minimize

repart: Add Minimize= support for verity hash partitions

13 months agoMerge pull request #27419 from yuwata/sd-journal-entry-item
Daan De Meyer [Wed, 26 Apr 2023 16:35:26 +0000 (18:35 +0200)] 
Merge pull request #27419 from yuwata/sd-journal-entry-item

sd-journal: skip invalid entry item

13 months agocore/job: use new job ID when we failed to deserialize job ID 27413/head
Yu Watanabe [Wed, 26 Apr 2023 05:39:56 +0000 (14:39 +0900)] 
core/job: use new job ID when we failed to deserialize job ID

This is for the case when we fail to deserialize job ID.
In job_install_deserialized(), we also check the job type, and that is
for the case when we failed to deserialize the job.
Let's gracefully handle the failure in deserializing the job ID.
This is paranoia, and just for safety. Should not change any behavior.

13 months agocore/job: handle job ID overflow or conflict more sanely
Yu Watanabe [Wed, 26 Apr 2023 05:37:26 +0000 (14:37 +0900)] 
core/job: handle job ID overflow or conflict more sanely

This is paranoia, and just for safety. Should not change any behavior.

13 months agocore/job: fix indentation
Yu Watanabe [Wed, 26 Apr 2023 05:24:12 +0000 (14:24 +0900)] 
core/job: fix indentation

13 months agocore/job: add one more assertion
Yu Watanabe [Wed, 26 Apr 2023 05:23:12 +0000 (14:23 +0900)] 
core/job: add one more assertion

In this stage, the unit should not have installed job of the type.

13 months agocore/transaction: use hashmap_remove_value() to make not remove job with same ID
Yu Watanabe [Wed, 26 Apr 2023 04:59:34 +0000 (13:59 +0900)] 
core/transaction: use hashmap_remove_value() to make not remove job with same ID

When we fail to deserialize job ID, or the current_job_id is overflowed,
we may have jobs with the same ID.
This is paranoia, and just for safety.
Note, we already use hashmap_remove_value() in job_uninstall().

13 months agotest: add coverage for CoredumpFilter=all 27421/head
Luca Boccassi [Wed, 26 Apr 2023 13:32:04 +0000 (14:32 +0100)] 
test: add coverage for CoredumpFilter=all

13 months agocoredump filter: add mask for 'all' using UINT32_MAX, not UINT64_MAX
Luca Boccassi [Wed, 26 Apr 2023 13:19:33 +0000 (14:19 +0100)] 
coredump filter: add mask for 'all' using UINT32_MAX, not UINT64_MAX

The kernel returns ERANGE when UINT64_MAX is passed. Create a mask
and use UINT32_max, which is accepted, so that future bits will also
be set.

13 months agoukify: allow building PE addon
Luca Boccassi [Mon, 17 Apr 2023 23:40:43 +0000 (00:40 +0100)] 
ukify: allow building PE addon

Make the kernel optional too, so that we can easily build and sign a PE addon,
that can be used to carry extra command line options.

13 months agoMerge pull request #27398 from yuwata/udev-rule-negative-match
Zbigniew Jędrzejewski-Szmek [Wed, 26 Apr 2023 14:40:01 +0000 (16:40 +0200)] 
Merge pull request #27398 from yuwata/udev-rule-negative-match

udev-rule: fix negative match

13 months agoMerge pull request #27411 from yuwata/udev-iocost-follow-ups
Zbigniew Jędrzejewski-Szmek [Wed, 26 Apr 2023 14:37:59 +0000 (16:37 +0200)] 
Merge pull request #27411 from yuwata/udev-iocost-follow-ups

udev/iocost: several follow ups

13 months agocoredump filter: fix stack overflow with =all
Luca Boccassi [Wed, 26 Apr 2023 13:18:04 +0000 (14:18 +0100)] 
coredump filter: fix stack overflow with =all

We translate 'all' to UNIT64_MAX, which has a lot more 'f's. Use the
helper macro, since a decimal uint64_t will always be >> than a hex
representation.

root@image:~# systemd-run -t --property CoredumpFilter=all ls /tmp
Running as unit: run-u13.service
Press ^] three times within 1s to disconnect TTY.
*** stack smashing detected ***: terminated
[137256.320511] systemd[1]: run-u13.service: Main process exited, code=dumped, status=6/ABRT
[137256.320850] systemd[1]: run-u13.service: Failed with result 'core-dump'.

13 months agoMerge pull request #27408 from keszybz/creds-missing-message
Zbigniew Jędrzejewski-Szmek [Wed, 26 Apr 2023 12:57:13 +0000 (14:57 +0200)] 
Merge pull request #27408 from keszybz/creds-missing-message

Adjust messages when credentials are missing

13 months agoMerge pull request #26944 from aafeijoo-suse/systemd-network-generator-initrd-fix
Zbigniew Jędrzejewski-Szmek [Wed, 26 Apr 2023 12:55:41 +0000 (14:55 +0200)] 
Merge pull request #26944 from aafeijoo-suse/systemd-network-generator-initrd-fix

network-generator: do not parse kernel command line more than once

13 months agotest: tell dfuzzer to skip Reexecute()
Frantisek Sumsal [Wed, 26 Apr 2023 09:05:40 +0000 (11:05 +0200)] 
test: tell dfuzzer to skip Reexecute()

As described in systemd/systemd#27204 reexecuting the daemon while
running in a systemd-run "session" causes the session end prematurely.
Let's skip the Reexecute() method in dfuzzer and trigger it manually
until the issue is resolved.

13 months agorepart: Add Minimize= support for verity hash partitions 27415/head
Daan De Meyer [Wed, 26 Apr 2023 09:52:54 +0000 (11:52 +0200)] 
repart: Add Minimize= support for verity hash partitions

Fixes #27414

13 months agorepart: Extend error logging for format_verity_hash/sig()
Daan De Meyer [Wed, 26 Apr 2023 09:14:08 +0000 (11:14 +0200)] 
repart: Extend error logging for format_verity_hash/sig()

13 months agosd-journal: make journal_file_copy_entry() return earlier 27419/head
Yu Watanabe [Wed, 26 Apr 2023 11:54:08 +0000 (20:54 +0900)] 
sd-journal: make journal_file_copy_entry() return earlier

13 months agosd-journal: copy boot ID
Yu Watanabe [Wed, 26 Apr 2023 11:37:00 +0000 (20:37 +0900)] 
sd-journal: copy boot ID

The pointer to boot ID may be invalidate by journal_file_move_to_object()
calls in the later loop.

13 months agosd-journal: tighten variable scope
Yu Watanabe [Wed, 26 Apr 2023 11:40:08 +0000 (20:40 +0900)] 
sd-journal: tighten variable scope

13 months agojournal: Don't try to write garbage if journal entry is corrupted
Daan De Meyer [Wed, 26 Apr 2023 11:21:55 +0000 (13:21 +0200)] 
journal: Don't try to write garbage if journal entry is corrupted

If journal_file_data_payload() returns -EBADMSG or -EADDRNOTAVAIL,
we skip the entry and go to the next entry, but we never modify
the number of items that we pass to journal_file_append_entry_internal()
if that happens, which means we could try to append garbage to the
journal file.

Let's keep track of the number of fields we've appended to avoid this
problem.

13 months agorepart: Allow passing target to format_verity_hash()
Daan De Meyer [Wed, 26 Apr 2023 08:16:21 +0000 (10:16 +0200)] 
repart: Allow passing target to format_verity_hash()

Let's allow specifying where the verity hash data should be written
as preparation for adding verity hash partition minimize support.

13 months agorepart: Move partition_defer() out of format_verity_hash/sig()
Daan De Meyer [Wed, 26 Apr 2023 08:09:10 +0000 (10:09 +0200)] 
repart: Move partition_defer() out of format_verity_hash/sig()

To allow re-using format_verity_hash() for minimizing verity hash
partitions.

13 months agorepart: Turn condition into assert
Daan De Meyer [Wed, 26 Apr 2023 08:04:08 +0000 (10:04 +0200)] 
repart: Turn condition into assert

format_verity_hash() should only be called with VERITY_HASH type
partitions, so assert() if that's not the case.

13 months agolocale: when no xvariant match select the entry with an empty xvariant 27355/head
Franck Bui [Thu, 20 Apr 2023 07:47:35 +0000 (09:47 +0200)] 
locale: when no xvariant match select the entry with an empty xvariant

When doing a conversion and the specified 'xc->xvariant' has no match, select
the x11 layout entry with a matching layout and an empty xvariant if such entry
exists. It's still better than no conversion at all.

13 months agoudev/iocost: invert DEVTYPE match 27411/head
Yu Watanabe [Wed, 26 Apr 2023 03:18:40 +0000 (12:18 +0900)] 
udev/iocost: invert DEVTYPE match

No functional change, just refactoring.
Addresses https://github.com/systemd/systemd/pull/23325#discussion_r1171006967.

13 months agoudev/iocost: use ID_MODEL_FROM_DATABASE if exists
Yu Watanabe [Wed, 26 Apr 2023 03:05:36 +0000 (12:05 +0900)] 
udev/iocost: use ID_MODEL_FROM_DATABASE if exists

To make the rule consistent with 'iocost query'.

13 months agoudev/iocost: fix log message
Yu Watanabe [Wed, 26 Apr 2023 03:26:02 +0000 (12:26 +0900)] 
udev/iocost: fix log message

13 months agoudev/iocost: query_named_solution() provides non-NULL model and qos on success
Yu Watanabe [Wed, 26 Apr 2023 03:17:18 +0000 (12:17 +0900)] 
udev/iocost: query_named_solution() provides non-NULL model and qos on success

13 months agoudev/iocost: call get_known_solutions() in apply_solution_for_path()
Yu Watanabe [Wed, 26 Apr 2023 02:56:23 +0000 (11:56 +0900)] 
udev/iocost: call get_known_solutions() in apply_solution_for_path()

Then, the solution name can be logged.

13 months agoudev: use version()
Yu Watanabe [Tue, 25 Apr 2023 10:52:26 +0000 (19:52 +0900)] 
udev: use version()

Fixes #27382.

13 months agoudev/iocost: merge get_known_solutions() and choose_solution()
Yu Watanabe [Wed, 26 Apr 2023 02:34:26 +0000 (11:34 +0900)] 
udev/iocost: merge get_known_solutions() and choose_solution()

As these are always called sequentially.
No functional change, just refactoring.

13 months agoudev/iocost: drop unnecessary initializations
Yu Watanabe [Wed, 26 Apr 2023 02:36:28 +0000 (11:36 +0900)] 
udev/iocost: drop unnecessary initializations

13 months agoudev/iocost: arg_target_solution is always non-NULL
Yu Watanabe [Wed, 26 Apr 2023 02:19:53 +0000 (11:19 +0900)] 
udev/iocost: arg_target_solution is always non-NULL

13 months agoudev/iocost: set default target in parse_config()
Yu Watanabe [Wed, 26 Apr 2023 02:18:42 +0000 (11:18 +0900)] 
udev/iocost: set default target in parse_config()

And make the failure in parsing config critical.

13 months agotest: add test case of negative match for SYMLINK and TAG 27398/head
Yu Watanabe [Tue, 25 Apr 2023 10:14:55 +0000 (19:14 +0900)] 
test: add test case of negative match for SYMLINK and TAG

13 months agoudev-rules: fix negative match rule for SYMLINK and TAG
Yu Watanabe [Tue, 25 Apr 2023 10:09:55 +0000 (19:09 +0900)] 
udev-rules: fix negative match rule for SYMLINK and TAG

Fixes #27396.

13 months agoportablectl: add --extension to bash completion
Luca Boccassi [Tue, 25 Apr 2023 15:45:06 +0000 (16:45 +0100)] 
portablectl: add --extension to bash completion

13 months agoMerge pull request #27409 from mrc0mmand/more-tests
Yu Watanabe [Tue, 25 Apr 2023 23:24:52 +0000 (08:24 +0900)] 
Merge pull request #27409 from mrc0mmand/more-tests

test: add a couple of sanity tests for systemd-creds

13 months agotest: add a couple of sanity tests for systemd-creds 27409/head
Frantisek Sumsal [Tue, 25 Apr 2023 16:32:07 +0000 (18:32 +0200)] 
test: add a couple of sanity tests for systemd-creds

13 months agocreds: make --pretty behave in a slightly more expected manner
Frantisek Sumsal [Tue, 25 Apr 2023 10:58:15 +0000 (12:58 +0200)] 
creds: make --pretty behave in a slightly more expected manner

13 months agotest: cover missed stuff from securebits-util.h
Frantisek Sumsal [Tue, 18 Apr 2023 10:10:36 +0000 (12:10 +0200)] 
test: cover missed stuff from securebits-util.h

13 months agoresolved: adjust message about credentials 27408/head
Zbigniew Jędrzejewski-Szmek [Tue, 25 Apr 2023 15:59:22 +0000 (17:59 +0200)] 
resolved: adjust message about credentials

"credential provided widget" would be better spelled as "credential-provided widget".
But let's adjust the message to name the bad credential explicitly: this
makes it easier to fix for the user.

13 months agoshared/creds-util: return 0 for missing creds in read_credential_strings_many
Zbigniew Jędrzejewski-Szmek [Tue, 25 Apr 2023 15:58:34 +0000 (17:58 +0200)] 
shared/creds-util: return 0 for missing creds in read_credential_strings_many

Realistically, the only thing that the caller can do is ignore failures related
to missing credentials. If the caller requires some credentials to be present,
they should just check which output variables are not NULL. One of the callers
was already doing that, and the other wanted to, but missed -ENOENT. By
suppressing -ENOENT and -ENXIO, both callers are simplified.

Fixes a warning at boot:
systemd-vconsole-setup[221]: Failed to import credentials, ignoring: No such file or directory

13 months agoSupport /etc/system-update for OSTree systems
Eric Curtin [Mon, 17 Apr 2023 21:09:24 +0000 (22:09 +0100)] 
Support /etc/system-update for OSTree systems

This is required when / is immutable and cannot be written at runtime.

Co-authored-by: Richard Hughes <richard@hughsie.com>
13 months agoMerge pull request #27347 from bluca/sd_bus_nonce
Lennart Poettering [Tue, 25 Apr 2023 15:40:15 +0000 (17:40 +0200)] 
Merge pull request #27347 from bluca/sd_bus_nonce

sd: avoid closing sd-bus in a fork, store module-global id for sd-bus/sd-session/sd-journal

13 months agomount-util: split remount_idmap() in two
Lennart Poettering [Tue, 14 Mar 2023 21:55:32 +0000 (22:55 +0100)] 
mount-util: split remount_idmap() in two

This will make things a bit longer for now, but more powerful as we can
reuse the userns fd between calls to remount_idmap() if we need to
adjust multiple mounts.

No change in behaviour, just some minor refactoring.

13 months agosd-daemon: add sd_pid_notifyf_with_fds()
Lennart Poettering [Fri, 14 Apr 2023 15:48:47 +0000 (17:48 +0200)] 
sd-daemon: add sd_pid_notifyf_with_fds()

I guess it was only a question of time until we need to add the final
frontier of notification functions: one that combines the features of
all the others:

1. specifiying a source PID
2. taking a list of fds to send along
3. accepting a format string for the status string

Hence, let's add it.

13 months agopam: do not attempt to close sd-bus after fork in pam_end()
Luca Boccassi [Thu, 20 Apr 2023 11:55:06 +0000 (12:55 +0100)] 
pam: do not attempt to close sd-bus after fork in pam_end()

When pam_end() is called after a fork, and it cleans up caches, it sets
PAM_DATA_SILENT in error_status. FDs will be shared with the parent, so
we do not want to attempt to close them from a child process, or we'll
hit assertions. Complain loudly and skip.

13 months agoman: /usr/lib/systemd/random-seed -> /usr/lib/systemd/systemd-random-seed
Vitaly Kuznetsov [Tue, 25 Apr 2023 14:51:09 +0000 (16:51 +0200)] 
man: /usr/lib/systemd/random-seed -> /usr/lib/systemd/systemd-random-seed

/usr/lib/systemd/random-seed is not a thing.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
13 months agologind: always use 64bit session IDs
Lennart Poettering [Tue, 25 Apr 2023 10:02:32 +0000 (12:02 +0200)] 
logind: always use 64bit session IDs

it's a bit confusing that on 32bit systems we'd risk session IDs
overruns like this. Let's expose the same behaviour everywhere and stick
to 64bit ids.

Since we format the ids as strings anyway this doesn't really change
anything performance-wise, it just pushes out collisions by overrun to
basically never happen.

13 months agodocs: fix LoadCredentialEncrypted example (#27387)
Lawrence Thorpe [Tue, 25 Apr 2023 13:41:01 +0000 (14:41 +0100)] 
docs: fix LoadCredentialEncrypted example (#27387)

Embedded credential name 'ciphertext.cred' does not match filename 'foobar', refusing.

13 months agosd-login: add SetTTY session object #26611
Thorsten Kukuk [Wed, 19 Apr 2023 14:11:55 +0000 (16:11 +0200)] 
sd-login: add SetTTY session object #26611

13 months agodoc: say in CODING_STYLE that AT_EMPTY_PATH should be implied on openat() style APIs...
Lennart Poettering [Tue, 25 Apr 2023 11:56:20 +0000 (13:56 +0200)] 
doc: say in CODING_STYLE that AT_EMPTY_PATH should be implied on openat() style APIs (and NULL path is OK)

As discussed here:

https://github.com/systemd/systemd/pull/27397#issuecomment-1521630044

13 months agouser-record-nss: make return values optional
Lennart Poettering [Tue, 14 Mar 2023 16:23:25 +0000 (17:23 +0100)] 
user-record-nss: make return values optional

If we only want to know if some user ID/user name is already allocated,
we don't care for the returned data.

13 months agomountpoint-util: make path_get_mnt_id_at() work with a NULL path
Lennart Poettering [Thu, 20 Apr 2023 16:42:36 +0000 (18:42 +0200)] 
mountpoint-util: make path_get_mnt_id_at() work with a NULL path

13 months agosd-event: store and compare per-module static origin id 27347/head
Luca Boccassi [Tue, 25 Apr 2023 00:46:22 +0000 (01:46 +0100)] 
sd-event: store and compare per-module static origin id

sd-event objects use hashmaps, which use module-global state, so it is not safe
to pass a sd-event object created by a module instance to another module instance
(e.g.: when two libraries static linking sd-event are pulled in a single process).
Initialize a random per-module origin id and store it in the object, and compare
it when entering a public API, and error out if they don't match, together with
the PID.

13 months agosd-journal: store and compare per-module static origin id
Luca Boccassi [Tue, 25 Apr 2023 00:08:46 +0000 (01:08 +0100)] 
sd-journal: store and compare per-module static origin id

sd-journal objects use hashmaps, which use module-global state, so it is not safe
to pass a sd-journal object created by a module instance to another module instance
(e.g.: when two libraries static linking sd-journal are pulled in a single process).
Initialize a random per-module origin id and store it in the object, and compare
it when entering a public API, and error out if they don't match, together with
the PID.

13 months agosd-bus: store and compare per-module static origin id
Luca Boccassi [Mon, 24 Apr 2023 23:56:06 +0000 (00:56 +0100)] 
sd-bus: store and compare per-module static origin id

sd-bus objects use hashmaps, which use module-global state, so it is not safe
to pass a sd-bus object created by a module instance to another module instance
(e.g.: when two libraries static linking sd-bus are pulled in a single process).
Initialize a random per-module origin id and store it in the object, and compare
it when entering a public API, and error out if they don't match, together with
the PID.

13 months agomacro: add helper for module origin id
Luca Boccassi [Mon, 24 Apr 2023 23:37:51 +0000 (00:37 +0100)] 
macro: add helper for module origin id

These need to be redefined in every module that we need to guard, so add
a macro

13 months agoMerge pull request #27261 from keszybz/test-cleanup
Frantisek Sumsal [Tue, 25 Apr 2023 09:41:27 +0000 (11:41 +0200)] 
Merge pull request #27261 from keszybz/test-cleanup

Cleanup syntax and use idiomatic bash in test scripts

13 months agofs-util: make sure open_mkdir_at() does something roughly sensible when invoked with '/'
Lennart Poettering [Thu, 20 Apr 2023 16:44:21 +0000 (18:44 +0200)] 
fs-util: make sure open_mkdir_at() does something roughly sensible when invoked with '/'

13 months agoMerge pull request #27380 from poettering/bpf-meson-tweaks
Yu Watanabe [Tue, 25 Apr 2023 09:37:36 +0000 (18:37 +0900)] 
Merge pull request #27380 from poettering/bpf-meson-tweaks

two bpf build system changes

13 months agomkosi: Update fedora to release 38
Daan De Meyer [Tue, 25 Apr 2023 08:14:42 +0000 (10:14 +0200)] 
mkosi: Update fedora to release 38

13 months agoMerge pull request #27388 from poettering/assert-fd
Lennart Poettering [Tue, 25 Apr 2023 07:54:20 +0000 (09:54 +0200)] 
Merge pull request #27388 from poettering/assert-fd

add ASSERT_FD() similar to ASSERT_PTR(), but for fds

13 months agoDrop log level of header limits log message
Daan De Meyer [Mon, 24 Apr 2023 18:55:15 +0000 (20:55 +0200)] 
Drop log level of header limits log message

Especially when using in-memory logging, these are too noisy so
let's drop them back to debug level.

13 months agoMerge pull request #27386 from dtardon/test-cleanup
Luca Boccassi [Tue, 25 Apr 2023 01:00:56 +0000 (02:00 +0100)] 
Merge pull request #27386 from dtardon/test-cleanup

More automatic cleanup in tests

13 months agocryptsetup-fido2: Depend on libcryptsetup
Wolfgang Müller [Mon, 24 Apr 2023 18:00:56 +0000 (20:00 +0200)] 
cryptsetup-fido2: Depend on libcryptsetup

crypsetup-fido2 always depended on both libfido2 and libcryptsetup, but
0a8e026e825dda142a8f1552a4b45815cbfd0b48 forgot to make the then
implicit dependency on libcryptsetup explicit when moving it from
cryptsetup/ to shared/. This breaks builds when libfido2 is autodetected
but the system is missing libcryptsetup.

Introduce an explicit check for HAVE_LIBCRYPTSETUP such that
cryptsetup-fido2 is only built when both libraries are available.

Fixes #27374.

13 months agosd-bus: check for pid change before closing
Luca Boccassi [Thu, 20 Apr 2023 00:24:42 +0000 (01:24 +0100)] 
sd-bus: check for pid change before closing

If we try to close after a fork, the FDs will have been cloned
too and we'll assert. This can happen for example in PAM modules.

Avoid the macro and define ref/unref by hand to do the same check.

13 months agohomed: rename make_userns() to avoid name conflict with mount-util.[ch]
Lennart Poettering [Tue, 14 Mar 2023 21:48:25 +0000 (22:48 +0100)] 
homed: rename make_userns() to avoid name conflict with mount-util.[ch]

This doesn't really matter too much as both are static functions. But
it's confusing as hell both when debugging and reading code, given that
homed actually uses mount-util.c

Hence, let's just rename one of the two, to minimize confusion.

No actual change in behaviour.

(and sooner or later we might want to export mount-util.c's version of
the function, since it's generically useful)

13 months agoMerge pull request #27113 from keszybz/variable-expansion-rework
Zbigniew Jędrzejewski-Szmek [Mon, 24 Apr 2023 20:03:06 +0000 (22:03 +0200)] 
Merge pull request #27113 from keszybz/variable-expansion-rework

Rework serialization of command lines in pid1 and make run not expand variables

13 months agotest: use idiomatic bash loop iteration 27261/head
Zbigniew Jędrzejewski-Szmek [Fri, 7 Apr 2023 08:17:15 +0000 (10:17 +0200)] 
test: use idiomatic bash loop iteration

In a few cases, also avoid a sleep in the last (failed) iteration of the loop.
It doesn't matter too much, but it's still ugly.