]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agomkosi: Install sd-boot using postinst script instead of in build script 21487/head
Daan De Meyer [Tue, 23 Nov 2021 18:57:18 +0000 (19:57 +0100)] 
mkosi: Install sd-boot using postinst script instead of in build script

This allows us to reuse bootctl install instead of replicating the
logic in the build script.

3 years agoshared: Add support for non-native architectures to dissect_image()
Daan De Meyer [Tue, 23 Nov 2021 16:54:26 +0000 (17:54 +0100)] 
shared: Add support for non-native architectures to dissect_image()

To allow dissecting images of architectures other than the native
(or secondary) one, we add a third designator 'OTHER' to represent
architectures other than the native or secondary one.

If no partitions of the native or secondary arch are available, we
check if a root partition of any other arch is available and use that
instead if we found one.

3 years agogpt: Store the partition type in GptPartitionType
Daan De Meyer [Wed, 24 Nov 2021 09:30:27 +0000 (10:30 +0100)] 
gpt: Store the partition type in GptPartitionType

This replaces the _GPT_ALL_ARCHES macro.

3 years agogpt: Store the architecture in GptPartitionType
Daan De Meyer [Tue, 23 Nov 2021 16:52:27 +0000 (17:52 +0100)] 
gpt: Store the architecture in GptPartitionType

We also add a function gpt_partition_type_uuid_to_arch() to get the
architecture of a partition type uuid.

3 years agobasic: Rename SECONDARY_ARCHITECTURE to ARCHITECTURE_SECONDARY
Daan De Meyer [Tue, 23 Nov 2021 16:49:30 +0000 (17:49 +0100)] 
basic: Rename SECONDARY_ARCHITECTURE to ARCHITECTURE_SECONDARY

For easier integration with the _GPT_ALL_ARCHES macro in a future
commit.

3 years agogpt: Rename PPC64LE TO PPC64_LE
Daan De Meyer [Tue, 23 Nov 2021 16:34:05 +0000 (17:34 +0100)] 
gpt: Rename PPC64LE TO PPC64_LE

For consistency with ARCHITECTURE_PPC64_LE

3 years agobasic: Give architecure enum a name
Daan De Meyer [Tue, 23 Nov 2021 16:22:18 +0000 (17:22 +0100)] 
basic: Give architecure enum a name

3 years agobasic/architectures: sort by name and remove duplicates
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 17:19:59 +0000 (18:19 +0100)] 
basic/architectures: sort by name and remove duplicates

C.f. 086df29f35069bb454d52a21a146f76cf7bd42dc.

3 years agobpf: fix memleak in restrict_fs_bpf
Julia Kartseva [Tue, 23 Nov 2021 23:38:11 +0000 (15:38 -0800)] 
bpf: fix memleak in restrict_fs_bpf

Memory allocated in bpf skeleton is not freed. Wrap ptr in _cleanup_.

Fixes: #21471
3 years agoMerge pull request #21448 from poettering/disk-image-purpose
Lennart Poettering [Wed, 24 Nov 2021 08:37:04 +0000 (09:37 +0100)] 
Merge pull request #21448 from poettering/disk-image-purpose

encode disk image purpose in extension-release.d + os-release

3 years agorecurse-dir: give callers of recurse_dir_at() control over path prefix
Lennart Poettering [Tue, 23 Nov 2021 21:18:31 +0000 (22:18 +0100)] 
recurse-dir: give callers of recurse_dir_at() control over path prefix

One of the niceties of recurse_dir()/recurse_dir_at() is that the path
argument is decoration, it's not used for actually accessing the fs in
anyway. That's very handy in environments where chroots and relative
paths are used, as we can path in any path we like and the recursion
function will suffix with whatever it discovers but will not try to make
sense of the prefix you pass.

This works great, except that the recurse_dir_at() wrapper broke that:
it adjusted the path if NULL to "." simply for the sake of making
openat() on the top work. Let's make this adjustment more local and do
it only for the openat() itself, and otherwise pass the path through the
way we got it. This means: if a caller really wants the paths that are
concatenated to start with a "." it can just pass that. This way the
caller gets full control back of the path prefix. Win!

Note that all current users of recurse_dir_at() don't pass NULL as
second arg, hence this check is without any real effect for now. It's
preparation for future uses however.

3 years agoupdate TODO 21448/head
Lennart Poettering [Thu, 18 Nov 2021 21:00:20 +0000 (22:00 +0100)] 
update TODO

3 years agotest: test new SYSEXT_SCOPE=/PORTABLE_PREFIXES= fields in TEST-29
Lennart Poettering [Tue, 23 Nov 2021 15:34:40 +0000 (16:34 +0100)] 
test: test new SYSEXT_SCOPE=/PORTABLE_PREFIXES= fields in TEST-29

3 years agodissect: show intended purpose of images in dissection output
Lennart Poettering [Fri, 19 Nov 2021 15:20:00 +0000 (16:20 +0100)] 
dissect: show intended purpose of images in dissection output

