]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoukify: Require specifying --tools for each tools directory 25912/head
Daan De Meyer [Mon, 2 Jan 2023 13:53:47 +0000 (14:53 +0100)] 
ukify: Require specifying --tools for each tools directory

Instead of consuming N arguments as tools directories, let's always
only consume one argument per specification of --tools. This avoids
issues where the linux image and initrd are interpreted as tools
directories.

2 years agoukify: Handle directories in path_is_readable()
Daan De Meyer [Mon, 2 Jan 2023 13:52:49 +0000 (14:52 +0100)] 
ukify: Handle directories in path_is_readable()

2 years agoUpdate 60-sensor.hwdb
Gio [Fri, 30 Dec 2022 22:23:50 +0000 (17:23 -0500)] 
Update 60-sensor.hwdb

Updated DBook D10 / Juno Tablet. Before the bvr (bios version) was hard coded to v1.05. This will read all versions

2 years agomachined: pass shell command line to polkit
Ludwig Nussel [Wed, 28 Dec 2022 13:00:35 +0000 (14:00 +0100)] 
machined: pass shell command line to polkit

Pass the joined arguments to polkit as command_line property like
pkexec does. Obviously not exactly perfect as it lacks quoting. Good
enough for polkit rules to check whether a program was called with
or without arguments though.

2 years agoMerge pull request #25864 from yuwata/dissect-fix-mtree
Luca Boccassi [Mon, 26 Dec 2022 16:43:27 +0000 (17:43 +0100)] 
Merge pull request #25864 from yuwata/dissect-fix-mtree

dissect: fix mtree

2 years agoPrevents airplane mode toggle for HP Spectre 16
Hannoskaj [Mon, 26 Dec 2022 08:43:36 +0000 (09:43 +0100)] 
Prevents airplane mode toggle for HP Spectre 16

2 years agoboot: don't convert the trailing newline in mangle_stub_cmdline()
Jia Zhang [Sun, 25 Dec 2022 04:29:11 +0000 (12:29 +0800)] 
boot: don't convert the trailing newline in mangle_stub_cmdline()

It is pretty convenient to add .cmdline using /proc/cmdline like
this:
  --add-section .cmdline=/proc/cmdline --change-section-vma .cmdline=0x25000

However, it always returns a trailing newline, and stub will
convert it to a whitespace by mangle_stub_cmdline() in next boot.
Thus the resulting /proc/cmdline would contain a trailing
whitespace. When /proc/cmdline is used to generate .cmdline again,
the resulting UKI is mangled.

To address this kind of inconvenience, mangle_stub_cmdline() should
skip converting the trailing newline, and try to chomp all the
trailing whitespaces.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2 years agodissect: reduce indent in mtree_print_item() 25864/head
Yu Watanabe [Mon, 26 Dec 2022 07:38:40 +0000 (16:38 +0900)] 
dissect: reduce indent in mtree_print_item()

2 years agodissect: do not trigger assertion on error
Yu Watanabe [Mon, 26 Dec 2022 07:41:17 +0000 (16:41 +0900)] 
dissect: do not trigger assertion on error

recurse_dir() does not provide 'sx' on error.

Fixes #25862.

2 years agodissect: use assert() when no side effect
Yu Watanabe [Mon, 26 Dec 2022 07:35:24 +0000 (16:35 +0900)] 
dissect: use assert() when no side effect

2 years agoMerge pull request #25850 from poettering/switch-root-tweaks-minor
Lennart Poettering [Sat, 24 Dec 2022 10:20:02 +0000 (11:20 +0100)] 
Merge pull request #25850 from poettering/switch-root-tweaks-minor

pid1: minor tweaks to the SwitchRoot() logic

2 years agoMerge pull request #25828 from poettering/no-more-basename
Yu Watanabe [Fri, 23 Dec 2022 23:13:00 +0000 (08:13 +0900)] 
Merge pull request #25828 from poettering/no-more-basename

convert a number of basename() invocations to path_extract_filename()

2 years agoprioq: make prioq_reshuffle() void
Lennart Poettering [Fri, 23 Dec 2022 17:49:02 +0000 (18:49 +0100)] 
prioq: make prioq_reshuffle() void

We never use the return value, and it's confusing and kinda pointless
what we return there.

Hence drop it.

Originally noticed by: tristone13th <tristone13th@outlook.com>

Alternative to: #25810

