]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
16 months agoMerge pull request #25918 from bluca/smbios_sd_notify
Lennart Poettering [Fri, 6 Jan 2023 14:21:27 +0000 (15:21 +0100)] 
Merge pull request #25918 from bluca/smbios_sd_notify

Support AF_VSOCK in sd_notify and pick up notify_socket from creds

16 months agojournald: fix followup comments on regex feature
Quentin Deslandes [Fri, 6 Jan 2023 08:15:55 +0000 (09:15 +0100)] 
journald: fix followup comments on regex feature

Fix followup comments on PR #24058:
- Use `mempcpy_safe()`.
- Remove unused `pcre2_code` variable.
- Use `static const` when relevant.

16 months agonspawn: guard acl_free() with a NULL check
Lennart Poettering [Fri, 6 Jan 2023 11:30:36 +0000 (12:30 +0100)] 
nspawn: guard acl_free() with a NULL check

Inspired by #25957 there's one other place where we don't guard
acl_free() calls with a NULL check.

Fix that.

16 months agotmpfiles: avoid null free() for acl attributes
Sam James [Fri, 6 Jan 2023 10:58:32 +0000 (10:58 +0000)] 
tmpfiles: avoid null free() for acl attributes

When built with ACL support, we might be processing a tmpfiles
entry where there's no cause for us to call parse_acls_from_arg,
then we get to the end of parse_line without having ever populated
i.{acl_access, acl_default}.

Then we pass a null pointer into acl_free().

From UBSAN w/ GCC 13.0.0_pre20230101:
```
$ systemd-tmpfiles --clean
/var/tmp/portage/sys-apps/acl-2.3.1-r1/work/acl-2.3.1/libacl/acl_free.c:44:14: runtime error: applying non-zero offset 18446744073709551608 to null pointer
    #0 0x7f65d868b482 in acl_free /var/tmp/portage/sys-apps/acl-2.3.1-r1/work/acl-2.3.1/libacl/acl_free.c:44
    #1 0x55fe7e592249 in item_free_contents ../systemd-9999/src/tmpfiles/tmpfiles.c:2855
    #2 0x55fe7e5a347a in parse_line ../systemd-9999/src/tmpfiles/tmpfiles.c:3158
    #3 0x55fe7e5a347a in read_config_file ../systemd-9999/src/tmpfiles/tmpfiles.c:3897
    #4 0x55fe7e590c61 in read_config_files ../systemd-9999/src/tmpfiles/tmpfiles.c:3985
    #5 0x55fe7e590c61 in run ../systemd-9999/src/tmpfiles/tmpfiles.c:4157
    #6 0x55fe7e590c61 in main ../systemd-9999/src/tmpfiles/tmpfiles.c:4218
    #7 0x7f65d7ebe289  (/usr/lib64/libc.so.6+0x23289)
    #8 0x7f65d7ebe344 in __libc_start_main (/usr/lib64/libc.so.6+0x23344)
    #9 0x55fe7e591900 in _start (/usr/bin/systemd-tmpfiles+0x11900)
```

16 months agoman: document explicitly that LogRateLimit= has no effect on StandardOutput=file:…
Lennart Poettering [Fri, 6 Jan 2023 10:00:48 +0000 (11:00 +0100)] 
man: document explicitly that LogRateLimit= has no effect on StandardOutput=file:…

Fixes: #25951
16 months agoMerge pull request #25947 from poettering/resolved-dns-creds
Daan De Meyer [Fri, 6 Jan 2023 13:11:57 +0000 (14:11 +0100)] 
Merge pull request #25947 from poettering/resolved-dns-creds

resolved: add support for reading DNS config from kernel cmdline + service credentials

16 months agogpt-auto-generator: improve log messages a bit
Lennart Poettering [Thu, 5 Jan 2023 21:38:55 +0000 (22:38 +0100)] 
gpt-auto-generator: improve log messages a bit

Fixes: #20331
16 months agoCODING_STYLE: fix 'better' typo
Sam James [Fri, 6 Jan 2023 11:39:10 +0000 (11:39 +0000)] 
CODING_STYLE: fix 'better' typo

16 months agobootctl: Fix NULL pointer dereference
Jan Janssen [Fri, 6 Jan 2023 08:26:04 +0000 (09:26 +0100)] 
bootctl: Fix NULL pointer dereference