With this the tool will show whether an image is intended to be a
bootable OS image, a system extension, or a portable service image.
Example output with this patch:

<snip>
      Name: image_53.raw
      Size: 3.2G

Machine ID: bb9f2921198040feb7c82270bf66e4b8
OS Release: NAME=Fedora
            VERSION=34 (Thirty Four)
            …
            PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy
            IMAGE_VERSION=53

    Use As: ✓ bootable system for UEFI
            ✓ bootable system for container
            ✗ portable service
            ✗ extension for system
            ✗ extension for initrd
            ✗ extension for portable service

RW DESIGNATOR PARTITION UUID                       PARTITION LABEL      FSTYPE ARCHITECTURE VERITY GROWFS NODE         PARTNO
rw root       d56af2b4-35eb-2e40-8f08-2d3b7012b0fc Root Partition       btrfs  x86-64       no         no /dev/loop1p2 2
rw esp        e3d11339-05c1-a74a-ae77-aae76812c134 ESP System Partition vfat   -            -          no /dev/loop1p1 1

</snip>

3 years agoos-release: add new PORTABLE_PREFIXES= field for declaring valid portable service...
Lennart Poettering [Fri, 19 Nov 2021 15:19:19 +0000 (16:19 +0100)] 
os-release: add new PORTABLE_PREFIXES= field for declaring valid portable service match prefixes

3 years agoextension-release.d/: add a new field SYSEXT_SCOPE= for clarifying what a system...
Lennart Poettering [Thu, 18 Nov 2021 21:00:31 +0000 (22:00 +0100)] 
extension-release.d/: add a new field SYSEXT_SCOPE= for clarifying what a system extension is for

This should make things a bit more robust since it ensures system
extension can only applied to the right environments. Right now three
different "scopes" are defined:

1. "system" (for regular OS systems, after the initrd transition)
2. "initrd" (for sysext images that apply to the initrd environment)
3. "portable" (for sysext images that apply to portable images)

If not specified we imply a default of "system portable", i.e. any image
where the field is not specified is implicitly OK for application to OS
images and for portable services – but not for initrds.

3 years agodissect-image: when extracting metadata from image also check if it contains init...
Lennart Poettering [Fri, 19 Nov 2021 14:48:41 +0000 (15:48 +0100)] 
dissect-image: when extracting metadata from image also check if it contains init system

It's good to know whether we can boot the image.

3 years agodissect: add helper call for unifying three loops
Lennart Poettering [Fri, 19 Nov 2021 14:47:20 +0000 (15:47 +0100)] 
dissect: add helper call for unifying three loops

3 years agobootctl: use new red/green check/cross mark helpers at two places
Lennart Poettering [Tue, 23 Nov 2021 13:08:01 +0000 (14:08 +0100)] 
bootctl: use new red/green check/cross mark helpers at two places

3 years agopretty-print: add helper for quickly outputting red/green cross/check marks
Lennart Poettering [Tue, 23 Nov 2021 09:37:03 +0000 (10:37 +0100)] 
pretty-print: add helper for quickly outputting red/green cross/check marks

Compound constructors FTW!

3 years agosd-bus: Fix standard method argument names
Miika Karanki [Tue, 23 Nov 2021 15:23:01 +0000 (17:23 +0200)] 
sd-bus: Fix standard method argument names

The argument names of methods under org.freedesktop.DBus.Properties and
org.freedesktop.DBus.Introspectable interfaces are specifies in D-Bus
specification[1]. They are:

  org.freedesktop.DBus.Introspectable.Introspect (out STRING xml_data)
  org.freedesktop.DBus.Properties.Get (in STRING interface_name,
                                       in STRING property_name,
                                       out VARIANT value);
  org.freedesktop.DBus.Properties.Set (in STRING interface_name,
                                       in STRING property_name,
                                       in VARIANT value);
  org.freedesktop.DBus.Properties.GetAll (in STRING interface_name,
                                          out DICT<STRING,VARIANT> props);

sd-bus is using different argument names in the introspection document.
Usually this is not a problem but in case something tries to map the
argument names based on the introspection document to the position of
the arguments in the method call, then using names different than the
ones specified in the D-Bus specification is confusing.

So fix the names to match the D-Bus specification.

[1] https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable

3 years agodocs: remove comment that makes githubs renderer very angry
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 18:42:38 +0000 (19:42 +0100)] 
docs: remove comment that makes githubs renderer very angry

It is fine on github.com, but not on github.io.

3 years agoMerge pull request #21479 from keszybz/cosmetic-initialization-adjustments
Lennart Poettering [Tue, 23 Nov 2021 17:42:45 +0000 (18:42 +0100)] 
Merge pull request #21479 from keszybz/cosmetic-initialization-adjustments

Cosmetic initialization adjustments