2 years agoMerge pull request #25849 from poettering/repart-loop
Lennart Poettering [Fri, 23 Dec 2022 22:26:00 +0000 (23:26 +0100)] 
Merge pull request #25849 from poettering/repart-loop

pull in loop.ko from repart unit

2 years agodocs: remove /dev/tty* confusion
Lennart Poettering [Fri, 23 Dec 2022 17:39:54 +0000 (18:39 +0100)] 
docs: remove /dev/tty* confusion

The text said /dev/tty* as a whole was the VT subsystem and that VT is
not supported in containers.

But that's not accurate as /dev/tty* will match /dev/tty too and that
one device node is special and is not related to VT: it always points to
the current process own controlling tty, regardless what that is.

hence, rewrite /dev/tty* as /dev/tty[0-9]*.

2 years agosysroot: Order systemd-fsck-root after systemd-makefs
Will Fancher [Sat, 17 Dec 2022 20:06:21 +0000 (15:06 -0500)] 
sysroot: Order systemd-fsck-root after systemd-makefs

2 years agosystemctl: rework how we detect if init is systemd 25850/head
Lennart Poettering [Fri, 23 Dec 2022 17:27:33 +0000 (18:27 +0100)] 
systemctl: rework how we detect if init is systemd

2 years agocore: use chase_symlinks_and_access() where appropriate
Lennart Poettering [Thu, 22 Dec 2022 09:30:02 +0000 (10:30 +0100)] 
core: use chase_symlinks_and_access() where appropriate

2 years agocore: tighten validation checks in SwitchRoot() dbus call
Lennart Poettering [Thu, 22 Dec 2022 09:28:05 +0000 (10:28 +0100)] 
core: tighten validation checks in SwitchRoot() dbus call

2 years agolock-file: various updates 25828/head
Lennart Poettering [Thu, 22 Dec 2022 09:56:56 +0000 (10:56 +0100)] 
lock-file: various updates

2 years agoanalyze: basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 16:12:13 +0000 (17:12 +0100)] 
analyze: basename() → path_extract_filename()

2 years agoformat-table: add field type TABLE_PATH_BASENAME
Lennart Poettering [Wed, 21 Dec 2022 16:06:14 +0000 (17:06 +0100)] 
format-table: add field type TABLE_PATH_BASENAME

This is just like TABLE_PATH, but only shows the basename in regular
tabular output.

This is useful in systemd-repart for example

2 years agotmpfiles: port basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:52:07 +0000 (16:52 +0100)] 
tmpfiles: port basename() → path_extract_filename()

2 years agosysv-generator: port basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:51:48 +0000 (16:51 +0100)] 
sysv-generator: port basename() → path_extract_filename()

2 years agoshared: port various shared helpers basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:51:05 +0000 (16:51 +0100)] 
shared: port various shared helpers basename() → path_extract_filename()

2 years agounits: pull in loop.ko and dm-mod.ko before repart 25849/head
Lennart Poettering [Fri, 23 Dec 2022 16:23:14 +0000 (17:23 +0100)] 
units: pull in loop.ko and dm-mod.ko before repart

We want to make use of that when formatting file systems, hence let's
pull in these modules explicitly.

(This is necessary because we are an early boot service that might run
before systemd-tmpfiles-dev.service, which creates /dev/loop-control and
/dev/mapper/control.)

Alternatively we could just order ourselves after
systemd-tmpfiles-dev.service, but I think there's value in adding an
explicit minimal ordering here, since we know what we'll need.

Fixes: #25775
2 years agounits: change modprobe@dm-mod.service → modprobe@dm_mod.service
Lennart Poettering [Fri, 23 Dec 2022 16:23:00 +0000 (17:23 +0100)] 
units: change modprobe@dm-mod.service → modprobe@dm_mod.service

Follow-up for 8f1359bf854e9683e4e0b89fd3a537e0d82d4b95

2 years agorepart/makefs: port over to path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:50:18 +0000 (16:50 +0100)] 
repart/makefs: port over to path_extract_filename()

2 years agoportable: port basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:49:30 +0000 (16:49 +0100)] 
portable: port basename() → path_extract_filename()

2 years agonspawn: port over basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:49:03 +0000 (16:49 +0100)] 
nspawn: port over basename() → path_extract_filename()

2 years agomount-tool: port over basename() → path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:48:25 +0000 (16:48 +0100)] 
mount-tool: port over basename() → path_extract_filename()