Fixes: #25952
16 months agobootspec: show default/selected entry info in JSON output
Lennart Poettering [Thu, 5 Jan 2023 19:41:20 +0000 (20:41 +0100)] 
bootspec: show default/selected entry info in JSON output

Fixes: #25889
16 months agoresolved: disable SO_BINDTOIFINDEX hack for localhost IP addresses
Lennart Poettering [Thu, 5 Jan 2023 21:10:46 +0000 (22:10 +0100)] 
resolved: disable SO_BINDTOIFINDEX hack for localhost IP addresses

Fixes: #23010
16 months agoUpdate TODO 25918/head
Luca Boccassi [Mon, 2 Jan 2023 22:43:33 +0000 (23:43 +0100)] 
Update TODO

16 months agocreds: import 'vmm.notify_socket' and use it to set
Luca Boccassi [Tue, 3 Jan 2023 17:11:04 +0000 (18:11 +0100)] 
creds: import 'vmm.notify_socket' and use it to set

This is intended to be used with VSOCK, to notify the hypervisor/VMM, eg on the host:

qemu <...> -smbios type=11,value=io.systemd.credential:vmm.notify_socket=vsock:2:1234 -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=42

(vsock:2:1234 -> send to host on vsock port 1234, default is to send to 0 which is
the hypervisor itself)

Also on the host:

$ socat - VSOCK-LISTEN:1234,socktype=5
READY=1
STATUS=Ready.

16 months agosd_notify: support AF_VSOCK
Luca Boccassi [Tue, 3 Jan 2023 17:08:09 +0000 (18:08 +0100)] 
sd_notify: support AF_VSOCK

Allow sending notifications via AF_VSOCK, so that VMs can communicate
to the hypervisor/VMM that they are finished booting.

Note that if the hypervisor does not support SOCK_DGRAM over AF_VSOCK
(ie: qemu at the time of writing), SOCK_SEQPACKET will be used instead.

16 months agohwdb: Add Dell models that require ACCEL_LOCATION=base
Dirk Su [Thu, 5 Jan 2023 09:09:49 +0000 (17:09 +0800)] 
hwdb: Add Dell models that require ACCEL_LOCATION=base

16 months agokernel-install: run depmod only if writeable
Ludwig Nussel [Wed, 21 Dec 2022 12:57:47 +0000 (13:57 +0100)] 
kernel-install: run depmod only if writeable

16 months agovirt: fix container detection
Benjamin Tissoires [Thu, 5 Jan 2023 12:57:51 +0000 (13:57 +0100)] 
virt: fix container detection

Commit 1b86c7c59ecc ("virt: make virtualization enum a named type")
made the conversion from `if (!r)` to `if (v != VIRTUALIZATION_NONE)`.

However, the initial test was meaning "if r is null", IOW "if r IS
`VIRTUALIZATION_NONE`).

The test is wrong and this can lead to false detection of the container
environment (when calling `systemctl exit`).

For example, https://gitlab.freedesktop.org/whot/libevdev/-/jobs/34207974
is calling `systemctl exit 0`, and systemd terminates with the exit code
`130`.

Fixing that typo makes `systemctl exit 0` returns `0`.

Fixes: 1b86c7c59ecc26efdf278f5c1c4430346021cd38.
16 months agobootctl: print entry token as well
Ludwig Nussel [Wed, 7 Dec 2022 10:43:56 +0000 (11:43 +0100)] 
bootctl: print entry token as well

16 months agounits: condition systemd-networkd-wait-online.service like systemd-networkd.service
Lennart Poettering [Thu, 5 Jan 2023 16:34:40 +0000 (17:34 +0100)] 
units: condition systemd-networkd-wait-online.service like systemd-networkd.service

This adds the same condition that systemd-networkd.service already
carries also to systemd-networkd-wait-online.service. Otherwise we'll
potentially see some logs we'd rather not see about a service we BindTo=
not running. Or in other words, if service X binds to Y then X should be
at least as conditioned as Y.

16 months agodns-domain: dns_name_is_empty() is redundant
Lennart Poettering [Thu, 5 Jan 2023 15:18:31 +0000 (16:18 +0100)] 
dns-domain: dns_name_is_empty() is redundant

dns_name_is_empty() was added later, but does the same thing as the more
accurately called dns_name_is_root(), hence drop the former.

16 months agoresolvectl: remove duplicate ':' from output
Lennart Poettering [Thu, 5 Jan 2023 16:34:18 +0000 (17:34 +0100)] 
resolvectl: remove duplicate ':' from output