3 years agoprocess-util: add missing NULL initialization for _cleanup_ variable
Lennart Poettering [Tue, 23 Nov 2021 15:54:19 +0000 (16:54 +0100)] 
process-util: add missing NULL initialization for _cleanup_ variable

This is will otherwise trigger a bad memory access in the error path

3 years agoMerge pull request #21440 from poettering/homed-initial-fs-size
Lennart Poettering [Tue, 23 Nov 2021 15:44:26 +0000 (16:44 +0100)] 
Merge pull request #21440 from poettering/homed-initial-fs-size

homed: also support minimizing/maximizing home dirs when creating them

3 years agoresolved: add _unused_ annotations to appease clang 21479/head
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 13:35:33 +0000 (14:35 +0100)] 
resolved: add _unused_ annotations to appease clang

3 years agoshared/format-table: add cosmetic initialization
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 11:12:39 +0000 (12:12 +0100)] 
shared/format-table: add cosmetic initialization

p is unconditionally initialized below, but our coding style says that
initialization should be added anyway.

3 years agoresolved: inline declarations of iterator variables
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 11:30:46 +0000 (12:30 +0100)] 
resolved: inline declarations of iterator variables

3 years agoresolved: move packet rewinder initalization inline
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 11:30:30 +0000 (12:30 +0100)] 
resolved: move packet rewinder initalization inline

There is no functional change, but this reduces the risk that
in some future refactoring we'll forget the do the initialization in all
execution paths.

3 years agovirt: Fix the detection for Hyper-V VMs
Boqun Feng [Tue, 23 Nov 2021 07:09:26 +0000 (15:09 +0800)] 
virt: Fix the detection for Hyper-V VMs

Use product_version instead of product_name in DMI table and the string
"Hyper-V" to avoid misdetection.

Fixes: #21468
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
3 years agoMerge pull request #21443 from poettering/homed-grow-shrink-on-login-logout
Lennart Poettering [Tue, 23 Nov 2021 12:13:06 +0000 (13:13 +0100)] 
Merge pull request #21443 from poettering/homed-grow-shrink-on-login-logout

homed: add ability to auto-grow home dir in login and auto-shrink on logout (if luks2+btrfs is used)

3 years agoudev/cdrom_id: use a macro to initialize context
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 11:13:56 +0000 (12:13 +0100)] 
udev/cdrom_id: use a macro to initialize context

c was initialized unconditionally, but one has to look at the function
body to understand this. Let's make the whole thing shorter and more
direct.

3 years agoMerge pull request #21472 from mrc0mmand/sanitizer_suppressions
Frantisek Sumsal [Tue, 23 Nov 2021 10:32:41 +0000 (10:32 +0000)] 
Merge pull request #21472 from mrc0mmand/sanitizer_suppressions

test: suppress certain leaks reported by LSan

3 years agotest: update test to use --disk-size=min 21440/head
Lennart Poettering [Fri, 19 Nov 2021 08:58:50 +0000 (09:58 +0100)] 
test: update test to use --disk-size=min

3 years agoman: document min/max for --disk-space= too
Lennart Poettering [Fri, 19 Nov 2021 08:58:34 +0000 (09:58 +0100)] 
man: document min/max for --disk-space= too

3 years agohomework: correct initial minimal fs size calculations by LUKS2/GPT overhead
Lennart Poettering [Thu, 4 Nov 2021 22:49:17 +0000 (23:49 +0100)] 
homework: correct initial minimal fs size calculations by LUKS2/GPT overhead

So far we assumed we ignore the LUKS2/GPT header overhead when
determining what the lower bound for images sizes is. Let's correct
this.

3 years agohomework: when creating home dir also treat specified size as hint
Lennart Poettering [Thu, 4 Nov 2021 20:54:46 +0000 (21:54 +0100)] 
homework: when creating home dir also treat specified size as hint

The resize logic is now able to handle resize requests that cannot be
fulfilled in full gracefully. Let's do the same when allocating new home
directories.

This means "homectl create foo --disk-size=min" and "homectl create foo
--disk-size=max" may now be used to create the smallest or largest home
directory we support.

3 years agocore/automount: Add ExtraOptions field
Andrew Stone [Thu, 11 Nov 2021 21:45:47 +0000 (13:45 -0800)] 
core/automount: Add ExtraOptions field

3 years agoman/doc: document auto resize modes 21443/head
Lennart Poettering [Fri, 19 Nov 2021 09:55:57 +0000 (10:55 +0100)] 
man/doc: document auto resize modes

3 years agohomework: upload home password into kernel keyring if needed
Lennart Poettering [Tue, 2 Nov 2021 17:24:02 +0000 (18:24 +0100)] 
homework: upload home password into kernel keyring if needed

If we do automatic disk space rebalancing, we must be able to unlock the
encrypted volume for that in the background, thus we need to decryption
key around in userspace. Let's do this via the kernel keyring. This
allows us to do this in a relatively secure way, so that it sticks
around between homework invocations, but still is destroyed
automatically when homed goes down.