2 years agojournalctl: port COMM= matching to path_extract_filename()
Lennart Poettering [Wed, 21 Dec 2022 15:47:41 +0000 (16:47 +0100)] 
journalctl: port COMM= matching to path_extract_filename()

2 years agodissect: remove one more use of basename()
Lennart Poettering [Wed, 21 Dec 2022 15:46:28 +0000 (16:46 +0100)] 
dissect: remove one more use of basename()

And while we are at it, make use of path_extract_filename() return value
that indicates whether the path was suffixed with a slash.

2 years agocore: move some basename() use → path_extract_filename()
Lennart Poettering [Thu, 22 Dec 2022 17:45:27 +0000 (18:45 +0100)] 
core: move some basename() use → path_extract_filename()

2 years agotests: we don't actually use basename() anymore
Lennart Poettering [Wed, 21 Dec 2022 15:13:23 +0000 (16:13 +0100)] 
tests: we don't actually use basename() anymore

2 years agohomed: move away from basename()
Lennart Poettering [Wed, 21 Dec 2022 13:50:04 +0000 (14:50 +0100)] 
homed: move away from basename()

2 years agomeasure: fix the failures of compare_reported_pcr_nr()
Jia Zhang [Fri, 23 Dec 2022 09:23:36 +0000 (17:23 +0800)] 
measure: fix the failures of compare_reported_pcr_nr()

EFI_LOADER_VARIABLE() already applies to the stringify to construct the
path of EFI variable in efivars, so it is wrong to enclose the name of
EFI variable with the quotes. Otherwise, the following errors are
reported.

Reading EFI variable /sys/firmware/efi/efivars/StubFeatures-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
Reading EFI variable /sys/firmware/efi/efivars/"StubPcrKernelImage"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
open("/sys/firmware/efi/efivars/"StubPcrKernelImage"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f") failed: No such file or directory
Reading EFI variable /sys/firmware/efi/efivars/"StubPcrKernelParameters"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
open("/sys/firmware/efi/efivars/"StubPcrKernelParameters"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f") failed: No such file or directory
Reading EFI variable /sys/firmware/efi/efivars/"StubPcrInitRDSysExts"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f.
open("/sys/firmware/efi/efivars/"StubPcrInitRDSysExts"-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f") failed: No such file or directory

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
2 years agoMerge pull request #25823 from poettering/dissect-diskseq
Yu Watanabe [Fri, 23 Dec 2022 13:11:59 +0000 (22:11 +0900)] 
Merge pull request #25823 from poettering/dissect-diskseq

gpt-auto: reference dissected partitions to mount via diskseq block device symlinks

2 years agotree-wide: have_effective_cap() may return negative errno
Yu Watanabe [Fri, 23 Dec 2022 08:29:40 +0000 (17:29 +0900)] 
tree-wide: have_effective_cap() may return negative errno

2 years agoMerge pull request #25830 from yuwata/wait-online-unmanaged
Yu Watanabe [Fri, 23 Dec 2022 13:10:38 +0000 (22:10 +0900)] 
Merge pull request #25830 from yuwata/wait-online-unmanaged

wait-online: exit with success when all interfaces are ready or unmanaged

2 years agoMerge pull request #25777 from PeterCxy/enroll-fido2
Lennart Poettering [Fri, 23 Dec 2022 12:14:14 +0000 (13:14 +0100)] 
Merge pull request #25777 from PeterCxy/enroll-fido2

cryptenroll: Implement support for unlocking via FIDO2 tokens

2 years agoupdate TODO 25823/head
Lennart Poettering [Wed, 21 Dec 2022 13:32:22 +0000 (14:32 +0100)] 
update TODO

2 years agogpt-auto-generator: enable referencing partitions via diskseq symlinks
Lennart Poettering [Wed, 21 Dec 2022 11:28:31 +0000 (12:28 +0100)] 
gpt-auto-generator: enable referencing partitions via diskseq symlinks

2 years agodissect-image: optionally, reference dissected partition device nodes by diskseq
Lennart Poettering [Wed, 21 Dec 2022 11:26:21 +0000 (12:26 +0100)] 
dissect-image: optionally, reference dissected partition device nodes by diskseq

This is useful to make the dissection logic at boot a bit safer, as we
can reference device nodes by diskseq.