The second argument to dump_list() actually ends up in a TABLE_FIELD
cell now, where we implicitly append a ":". Hence drop it from the
strings.

Follow-up for: 37a50123fac050c7ccde4afcf3f37ee77aad012c

16 months agoupdate TODO 25947/head
Lennart Poettering [Thu, 5 Jan 2023 17:42:10 +0000 (18:42 +0100)] 
update TODO

16 months agoresolved: read DNS conf also from creds and kernel cmdline
Lennart Poettering [Thu, 5 Jan 2023 14:35:20 +0000 (15:35 +0100)] 
resolved: read DNS conf also from creds and kernel cmdline

Note that this drops ProtectProc=invisible from
systemd-resolved.service.

This is done because othewise access to the booted "kernel" command line is not
necessarily available. That's because in containers we want to read
/proc/1/cmdline for that.

Fixes: #24103
16 months agosrc/shared/: split AF_UNIX/AF_VSOCK address parsing into src/basic/
Luca Boccassi [Tue, 3 Jan 2023 17:01:28 +0000 (18:01 +0100)] 
src/shared/: split AF_UNIX/AF_VSOCK address parsing into src/basic/

We'll use it from libsystemd0 later, but AF_INET/6 requires some
netlink calls and thus the additional library dependency

16 months agovconsole: permit configuration of vconsole settings via credentials
Lennart Poettering [Tue, 3 Jan 2023 12:05:32 +0000 (13:05 +0100)] 
vconsole: permit configuration of vconsole settings via credentials

16 months agoMerge pull request #25929 from poettering/resolvectl-loopback-fix
Luca Boccassi [Thu, 5 Jan 2023 12:25:13 +0000 (13:25 +0100)] 
Merge pull request #25929 from poettering/resolvectl-loopback-fix

resolvectl: show 127.0.0.1 among global DNS servers again

16 months agoupdate TODO
Lennart Poettering [Thu, 5 Jan 2023 09:33:32 +0000 (10:33 +0100)] 
update TODO

16 months agosystemctl: enable: overwrite broken alias symlinks
Mike Yuan [Thu, 29 Dec 2022 06:51:06 +0000 (14:51 +0800)] 
systemctl: enable: overwrite broken alias symlinks

When switching to an alternative alias provider,
the previous one might have been uninstalled or so.
It should be fine for us to overwrite them directly.

Closes #23694

16 months agosystemctl: edit: rephrase edit markers to avoid misunderstanding
Mike Yuan [Tue, 27 Dec 2022 09:41:18 +0000 (17:41 +0800)] 
systemctl: edit: rephrase edit markers to avoid misunderstanding

Closes #25856

16 months agoudev: Fix some tablet pads being classified as mouse or joysticks
Joshua Goins [Mon, 26 Dec 2022 17:48:10 +0000 (12:48 -0500)] 
udev: Fix some tablet pads being classified as mouse or joysticks

16 months agoman: note that DynamicUser=yes is incompatible with D-Bus
Luca Boccassi [Wed, 28 Dec 2022 16:27:37 +0000 (17:27 +0100)] 
man: note that DynamicUser=yes is incompatible with D-Bus

Due to policy checks against system users this cannot currently work, and it is non-obvious.
In the future it might be implemented if support is added to dbus-broker/dbus-daemon, e.g.:

https://github.com/bus1/dbus-broker/issues/259

16 months agoMerge pull request #25802 from poettering/bootctl-reseed
Lennart Poettering [Wed, 4 Jan 2023 16:49:21 +0000 (17:49 +0100)] 
Merge pull request #25802 from poettering/bootctl-reseed

move EFI random seed update logic from systemd-random-seed.service into separate service

16 months agoresolvectl: don't filter loopback DNS server from global DNS server list 25929/head
Lennart Poettering [Wed, 4 Jan 2023 15:36:15 +0000 (16:36 +0100)] 
resolvectl: don't filter loopback DNS server from global DNS server list

"resolvectl status" shows per-link DNS servers separately from global
ones. When querying the global list, it will contain both per-link and
global servers however. Thus, to not show duplicate info we filter all
entries that actually have a non-zero ifindex set (under the assumption
that that's a per-link server).

This doesn't work if people configured 127.0.0.1 as global server
though, as we'll add ifindex 1 to it since
6e32414a66ff8dbcef233981a7066684d903ee9f unconditionally even for global
servers.

Let's address that by excluding entries with ifindex 1 from suppression.
This is safe as resolved ignores loopback ifaces, hence never will have
per-link servers on ifindex 1.

Note that this splits up the "with_ifindex" parameter into a second
parameter "only_global", since they semantically do two different
things. One controls whether we shall expect/parse an ifindex dbus
field. The other controls whether we shall filter all ifindex values set
!= 0. These are effectively always used in conjunction hence making them
the same actually worked. However this is utterly confusing I think,
which as I guess is resulting in the confusion around #25796 (which
removes the whole check)