3 years agohomework: add auto-shrink/auto-grow
Lennart Poettering [Fri, 29 Oct 2021 08:15:00 +0000 (10:15 +0200)] 
homework: add auto-shrink/auto-grow

3 years agohomectl: expose new autoResizeMode JSON user record property
Lennart Poettering [Thu, 4 Nov 2021 17:05:49 +0000 (18:05 +0100)] 
homectl: expose new autoResizeMode JSON user record property

3 years agouser-record: add auto-resize property
Lennart Poettering [Fri, 29 Oct 2021 07:45:17 +0000 (09:45 +0200)] 
user-record: add auto-resize property

3 years agoMerge pull request #21470 from poettering/resolved-250-fixes
Lennart Poettering [Tue, 23 Nov 2021 07:01:50 +0000 (08:01 +0100)] 
Merge pull request #21470 from poettering/resolved-250-fixes

various smaller additions/fixes for resolved

3 years agoman: fix type in sd_bus_error_add_map() prototype
Lennart Poettering [Mon, 22 Nov 2021 21:05:57 +0000 (22:05 +0100)] 
man: fix type in sd_bus_error_add_map() prototype

Fixes: #21467
3 years agoresolved: lower connection timeout for DoT connections in opportunistic mode 21470/head
Lennart Poettering [Mon, 22 Nov 2021 17:32:57 +0000 (18:32 +0100)] 
resolved: lower connection timeout for DoT connections in opportunistic mode

Fixes: #20801
3 years agoresolved: clean up manager_write_resolv_conf() a bit
Lennart Poettering [Mon, 22 Nov 2021 17:29:17 +0000 (18:29 +0100)] 
resolved: clean up manager_write_resolv_conf() a bit

Let's downgrade log messages which are not fatal for the service to
LOG_WARNING.

And let's simplify clean-up by using _cleanup_(unlink_and_freep).

3 years agoresolved: make sure we don't hit an assert when dealing with incomplete DNSSD service...
Lennart Poettering [Mon, 22 Nov 2021 15:14:07 +0000 (16:14 +0100)] 
resolved: make sure we don't hit an assert when dealing with incomplete DNSSD service definitions

Fixes: #21142
3 years agoresolved: properly signal transient errors back to NSS stack
Lennart Poettering [Mon, 22 Nov 2021 14:17:34 +0000 (15:17 +0100)] 
resolved: properly signal transient errors back to NSS stack

NSS mostly knows four error cases: SUCCESS, NOTFOUND, UNAVAIL, TRYAGAIN,
and they can all be used in nsswitch.conf to route requests.

So far nss-resolve would return SUCCESS + NOTFOUND + UNAVAIL. Let's also
return TRYAGAIN in some cases, specifically the ones where we are
currntly unable to resolve a request but likely could later. i.e.
errors caused by networking issues or such.

Fixes: #20786
3 years agoresolved: fix ResolveService() hostname handling
Lennart Poettering [Mon, 22 Nov 2021 13:37:54 +0000 (14:37 +0100)] 
resolved: fix ResolveService() hostname handling

Let's eat up special returns of dns_query_process_cname_many() when
storing hostname resolution results.

The rest of the code assumes only == 0 means success and != 0 means
error, but so far > 0 also could mean success, let's fix that.

Fixes: #21365 #21140
(This was originally broken in 1db8e6d1db0880de240e5598e28d24d708479434)

3 years agonspawn: voidify expose_port_execute() calls
Lennart Poettering [Mon, 22 Nov 2021 13:37:48 +0000 (14:37 +0100)] 
nspawn: voidify expose_port_execute() calls

3 years agoresolved: add "proxy-only" stub on 127.0.0.54
Lennart Poettering [Mon, 22 Nov 2021 11:20:05 +0000 (12:20 +0100)] 
resolved: add "proxy-only" stub on 127.0.0.54

This beefs up the DNS stub logic to listen on two IP addresses:
127.0.0.53 (as before) + 127.0.0.54 (new). When the latter is contact
our stub will operate in "bypass" mode only, i.e we'll try to pass DNS
requests as unmodified upstream as we can (and not do mDNS/LLMNR and
such, also no DNSSEC validation – but we'll still do DNS-over-TLS
wrapping).

This is supposed to be useful for container environments or tethering:
this stub could be exposed (via NAT redirect) to clients of this system
and we'll try to stay out of the way with doing too much DNS magic
ourselves, but still expose whatever the current DNS server is from
upstream under a stable address/port.

How to use this:

  # iptables -t nat -I PREROUTING -p udp -i <interface> --dport 53 -j DNAT --to 127.0.0.54:53
  # echo 1 > /proc/sys/net/ipv4/conf/<interface>/route_localnet

3 years agosocket-util: add helper for generically initializing sockaddr_union from in_addr_union
Lennart Poettering [Mon, 22 Nov 2021 10:29:42 +0000 (11:29 +0100)] 
socket-util: add helper for generically initializing sockaddr_union from in_addr_union