This locks down dissection a bit, since it makes it harder to swap out
the backing device between the time we dissected and validated it, until
we actually mounted it.

This is not complete though, as /bin/mount would have to verify the
diskseq after opening the diskseq symlink again.

See: https://github.com/util-linux/util-linux/issues/1786

2 years agodissect-image: simplify things by avoiding one string copy
Lennart Poettering [Wed, 21 Dec 2022 11:25:32 +0000 (12:25 +0100)] 
dissect-image: simplify things by avoiding one string copy

We don't need the node in its original variable anymore, hence let's
just move it over instead of allocating a copy.

2 years agoudev: also create partition /dev/disk/by-diskseq/ symlinks
Lennart Poettering [Wed, 21 Dec 2022 11:24:41 +0000 (12:24 +0100)] 
udev: also create partition /dev/disk/by-diskseq/ symlinks

2 years agoimport-creds: don't try to import VM creds in a container
Lennart Poettering [Thu, 22 Dec 2022 16:57:56 +0000 (17:57 +0100)] 
import-creds: don't try to import VM creds in a container

If we run in a container we shouldn#t try to import creds passed in from
a VMM, as they are not for us, but for the VM itself.

2 years agocryptenroll: Implement support for unlocking via FIDO2 tokens 25777/head
Peter Cai [Sun, 18 Dec 2022 01:33:05 +0000 (20:33 -0500)] 
cryptenroll: Implement support for unlocking via FIDO2 tokens

This allows FIDO2 users to wipe out password slots and still be able to
enroll new key slots via systemd-cryptenroll. Note that when the user
wants to both unlock with a FIDO2 token and enroll a new FIDO2 token,
they cannot be set to automatic discovery. This is to safeguard against
confusion, because there will be multiple tokens connected to the system
when doing so -- and we require users to explicitly confirm which one to
use for unlocking and which one to use for enrollment.

Addresses #20230 for the FIDO2 case.

2 years agoMerge pull request #25814 from DaanDeMeyer/ukify
Luca Boccassi [Thu, 22 Dec 2022 21:19:05 +0000 (22:19 +0100)] 
Merge pull request #25814 from DaanDeMeyer/ukify

ukify: Prefer using llvm-objcopy instead of objcopy

2 years agocryptsetup-fido2: Remove plain mode parameters from `acquire_fido2_key_auto()`
Peter Cai [Sun, 18 Dec 2022 01:28:51 +0000 (20:28 -0500)] 
cryptsetup-fido2: Remove plain mode parameters from `acquire_fido2_key_auto()`

`acquire_fido2_key_auto()` will not be used in PLAIN mode, and
parameters such as the salt will be acquired from the LUKS header.
Parameters intended for PLAIN mode are useless in
`acquire_fido2_key_auto()`.

2 years agocryptsetup-fido2: Relocate to libsystemd-shared
Peter Cai [Sat, 17 Dec 2022 20:46:36 +0000 (15:46 -0500)] 
cryptsetup-fido2: Relocate to libsystemd-shared

2 years agoukify: Validate that there are no overlapping sections 25814/head
Daan De Meyer [Wed, 21 Dec 2022 14:18:13 +0000 (15:18 +0100)] 
ukify: Validate that there are no overlapping sections

Let's make sure that after calling objcopy we have no overlapping
sections in the UKI

2 years agoukify: Prefer using llvm-objcopy instead of objcopy
Daan De Meyer [Mon, 19 Dec 2022 14:29:43 +0000 (15:29 +0100)] 
ukify: Prefer using llvm-objcopy instead of objcopy

llvm-objcopy works on stubs built for foreign architectures whereas
objcopy doesn't so let's prefer using llvm-objcopy instead of objcopy.

llvm-objcopy automatically sets the virtual address and doesn't provide
an option to set it manually so we only add --change-section-vma when
using objcopy

The default section flags differ between llvm-objcopy and objcopy
so we add a default for the section flags so we make sure all sections
are read-only data unless specified otherwise.

2 years agoukify: Allow passing multiple directories to --tools
Daan De Meyer [Mon, 19 Dec 2022 14:36:07 +0000 (15:36 +0100)] 
ukify: Allow passing multiple directories to --tools

2 years agoMerge pull request #25791 from keszybz/ukify-check-inputs
Luca Boccassi [Thu, 22 Dec 2022 11:10:32 +0000 (12:10 +0100)] 
Merge pull request #25791 from keszybz/ukify-check-inputs