Replaces: #25796

16 months agoresolved: add some line-breaks/comments
Lennart Poettering [Wed, 4 Jan 2023 15:32:51 +0000 (16:32 +0100)] 
resolved: add some line-breaks/comments

Let's make this a bit more readable.

16 months agoresolvectl: fix type of ifindex D-Bus field, and make sure to initialize to zero...
Lennart Poettering [Wed, 4 Jan 2023 15:29:34 +0000 (16:29 +0100)] 
resolvectl: fix type of ifindex D-Bus field, and make sure to initialize to zero in all code paths

16 months agobootctl: split out setting of system token into function of its own 25802/head
Lennart Poettering [Tue, 20 Dec 2022 17:03:06 +0000 (18:03 +0100)] 
bootctl: split out setting of system token into function of its own

Let's break a huge function in two. No code change, just some
refactoring.

16 months agounits: rename/rework systemd-boot-system-token.service → systemd-boot-random-seed...
Lennart Poettering [Tue, 20 Dec 2022 16:16:47 +0000 (17:16 +0100)] 
units: rename/rework systemd-boot-system-token.service → systemd-boot-random-seed.service

This renames systemd-boot-system-token.service to
systemd-boot-random-seed.service and conditions it less strictly.

Previously, the job of the service was to write a "system token" EFI
variable if it was missing. It called "bootctl --graceful random-seed"
for that. With this change we condition it more liberally: instead of
calling it only when the "system token" EFI variable isn't set, we call
it whenever a boot loader interface compatible boot loader is used. This
means, previously it was invoked on the first boot only: now it is
invoked at every boot.

This doesn#t change the command that is invoked. That's because
previously already the "bootctl --graceful random-seed" did two things:
set the system token if not set yet *and* refresh the random seed in the
ESP. Previousy we put the focus on the former, now we shift the focus to
the latter.

With this simple change we can replace the logic
f913c784ad4c93894fd6cb2590738113dff5a694 added, but from a service that
can run much later and doesn't keep the ESP pinned.

16 months agobootctl: downgrade graceful messages to LOG_NOTICE
Lennart Poettering [Tue, 20 Dec 2022 15:34:36 +0000 (16:34 +0100)] 
bootctl: downgrade graceful messages to LOG_NOTICE

16 months agorandom-seed: don't refresh EFI random seed from random-seed.c anymore
Lennart Poettering [Tue, 20 Dec 2022 15:18:11 +0000 (16:18 +0100)] 
random-seed: don't refresh EFI random seed from random-seed.c anymore

The ESP is simply not mounted early enough for this. We want that the
regular random seed handling runs as early as we possibly could, but we
don't want to delay this until the ESP is actually mounted.

Hence, let's remove this from random-seed.c here. A follow-up commit
will then add this back in, in a separate service which just calls
"bootctl random-seed".

Effectively reverts: f913c784ad4c93894fd6cb2590738113dff5a694

Fixes: #25769
16 months agosha256: add helper than hashes a buffer *and* its size
Lennart Poettering [Tue, 20 Dec 2022 10:53:37 +0000 (11:53 +0100)] 
sha256: add helper than hashes a buffer *and* its size

We use this pattern all the time in order to thward extension attacks,
add a helper to make it shorter.

16 months agobootctl: when updating EFI random seed file, hash old seed with new one
Lennart Poettering [Tue, 20 Dec 2022 10:48:21 +0000 (11:48 +0100)] 
bootctl: when updating EFI random seed file, hash old seed with new one

Let's not regress in entropy in any case.

This does what f913c784ad4c93894fd6cb2590738113dff5a694 also does.

16 months agobootctl: properly sync fs before/after moving random seed file into place
Lennart Poettering [Tue, 20 Dec 2022 10:15:51 +0000 (11:15 +0100)] 
bootctl: properly sync fs before/after moving random seed file into place

Let's do a careful, focussed sync at the right places instead of a
blanket sync at the end. After all we want to run this on every boot
soon.