3 years agoresolved: include IP address info in debug output for incoming datagrams
Lennart Poettering [Mon, 22 Nov 2021 10:13:26 +0000 (11:13 +0100)] 
resolved: include IP address info in debug output for incoming datagrams

3 years agotest: drop the `su` wrapper and use `systemctl` directly 21472/head
Frantisek Sumsal [Mon, 22 Nov 2021 21:12:09 +0000 (22:12 +0100)] 
test: drop the `su` wrapper and use `systemctl` directly

ASan is having a hard time to get its LD_PRELOAD= shenanigans straight
with all the shells flying around. Let's make it a bit easier by using
one of the nifty systemctl's features instead.

3 years agotest: suppress certain leaks reported by LSan
Frantisek Sumsal [Mon, 22 Nov 2021 19:13:51 +0000 (20:13 +0100)] 
test: suppress certain leaks reported by LSan

so we can run TEST-46 under sanitizers once again.

`systemd-homed` runs fsck on home directories, which reports a memory
leak we're not interested in. Let's introduce an LSan suppression file
to get around this. Since the patterns in the suppression file are
matched using basic substring match[0], they're a bit cumbersome, but
should get the work one.

[0] https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer#suppressions

Example leaks (as reported by TEST-46):
```
systemd-homed[1333]: =================================================================
systemd-homed[1333]: ==1333==ERROR: LeakSanitizer: detected memory leaks
systemd-homed[1333]: Direct leak of 24 byte(s) in 1 object(s) allocated from:
systemd-homed[1333]:     #0 0x7f0c8facccd1 in calloc (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xf4cd1)
systemd-homed[1333]:     #1 0x558d9494ff67  (/usr/bin/fsck+0x3f67)
systemd-homed[1333]: Direct leak of 6 byte(s) in 1 object(s) allocated from:
systemd-homed[1333]:     #0 0x7f0c8fa906c1 in strdup (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xb86c1)
systemd-homed[1333]:     #1 0x558d949518fd  (/usr/bin/fsck+0x58fd)
systemd-homed[1333]: SUMMARY: AddressSanitizer: 30 byte(s) leaked in 2 allocation(s).
systemd-homed[1337]: ==1337==WARNING: Symbolizer was blocked from starting itself!
systemd-homed[1337]: =================================================================
systemd-homed[1337]: ==1337==ERROR: LeakSanitizer: detected memory leaks
systemd-homed[1337]: Direct leak of 67584 byte(s) in 1 object(s) allocated from:
systemd-homed[1337]:     #0 0x7f01edb84b19  (/usr/lib/clang/12.0.1/lib/linux/libclang_rt.asan-x86_64.so+0xf4b19)
systemd-homed[1337]:     #1 0x7f01e8326829  (/usr/bin/../lib/libLLVM-12.so+0xb46829)
systemd-homed[1337]: SUMMARY: AddressSanitizer: 67584 byte(s) leaked in 1 allocation(s).
```

With the suppression file:
```
systemd-homed[1339]: -----------------------------------------------------
systemd-homed[1339]: Suppressions used:
systemd-homed[1339]:   count      bytes template
systemd-homed[1339]:       2         30 /bin/fsck$
systemd-homed[1339]: -----------------------------------------------------
systemd-homed[1343]: ==1343==WARNING: Symbolizer was blocked from starting itself!
systemd-homed[1343]: -----------------------------------------------------
systemd-homed[1343]: Suppressions used:
systemd-homed[1343]:   count      bytes template
systemd-homed[1343]:       1      67584 /lib/libLLVM
systemd-homed[1343]: -----------------------------------------------------
```

3 years agotest: fix a couple of "new" shellcheck-related issues
Frantisek Sumsal [Mon, 22 Nov 2021 19:51:15 +0000 (20:51 +0100)] 
test: fix a couple of "new" shellcheck-related issues

related to https://github.com/koalaman/shellcheck/wiki/SC2295

3 years agoresolved: use RET_NERRNO() where it makes sense
Lennart Poettering [Mon, 22 Nov 2021 10:08:32 +0000 (11:08 +0100)] 
resolved: use RET_NERRNO() where it makes sense

3 years agoRemove own copyright line
Jan Janssen [Mon, 22 Nov 2021 15:08:37 +0000 (16:08 +0100)] 
Remove own copyright line

3 years agoMerge pull request #21357 from mbd98/usr-verity-auto
Luca Boccassi [Mon, 22 Nov 2021 13:09:38 +0000 (13:09 +0000)] 
Merge pull request #21357 from mbd98/usr-verity-auto

veritysetup-generator, fstab-generator: Setup and mount usr verity device when 'usrhash' (and optionally systemd.verity_usr_*) is present as kernel command line parameter