ukify: check inputs

2 years agomacro: check existence of cleanup function before call it
Yu Watanabe [Mon, 19 Dec 2022 12:07:39 +0000 (21:07 +0900)] 
macro: check existence of cleanup function before call it

The free function specified in the macro may be provided by a
dynamically loaded library.

Replaces #25781.

2 years agotest-network: add testcase for no managed interface 25830/head
Yu Watanabe [Thu, 22 Dec 2022 07:42:55 +0000 (16:42 +0900)] 
test-network: add testcase for no managed interface

2 years agotest-network: split out wait-online related test case
Yu Watanabe [Thu, 22 Dec 2022 07:29:20 +0000 (16:29 +0900)] 
test-network: split out wait-online related test case

2 years agotest-network: move one test case
Yu Watanabe [Thu, 22 Dec 2022 07:27:58 +0000 (16:27 +0900)] 
test-network: move one test case

2 years agodissect-image: let's lock down fstypes a bit
Lennart Poettering [Wed, 21 Dec 2022 09:00:06 +0000 (10:00 +0100)] 
dissect-image: let's lock down fstypes a bit

When we dissect images automatically, let's be a bit more conservative
with the file system types we are willing to mount: only mount common
file systems automatically.

Explicit mounts requested by admins should always be OK, but when we do
automatic mounts, let's not permit barely maintained, possibly legacy
file systems.

The list for now covers the four common writable and two common
read-only file systems. Sooner or later we might want to add more to the
list.

Also, it might make sense to eventually make this configurable via the
image dissection policy logic.

2 years agoMerge pull request #25829 from poettering/empty-to-null-const-fix
Yu Watanabe [Thu, 22 Dec 2022 01:29:59 +0000 (10:29 +0900)] 
Merge pull request #25829 from poettering/empty-to-null-const-fix

string-util: don't add `const` to return pointer of empty_to_null() if input didn't have it

2 years agowait-online: exit with success when all interfaces are ready or unmanaged
Yu Watanabe [Thu, 22 Dec 2022 00:40:37 +0000 (09:40 +0900)] 
wait-online: exit with success when all interfaces are ready or unmanaged

Previously, when neither '--any' nor '--interface' options specified,
at least one of the interfaces must be in configured state.
This patch makes wait-online exit with success even if all interfaces
are in unmanaged state.

This may break backward compatibility in a rare situation. But in most
cases, this typically not change anything, as at least one interface
is managed by networkd.service when it is enabled.

This is mostly for making wait-online gracefully handle the case that
networkd.service and wait-online.service are enabled by mistake. In such
situation, all interfaces are typically not managed.

Fixes #25813.

2 years agocreds: use empty_or_dash() where appropriate 25829/head
Lennart Poettering [Wed, 21 Dec 2022 21:47:47 +0000 (22:47 +0100)] 
creds: use empty_or_dash() where appropriate

2 years agostring-util: rework empty_to_null() to not change "const" qualifier of input
Lennart Poettering [Wed, 21 Dec 2022 21:35:51 +0000 (22:35 +0100)] 
string-util: rework empty_to_null() to not change "const" qualifier of input

This changes the definition from enpty_to_null() so that we are still
typesafe (i.e. only accept strings) but do not drop (or add) any const
to the returned string that wasn't also on the input.

Inspired by: https://github.com/systemd/systemd/pull/25805/commits/3196e2996f613a2e3568a791c503306b7c58d593

2 years agogpt-auto-generator: honour rootfstype= and rootflags= kernel cmdline option
Lennart Poettering [Wed, 21 Dec 2022 08:47:46 +0000 (09:47 +0100)] 
gpt-auto-generator: honour rootfstype= and rootflags= kernel cmdline option

Even if root= is not specified on the kernel cmdline, we should honour
the other rootXYZ= options.

Fixes: #8411
See: #17034

2 years agohwdb: Add mic-mute, control-center and screen-rotation mappings for MSI laptops
Hans de Goede [Wed, 21 Dec 2022 11:18:52 +0000 (12:18 +0100)] 
hwdb: Add mic-mute, control-center and screen-rotation mappings for MSI laptops

The MSI Summit E16 Flip A12UCT laptop sends the following unmapped
atkbd scancodes:

0x91: Launch MSI Control Center
0xf1: Toggle mic mute
0xf2: Rotate screen