16 months agobootctl: rework random seed logic to use open_mkdir_at() and openat()
Lennart Poettering [Mon, 19 Dec 2022 21:26:30 +0000 (22:26 +0100)] 
bootctl: rework random seed logic to use open_mkdir_at() and openat()

This doesn't really fix anything, but in general we should put stronger
emphasis on operating via dir fds rather than paths more (in particular
when writing files as opposed to consuming them).

No real change in behaviour.

16 months agobootctl: fix errno logging
Lennart Poettering [Mon, 19 Dec 2022 21:25:28 +0000 (22:25 +0100)] 
bootctl: fix errno logging

16 months agohwdb: remove spurious whitespace
Luca Boccassi [Tue, 3 Jan 2023 22:18:43 +0000 (23:18 +0100)] 
hwdb: remove spurious whitespace

Fixes test failures.
Follow-up for c3950f0a27fb7d2298a2182f21d645c7017f9c0c and
https://github.com/systemd/systemd/pull/25908

16 months agoefi: skip Read() calls with zero sizes
Lennart Poettering [Tue, 3 Jan 2023 14:58:46 +0000 (15:58 +0100)] 
efi: skip Read() calls with zero sizes

Let's avoid calling Read() with zero-sized buffer, to avoid needless firmware
quirkiness.

See: #25911

16 months agoresolved: downgrade inability to send varlink reply error message
Lennart Poettering [Tue, 3 Jan 2023 15:26:55 +0000 (16:26 +0100)] 
resolved: downgrade inability to send varlink reply error message

Previously, if a client disconnected after sending a lookup request but
before waiting for the reply we'd log at LOG_ERR level. That's
confusing, since it's entirely OK for the client to lose interest.

Hence, let's downgrade to debug level.

Fixes: #25892
16 months agoMerge pull request #25910 from crrodriguez/wth_c2x
Luca Boccassi [Tue, 3 Jan 2023 22:10:36 +0000 (23:10 +0100)] 
Merge pull request #25910 from crrodriguez/wth_c2x

Fix FTBS when -std=gnu2x

16 months agoudev: match device tags in rules using current device tags
msizanoen1 [Tue, 27 Dec 2022 04:57:12 +0000 (11:57 +0700)] 
udev: match device tags in rules using current device tags

This ensures that udev scripts using `TAG-="..."` and expecting later
udev rules to honor it will work properly. An use case is removing the
`uaccess` tag from a device without overriding the original file and
ensuring that `73-seat-uaccess.rules` won't run the uaccess builtin later.

16 months agoAdded Tablet Teclast X98 Air 3G (C5J6)
marcel151 [Sun, 1 Jan 2023 18:19:19 +0000 (19:19 +0100)] 
Added Tablet Teclast X98 Air 3G (C5J6)

Latest BIOS of X98 Air 3G has later date, that's why it wasn't recognized. Uses the same Matrix as the X89 (E7ED).

16 months agoefi-api: check the EFI_TCG2_FINAL_EVENTS_TABLE in efi_has_tpm2()
Jia Zhang [Sat, 24 Dec 2022 09:46:01 +0000 (17:46 +0800)] 
efi-api: check the EFI_TCG2_FINAL_EVENTS_TABLE in efi_has_tpm2()

The EFI firmware may provide the TPM2 event log using
EFI_TCG2_FINAL_EVENTS_TABLE stored in EFI configuration table,
instead of the ACPI Table TPM2.

If the ACPI Table TPM2 doesn't exist, try to check whether
EFI_TCG2_FINAL_EVENTS_TABLE is available or not.

Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
16 months agoRevert "boot: Use EFI_BOOT_MANAGER_POLICY_PROTOCOL to connect console devices"
Jan Janssen [Fri, 23 Dec 2022 13:14:53 +0000 (14:14 +0100)] 
Revert "boot: Use EFI_BOOT_MANAGER_POLICY_PROTOCOL to connect console devices"

This reverts commit b99bf5811850afdb2502ba37251c48348da63c82.

It seems that using this protocol on some firmwares to forcibly
initialize console devices may break handles (already opened file
handles and the device handle itself) that we rely on to access the
boot filesystem, making it impossible to load the selected entry.

It might be possible to get a new handle by querying for the device
handle by using its device path after calling into this protocol, but
this is untested. The firmware might also be so buggy that accessing
devices after using this protocol is impossible.