3 years agoFIDO2 device removal instructions (#21426)
Robert-L-Turner [Mon, 22 Nov 2021 11:43:44 +0000 (19:43 +0800)] 
FIDO2 device removal instructions (#21426)

* man: document FIDO2 device removal

Indicate to users how to remove FIDO2 device in the --fido2-device=path section by setting path to an empty string ("").  Tested on systemd 249 (249.6-3-arch)

3 years agoMerge pull request #21452 from vcaputo/mmap-cache-fd
Daan De Meyer [Mon, 22 Nov 2021 09:35:34 +0000 (10:35 +0100)] 
Merge pull request #21452 from vcaputo/mmap-cache-fd

mmap-cache: simplify MMapFileDescriptor-centric function signatures

3 years agoMerge pull request #21425 from keszybz/ppc64-fixes
Lennart Poettering [Mon, 22 Nov 2021 09:10:05 +0000 (10:10 +0100)] 
Merge pull request #21425 from keszybz/ppc64-fixes

Add base-filesystem defines for arm64/ppc64el/riscv64 and make build quiet again

3 years agotest runner: print time before/after tests
Luca Boccassi [Sat, 20 Nov 2021 00:44:13 +0000 (00:44 +0000)] 
test runner: print time before/after tests

When a timeout occurs we actually can't see when the test started/stopped. Print the time.

4 years agoanalyze: fix printing config when there is no main config file
Zbigniew Jędrzejewski-Szmek [Sat, 20 Nov 2021 10:42:31 +0000 (11:42 +0100)] 
analyze: fix printing config when there is no main config file

Since 8b8024f1c231c166f5c450905c8fd91d11704ae7 and the follow-up commits, the
main config file may be located in /usr or in other paths. But the code in
analyze.c was still assuming that it must be in /etc. Things mostly worked for
our own config files because we usually install a comments-only file in /etc,
but was not correct in the general case.

This fixes in particular 'systemd-analyze cat-config systemd/zram-generator.conf'.
In Fedora we distribute a config file in zram-generator-defaults.rpm that is in
/usr/lib, and 'cat-config' would refuse to show it because
/etc/systemd/zram-generator.conf does not exist.

The main config file is optional, but let's print an informative message
because this is a slightly unusual case.

The file paths that we printed were missing the root prefix.

4 years agoMerge pull request #21432 from DaanDeMeyer/journal-trivial-fixes
Luca Boccassi [Sat, 20 Nov 2021 18:00:35 +0000 (18:00 +0000)] 
Merge pull request #21432 from DaanDeMeyer/journal-trivial-fixes

Journal trivial fixes

4 years agoMerge pull request #21431 from DaanDeMeyer/issue-19799
Luca Boccassi [Sat, 20 Nov 2021 17:58:51 +0000 (17:58 +0000)] 
Merge pull request #21431 from DaanDeMeyer/issue-19799

journal: Limit the number of audit fields we add to a message

4 years agonspawn: use FOREACH_STRING() more
Lennart Poettering [Fri, 19 Nov 2021 14:48:01 +0000 (15:48 +0100)] 
nspawn: use FOREACH_STRING() more

4 years agocore: prefix functions to avoid identical static function names
Christian Göttsche [Fri, 19 Nov 2021 16:34:08 +0000 (17:34 +0100)] 
core: prefix functions to avoid identical static function names

The function name `method_reload` is used both in dbus-unit.c and
dbus-manager.c for static functions.
With the previous addition of adding the function name to the audit
information on SELinux denials, rename the one (and its relatives) in
dbus-unit.c as most of the functions in src/core/dbus-unit.c are already
prefixed with `bus_unit_`.

4 years agoselinux: name mac_selinux_generic_access_check as internal function
Christian Göttsche [Wed, 28 Jul 2021 15:00:02 +0000 (17:00 +0200)] 
selinux: name mac_selinux_generic_access_check as internal function

`mac_selinux_generic_access_check()` should not be called directly, only
via the wrapper macros `mac_selinux_access_check` and
`mac_selinux_unit_access_check`.

4 years agoselinux: improve debug log format
Christian Göttsche [Wed, 28 Jul 2021 14:59:57 +0000 (16:59 +0200)] 
selinux: improve debug log format

path might be NULL when checking against the system permissions, so wrap
with strna().

The command line might not be available over D-Bus and thus cl might be
empty. Print "n/a" instead of the empty string.

4 years agoselinux: add function name to audit data
Christian Göttsche [Wed, 28 Jul 2021 14:59:51 +0000 (16:59 +0200)] 
selinux: add function name to audit data

Include the systemd C function name in the audit message to improve the
debug ability on denials.
Similar like kernel denial messages include the syscall name.

4 years agommap-cache: s/mmap_cache/mmap_cache_fd_/ where apropos 21452/head
Vito Caputo [Wed, 17 Nov 2021 04:37:30 +0000 (20:37 -0800)] 
mmap-cache: s/mmap_cache/mmap_cache_fd_/ where apropos

Mostly mechanical renaming of mmap-cache functions that now
operate exclusively on the MMapFileDescriptor.

4 years agommap-cache: simplify API around MMapFileDescriptor
Vito Caputo [Wed, 17 Nov 2021 01:03:15 +0000 (17:03 -0800)] 
mmap-cache: simplify API around MMapFileDescriptor

MMapFileDescriptor carries a reference to its originating
MMapCache, there's no value in supplying the
MMapFileDescriptor-centric functions a separate MMapCache.

A future commit will rename these functions to consistently use
an mmap_cache_fd_* prefix for improved clarity.

4 years agoDocument usr-specific verity parameters 21357/head
Mark Boudreau [Sat, 13 Nov 2021 18:15:17 +0000 (13:15 -0500)] 
Document usr-specific verity parameters

Mention 'usrhash' and 'systemd.verity_usr_*' kernel command line
parameters in the man pages for veritysetup-generator and
kernel-command-line

4 years agofstab-generator: use 'usr' mapper device when 'usrhash' is present
Mark Boudreau [Wed, 10 Nov 2021 01:07:26 +0000 (20:07 -0500)] 
fstab-generator: use 'usr' mapper device when 'usrhash' is present

If 'usrhash' is present as a kernel command line parameter, use the usr
mapper device for usr mount

4 years agoveritysetup-generator: generate service for usr device
Mark Boudreau [Wed, 10 Nov 2021 00:38:29 +0000 (19:38 -0500)] 
veritysetup-generator: generate service for usr device

If 'usrhash' is present as a kernel command line parameter, generate a
veritysetup service for usr.
Also recognize systemd.verity_usr_* parameters.

4 years agojournal: Limit the number of audit fields per log message 21431/head
Daan De Meyer [Thu, 18 Nov 2021 12:37:04 +0000 (12:37 +0000)] 
journal: Limit the number of audit fields per log message

Similar to the kmsg handler, let's also limit the number of fields
we parse from audit messages.

Fixes #19799

4 years agoAdd a trivial guard against using the same uuid twice 21425/head
Zbigniew Jędrzejewski-Szmek [Fri, 19 Nov 2021 16:26:36 +0000 (17:26 +0100)] 
Add a trivial guard against using the same uuid twice

4 years agoshared/base-filesystem: use LIB_ARCH_TUPLE instead of string
Zbigniew Jędrzejewski-Szmek [Fri, 19 Nov 2021 16:02:09 +0000 (17:02 +0100)] 
shared/base-filesystem: use LIB_ARCH_TUPLE instead of string

4 years agoTrivial style fixes
Zbigniew Jędrzejewski-Szmek [Fri, 19 Nov 2021 15:34:17 +0000 (16:34 +0100)] 
Trivial style fixes

4 years agodocs: document the partition UUID used by homed
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 14:16:20 +0000 (15:16 +0100)] 
docs: document the partition UUID used by homed

4 years agoshared/gpt: fix bit-flip in LoongArch root partition UUID
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 14:15:55 +0000 (15:15 +0100)] 
shared/gpt: fix bit-flip in LoongArch root partition UUID