The 0x91, 0xf1 and 0xf2 codes are already present in the MSI Prestige/Modern
series specific keymappings and the 0xf1 mapping is also already present in
the MSI Bravo 15-B5DX FnKeys entry.

This shows that these are generic to many MSI models, so add mappings for
these to the generic MSI mappings.

Since the MSI Bravo 15-B5DX FnKeys entry only contains the 0xf1 mapping and
that is covered by the generic MSI mappings now, that entry is removed.

Link: https://gitlab.freedesktop.org/libinput/libinput/-/issues/822
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216824
2 years agohwdb: change definition of PROXIMITY_NEAR_LEVEL for sensors
Philipp Jungkamp [Wed, 21 Dec 2022 11:43:49 +0000 (12:43 +0100)] 
hwdb: change definition of PROXIMITY_NEAR_LEVEL for sensors

The [kernel documentation][0] for the in_proximity_nearlevel sysfs
attribute on iio proximity devices states:

    If the value read from the sensor is above or equal to the value in
    this file an object should typically be considered near.

Meaning a 'greater than or equal to' comparison.

Make the documentation comment in 60-sensors.hwdb suggest a
greater-or-equal rather than a strict greater-than comparison.

[0]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-proximity

Fixes #25793

2 years agosystemctl: fix typo
Antonio Alvarez Feijoo [Wed, 21 Dec 2022 10:25:03 +0000 (11:25 +0100)] 
systemctl: fix typo

2 years agorules: add missing line continuation
Yu Watanabe [Wed, 21 Dec 2022 08:32:56 +0000 (17:32 +0900)] 
rules: add missing line continuation

Fixes a bug introduced by 953c928c24455744d5534679998d129b947a5e04.

Fixes #25811.