It seems prudent to revert this for now until some reliable way is found
to initialize console devices without introducing huge boot delays. Any
users on firmware where console devices cannot be accessed would have to
rely on disabling fastboot.

Fixes: #25737, #25846
16 months agolibsystemd-network: FTBS in c2x mode 25910/head
Cristian Rodríguez [Mon, 2 Jan 2023 00:08:52 +0000 (00:08 +0000)] 
libsystemd-network: FTBS in c2x mode

cannot pass false as argument because function wants a pointer to bool
instead, use NULL instead

16 months agobasic: Fix incompatible type for arguments errors in C2X
Cristian Rodríguez [Mon, 2 Jan 2023 00:06:57 +0000 (00:06 +0000)] 
basic: Fix incompatible type for arguments errors in C2X

GCC-13 -std=gnu2x FTBS with:

error: incompatible type for argument 3 of ‘_hashmap_free’

16 months agobasic: fix hosed return value in skip_session()
Cristian Rodríguez [Sun, 1 Jan 2023 22:40:26 +0000 (22:40 +0000)] 
basic: fix hosed return value in skip_session()

../src/basic/cgroup-util.c: In function ‘skip_session’:
../src/basic/cgroup-util.c:1241:32: error: incompatible types when returning type ‘_Bool’ but ‘const char *’ was expected
 1241 |                         return false;

16 months agoman: Fix systemd-boot man page wrong secure keys location
igo95862 [Tue, 3 Jan 2023 07:18:58 +0000 (10:18 +0300)] 
man: Fix systemd-boot man page wrong secure keys location

The keys should be placed at `/loader/keys/` not `/keys/`.

See `src/boot/efi/boot.c` file and
function `secure_boot_discover_keys`.

16 months agofundamental: rework IN_SET() to require at least three arguments
Lennart Poettering [Mon, 2 Jan 2023 14:22:15 +0000 (15:22 +0100)] 
fundamental: rework IN_SET() to require at least three arguments

If less than three parameters are passed a simple comparison is the
better choice.

Lo and behold this found two pretty bad typos.

16 months agocore: rework operation_to_signal() to rename return parameter ret_xyz
Lennart Poettering [Mon, 2 Jan 2023 12:32:33 +0000 (13:32 +0100)] 
core: rework operation_to_signal() to rename return parameter ret_xyz

16 months agoMerge pull request #25912 from DaanDeMeyer/ukify
Daan De Meyer [Mon, 2 Jan 2023 15:07:58 +0000 (16:07 +0100)] 
Merge pull request #25912 from DaanDeMeyer/ukify

ukify fixes

16 months agomanager: perform objective->shutdown_verb mapping locally
Vito Caputo [Thu, 29 Dec 2022 01:53:22 +0000 (17:53 -0800)] 
manager: perform objective->shutdown_verb mapping locally

This is a small cleanup removing the need for the spurious
*ret_shutdown_verb argument on invoke_main_loop() while moving
the MANAGER_OBJECTIVE::shutdown_verb string mapping local to
where it actually gets added to the shutdown argv in
become_shutdown().

This also eliminates the need for the several clearings of
*ret_shutdown_argv, and the streq() branches of shutdown_verb in
favor of plain equality tests against the objective value.

Nothing functionally has been changed.

16 months agoukify: Fix section offset calculation
Jan Janssen [Sun, 1 Jan 2023 10:32:55 +0000 (11:32 +0100)] 
ukify: Fix section offset calculation

objcopy seems to expect that the offset passed to --change-section-vma
is absolute instead of relative to ImageBase. If this is not accounted
for an invalid image is created that cannot be loaded:

  0 .osrel        0000016b  0000000200016000  0000000200016000  00000400  2**2
  …
  6 .text         0000d242  0000000140001000  0000000140001000  00c6e800  2**4

This isn't an issue with gnu-efi based PE images, but natively created
ones will have a non-zero ImageBase.

16 months 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.

16 months 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()

16 months 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

17 months 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.

17 months 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

17 months 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

17 months 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>
17 months 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()

17 months 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.

17 months 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

17 months 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

17 months 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()

17 months 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

17 months 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

17 months 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]*.

17 months 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

17 months 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

17 months 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

17 months 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

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

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

17 months 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

17 months 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()

17 months 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()

17 months 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()

17 months 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
17 months 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

17 months 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()

17 months 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()

17 months 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()

17 months 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()

17 months 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()

17 months 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.

17 months 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()

17 months 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

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

17 months 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>
17 months 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

17 months 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