4e767154891083069a58c5c960f386974ad87fb4 added a slightly different UUID
in the header and in the docs. This makes the code match the docs.

> As some downstream projects are already using the UUID as in the docs, most
> notably util-linux [1], we should adjust code to match doc; no shipping
> LoongArch systems are using upstream systemd, and no open-source distro is
> merging LoongArch support yet, so the change should break no one. This also
> matches the work being done by @yetist at loongarch64/systemd#7.

[1] https://github.com/util-linux/util-linux/commit/2d29fccaad267d1b003dc0ed2bb9634ff76f3e49

4 years agodocs: generate table from header using a script
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 14:09:30 +0000 (15:09 +0100)] 
docs: generate table from header using a script

This adds a helper script:
$ python3 tools/list-discoverable-partitions.py <src/shared/gpt.h
<!-- generated with tools/list-discoverable-partitions.py -->
| Partition Type UUID | Name | Allowed File Systems | Explanation |
|---------------------|------|----------------------|-------------|
| _Root Partition (Alpha)_ | `6523f8ae-3eb1-4e2a-a05a-18b695ae656f` | [Root Partition] | [Root Partition more] |
| _Root Partition (ARC)_ | `d27f46ed-2919-4cb8-bd25-9531f3c16534` | ditto | ditto |
...

The output can be pasted into the markdown file. I think this works better than
trying to match the two lists by hand.

4 years agoshared/gpt: ARM_64 → ARM64
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 10:48:17 +0000 (11:48 +0100)] 
shared/gpt: ARM_64 → ARM64

"arm64" is generally written without the underscore.

4 years agoshared/gpt: add entries for a bunch of architectures
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 10:30:15 +0000 (11:30 +0100)] 
shared/gpt: add entries for a bunch of architectures

I don't think we want people to send us pull requests over the next two years.
Let's just make something up ourselves, this is going to have at least as good
results, and will be much quicker.