2 years agoman: create a new section for nspawn files in systemd.syntax man page (#25807)
Steve Ramage [Wed, 21 Dec 2022 04:31:09 +0000 (20:31 -0800)] 
man: create a new section for nspawn files in systemd.syntax man page (#25807)

Closes #25806.

2 years agoresolve: fix enumerator name for DNS search domain
Jacek Migacz [Tue, 20 Dec 2022 14:26:12 +0000 (15:26 +0100)] 
resolve: fix enumerator name for DNS search domain

2 years agoMerge pull request #25789 from yuwata/EBADF
Lennart Poettering [Tue, 20 Dec 2022 18:01:54 +0000 (19:01 +0100)] 
Merge pull request #25789 from yuwata/EBADF

tree-wide: use -EBADF more

2 years agoMerge branch 'systemd-security/coredump-capabilities'
Zbigniew Jędrzejewski-Szmek [Tue, 20 Dec 2022 16:56:28 +0000 (17:56 +0100)] 
Merge branch 'systemd-security/coredump-capabilities'

CVE-2022-4415: systemd: coredump not respecting fs.suid_dumpable kernel setting
Affects systemd >= 247 with libacl support enabled.

This is a merge of https://github.com/systemd/systemd-security/pull/12/.
I'm doing the merge locally because github doesn't support merging directly
from systemd/systemd-security to systemd/systemd.

2 years agotree-wide: use -EBADF more 25789/head
Yu Watanabe [Tue, 20 Dec 2022 02:09:08 +0000 (11:09 +0900)] 
tree-wide: use -EBADF more

2 years agoukify: check early if inputs exist and are readable 25791/head
Zbigniew Jędrzejewski-Szmek [Tue, 20 Dec 2022 09:38:01 +0000 (10:38 +0100)] 
ukify: check early if inputs exist and are readable

It's much nicer for the user if we fail early instead of doing partial
processing if we cannot read some input. We can't do those checks immediately
from argparse.Parser.parse_args(), because we want to fully process the
commandline first. In particular, even with invalid args, if --help is
specified somewhere, we want to handle that. Thus, we need to delay the checks
after argparse.Parser.parse_args() returns.

Ukify didn't have type annotations on functions, but it probably should.
Jörg's suggested correction included them and we might just as well start here.

2 years agosystemctl: new option --drop-in for specifying drop-in filename
Mike Yuan [Sat, 17 Dec 2022 13:07:32 +0000 (21:07 +0800)] 
systemctl: new option --drop-in for specifying drop-in filename

Previously 'systemctl edit' would only operate on
'override.conf', but users may need more than that.
Thus the new option '--drop-in' is added to allow
users to specify the drop-in file name.

Closes #25767

2 years agogithub: update version in bug templates
Zbigniew Jędrzejewski-Szmek [Tue, 20 Dec 2022 14:12:28 +0000 (15:12 +0100)] 
github: update version in bug templates

2 years agoukify: catch error when loading foreign pe file
Zbigniew Jędrzejewski-Szmek [Tue, 20 Dec 2022 09:20:35 +0000 (10:20 +0100)] 
ukify: catch error when loading foreign pe file

The autodetection code is supposed to throw ValueError when it
cannot figure out the version so that we fall back to the next method.
With the patch:
  Kernel version not specified, starting autodetection 😖.
  Real-Mode Kernel Header magic not found
  + readelf --notes vmlinuz/arm64/vmlinuz-6.0.9-300.fc37.aarch64
  readelf: vmlinuz/arm64/vmlinuz-6.0.9-300.fc37.aarch64: Error: Not an ELF file - it has the wrong magic bytes at the start
  Found uname version: 6.0.9-300.fc37.aarch64

2 years agotree-wide: introduce PIPE_EBADF macro
Yu Watanabe [Tue, 20 Dec 2022 01:10:19 +0000 (10:10 +0900)] 
tree-wide: introduce PIPE_EBADF macro

2 years agofuzz: sort headers
Yu Watanabe [Tue, 20 Dec 2022 02:08:53 +0000 (11:08 +0900)] 
fuzz: sort headers

2 years agoMerge pull request #25786 from keszybz/ebadf
Yu Watanabe [Tue, 20 Dec 2022 01:02:10 +0000 (10:02 +0900)] 
Merge pull request #25786 from keszybz/ebadf

Use -EBADF for fd initialization

2 years agoMerge pull request #25787 from msekletar/rename-process-cap
Yu Watanabe [Tue, 20 Dec 2022 00:58:47 +0000 (09:58 +0900)] 
Merge pull request #25787 from msekletar/rename-process-cap

units: allow systemd-userdbd to change process name

2 years agohwdb: Fn+F5 fix for MSI Bravo 15-B5DX (#25788)
noodlejetski [Tue, 20 Dec 2022 00:57:54 +0000 (01:57 +0100)] 
hwdb: Fn+F5 fix for MSI Bravo 15-B5DX (#25788)

Closes #25782.

2 years agounits: allow systemd-userdbd to change process name 25787/head
Michal Sekletar [Mon, 19 Dec 2022 16:58:49 +0000 (17:58 +0100)] 
units: allow systemd-userdbd to change process name

rename_process() requires CAP_SYS_RESOURCE so let's make sure it is in
our permitted set after execve() by adding in to the bounding set.

Previously,
systemd-userdbd.service - User Database Manager
     Loaded: loaded (/usr/lib/systemd/system/systemd-userdbd.service; indirect; preset: disabled)
     Active: active (running) since Mon 2022-12-19 17:07:21 CET; 17min ago
TriggeredBy: ● systemd-userdbd.socket
       Docs: man:systemd-userdbd.service(8)
   Main PID: 1880 (systemd-userdbd)
     Status: "Processing requests..."
      Tasks: 4 (limit: 2272)
     Memory: 5.2M
        CPU: 244ms
     CGroup: /system.slice/systemd-userdbd.service
             ├─1880 /usr/lib/systemd/systemd-userdbd
             ├─2270 systemd-userwork
             ├─2271 systemd-userwork
             └─2272 systemd-userwork

Now,
    Loaded: loaded (/usr/lib/systemd/system/systemd-userdbd.service; indirect; preset: disabled)
     Active: active (running) since Mon 2022-12-19 17:27:02 CET; 15s ago
TriggeredBy: ● systemd-userdbd.socket
       Docs: man:systemd-userdbd.service(8)
   Main PID: 2404 (systemd-userdbd)
     Status: "Processing requests..."
      Tasks: 4 (limit: 2272)
     Memory: 5.5M
        CPU: 89ms
     CGroup: /system.slice/systemd-userdbd.service
             ├─2404 /usr/lib/systemd/systemd-userdbd
             ├─2407 "systemd-userwork: waiting..."
             ├─2408 "systemd-userwork: waiting..."
             └─2409 "systemd-userwork: waiting..."

2 years agoargv-util: do proper permission check while when changing process name
Michal Sekletar [Mon, 19 Dec 2022 16:29:40 +0000 (17:29 +0100)] 
argv-util: do proper permission check while when changing process name

Process renaming happens very seldomly so we are able to afford proper
permission check, i.e. actually check for CAP_SYS_RESOURCE capability
instead of euid.

2 years agoMerge pull request #25783 from keszybz/trivial-cleanups
Lennart Poettering [Mon, 19 Dec 2022 16:01:51 +0000 (17:01 +0100)] 
Merge pull request #25783 from keszybz/trivial-cleanups

Trivial cleanups

2 years agoMerge pull request #25771 from bluca/pkcs11_dlopen
Lennart Poettering [Mon, 19 Dec 2022 16:01:02 +0000 (17:01 +0100)] 
Merge pull request #25771 from bluca/pkcs11_dlopen

p11kit: switch to dlopen()

2 years agobasic/hashmap: add comment 25783/head
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 10:19:18 +0000 (11:19 +0100)] 
basic/hashmap: add comment

Coverity complains that the check is suspicious. Add a comment to help
the reader.

2 years agoefi: do not use 'r' as pointer name
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 10:17:07 +0000 (11:17 +0100)] 
efi: do not use 'r' as pointer name

'r' should only be used as in 'int r'.

2 years agouserdb: fix typo
Zbigniew Jędrzejewski-Szmek [Fri, 16 Dec 2022 07:35:59 +0000 (08:35 +0100)] 
userdb: fix typo

2 years agoshared/dns-domain: reduce scope of variable declarations
Zbigniew Jędrzejewski-Szmek [Mon, 12 Dec 2022 14:01:49 +0000 (15:01 +0100)] 
shared/dns-domain: reduce scope of variable declarations

2 years agobasic/fd-util: rearrange variable declarations 25786/head
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 12:26:17 +0000 (13:26 +0100)] 
basic/fd-util: rearrange variable declarations

Having two blocks of normal variable declarations was unnecessary.
Also 'i' can be narrower in scope.

2 years agotree-wide: use -EBADF also in pipe initializers
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 12:20:30 +0000 (13:20 +0100)] 
tree-wide: use -EBADF also in pipe initializers