Note that this only includes architectures for which there's some indication
that they are in active use. In architecture.h there are some more esoteric
ones like ARC_BE. We can add those if there's some actual user demand.

In particular, I included everything on the Debian "List of official ports" [1]
and a few other arches that we have received patches for in recent times.

[1] https://www.debian.org/ports/#portlist-released

4 years agoshared/gpt: add a macro to make the definitions a bit less onerous
Zbigniew Jędrzejewski-Szmek [Fri, 19 Nov 2021 15:06:27 +0000 (16:06 +0100)] 
shared/gpt: add a macro to make the definitions a bit less onerous

4 years agojournal: Add verify_hash_table() 21432/head
Daan De Meyer [Tue, 16 Nov 2021 14:39:18 +0000 (14:39 +0000)] 
journal: Add verify_hash_table()

The existing verify_hash_table() function is renamed to
verify_data_hash_table() since it only verifies the data hash table.

The verify information is also made a little more detailed by splitting
one of the checks in two.

4 years agojournal: Add journal_file_object_to_string()
Daan De Meyer [Fri, 12 Nov 2021 11:17:01 +0000 (11:17 +0000)] 
journal: Add journal_file_object_to_string()

4 years agojournal: Simplify definition of HEADER_INCOMPATIBLE_SUPPORTED
Daan De Meyer [Mon, 15 Nov 2021 11:45:00 +0000 (11:45 +0000)] 
journal: Simplify definition of HEADER_INCOMPATIBLE_SUPPORTED

4 years agojournal: Use more structured initialization
Daan De Meyer [Thu, 11 Nov 2021 15:35:28 +0000 (15:35 +0000)] 
journal: Use more structured initialization

4 years agojournal: Use size_t instead of unsigned for array sizes
Daan De Meyer [Sun, 31 Oct 2021 12:33:40 +0000 (12:33 +0000)] 
journal: Use size_t instead of unsigned for array sizes

4 years agoshared/gpt: reorder arches alphabetically
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 10:00:56 +0000 (11:00 +0100)] 
shared/gpt: reorder arches alphabetically

It's just too annoying to add new ones otherwise.

4 years agoupdate TODO
Lennart Poettering [Fri, 19 Nov 2021 14:39:19 +0000 (15:39 +0100)] 
update TODO

4 years agodoc: rebreak boot loader spec
Lennart Poettering [Fri, 19 Nov 2021 14:39:32 +0000 (15:39 +0100)] 
doc: rebreak boot loader spec

4 years agodocs: switch the first two columns in partition uuid list
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 09:48:30 +0000 (10:48 +0100)] 
docs: switch the first two columns in partition uuid list

Readers are most likely to want to go from a partition id to the uuid,
so puts the uuid second

4 years agoshared/base-filesystem: add define for s390x
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 18:10:18 +0000 (19:10 +0100)] 
shared/base-filesystem: add define for s390x

This is based on the information in #14311 and
https://refspecs.linuxfoundation.org/LSB_3.2.0/LSB-Core-S390X/LSB-Core-S390X.pdf
and https://wiki.debian.org/Multiarch/Tuples.

Fixes #14311.

4 years agoshared/base-filesystem: m68k is 32-bit only
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 09:15:17 +0000 (10:15 +0100)] 
shared/base-filesystem: m68k is 32-bit only

4 years agoshared/base-filesystem: add define for arm
Zbigniew Jędrzejewski-Szmek [Thu, 18 Nov 2021 08:57:26 +0000 (09:57 +0100)] 
shared/base-filesystem: add define for arm

$ ls -l /lib /lib64
ls: cannot access '/lib64': No such file or directory
lrwxrwxrwx. 1 root root 7 Jan 26  2021 /lib -> usr/lib
$ ldd /bin/sh|grep ld
/lib/ld-linux-armhf.so.3 (0xb6f80000)

4 years agoshared/base-filesystem: add define for riscv64
Zbigniew Jędrzejewski-Szmek [Wed, 17 Nov 2021 14:10:20 +0000 (15:10 +0100)] 
shared/base-filesystem: add define for riscv64

https://wiki.debian.org/ArchitectureSpecificsMemo shows the triplet, but no the
linker paths. I used the linker path from Fedora.

$ ls -l /lib /lib64
lrwxrwxrwx. 1 root root 7 Aug 13  2020 /lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Aug 13  2020 /lib64 -> usr/lib64
$ ldd /bin/sh|grep ld
/lib/ld-linux-riscv64-lp64d.so.1 (0x0000003fb8185000)
$ ls -l /lib/ld-linux-riscv64-lp64d.so.1
lrwxrwxrwx 1 root root 19 Aug  4 19:28 /lib/ld-linux-riscv64-lp64d.so.1 -> ../lib64/ld-2.32.so

$ uname -r
5.10.6+

So even though the canonical linker path uses /lib/, we need the /lib64 symlink
to be present.