In some places, initialization is dropped when unnecesary.

2 years agotree-wide: change initialization to use EBADF instead of EBADFD
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 12:11:05 +0000 (13:11 +0100)] 
tree-wide: change initialization to use EBADF instead of EBADFD

Those fds never were, so it's not fair to say that they are in "bad state".
Let's use the shorter and more direct errno.

2 years agotree-wide: use -EBADF for fd initialization
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 12:07:42 +0000 (13:07 +0100)] 
tree-wide: use -EBADF for fd initialization

-1 was used everywhere, but -EBADF or -EBADFD started being used in various
places. Let's make things consistent in the new style.

Note that there are two candidates:
EBADF 9 Bad file descriptor
EBADFD 77 File descriptor in bad state

Since we're initializating the fd, we're just assigning a value that means
"no fd yet", so it's just a bad file descriptor, and the first errno fits
better. If instead we had a valid file descriptor that became invalid because
of some operation or state change, the other errno would fit better.

In some places, initialization is dropped if unnecessary.

2 years agosd-event: never pass negative errnos as signalfd to signalfd
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 13:36:08 +0000 (14:36 +0100)] 
sd-event: never pass negative errnos as signalfd to signalfd

We treat any negative value as "invalid fd", but signalfd only
accepts -1.

2 years agosocket-proxyd: do not hardcode -1 in a check for fd validity
Zbigniew Jędrzejewski-Szmek [Mon, 19 Dec 2022 13:35:05 +0000 (14:35 +0100)] 
socket-proxyd: do not hardcode -1 in a check for fd validity

2 years agoUpdate TODO 25771/head
Luca Boccassi [Sat, 17 Dec 2022 01:50:39 +0000 (01:50 +0000)] 
Update TODO

2 years agop11kit: switch to dlopen()
Luca Boccassi [Sat, 17 Dec 2022 01:33:46 +0000 (01:33 +0000)] 
p11kit: switch to dlopen()

2 years agoMerge pull request #25784 from poettering/bootctl-split
Lennart Poettering [Mon, 19 Dec 2022 13:37:52 +0000 (14:37 +0100)] 
Merge pull request #25784 from poettering/bootctl-split

bootctl: split up bootctl.c into multiple files