]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agocore/namespace: do not return 1 unnecessarily 28764/head
Yu Watanabe [Tue, 22 Aug 2023 11:05:41 +0000 (20:05 +0900)] 
core/namespace: do not return 1 unnecessarily

The caller of this function apply_mounts() -> apply_one_mount() only
checks if the return value is negative or not.

2 years agocore/namespace: add missing string table entries
Yu Watanabe [Fri, 11 Aug 2023 05:56:05 +0000 (14:56 +0900)] 
core/namespace: add missing string table entries

2 years agomount-util: drop unused remount_and_move_sub_mounts()
Yu Watanabe [Thu, 10 Aug 2023 05:36:14 +0000 (14:36 +0900)] 
mount-util: drop unused remount_and_move_sub_mounts()

2 years agocore/namespace: reimplement mount_private_sysfs() in the same logic to mount private...
Yu Watanabe [Thu, 10 Aug 2023 04:58:54 +0000 (13:58 +0900)] 
core/namespace: reimplement mount_private_sysfs() in the same logic to mount private procfs

Previously, mount_private_sysfs() was implemented by using open_tree()
and move_mount() to keep submounts. But these syscalls are slightly new
and supported since kernel version 5.2.

We already do the same thing for /proc/, but without the new syscalls.
Let's use the same logic to mount private procfs. Then, we can mount
new instance of sysfs with older kernels.

2 years agocore/namespace: use ERRNO_IS_NEG_PRIVILEGE()
Yu Watanabe [Thu, 10 Aug 2023 20:39:57 +0000 (05:39 +0900)] 
core/namespace: use ERRNO_IS_NEG_PRIVILEGE()

Also, this makes mount_procfs() always return the last failure in mount(),
and slightly reduces indentation by returning earlier.

2 years agoMerge pull request #28787 from yuwata/credential-next
Zbigniew Jędrzejewski-Szmek [Tue, 22 Aug 2023 14:21:00 +0000 (16:21 +0200)] 
Merge pull request #28787 from yuwata/credential-next

core: do not leak mount for credentials directory if possible

2 years agosysext: fix a memory leak
Frantisek Sumsal [Tue, 22 Aug 2023 09:31:07 +0000 (11:31 +0200)] 
sysext: fix a memory leak

Introduced by 41712cd1c0d.

=================================================================
==2194==ERROR: LeakSanitizer: detected memory leaks
Indirect leak of 359856 byte(s) in 459 object(s) allocated from:
    #0 0x7ffff7511df4  (/usr/lib64/clang/16/lib/linux/libclang_rt.asan-powerpc64le.so+0x191df4) (BuildId: 47e1dd371a2b8525b6cb737760a4dc535f30ea10)
    #1 0x7ffff6bb5fb0 in message_from_header /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-message.c:372:13
    #2 0x7ffff6bb5fb0 in bus_message_from_malloc /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-message.c:421:13
    #3 0x7ffff6c23f54 in bus_socket_make_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-socket.c:1222:13
    #4 0x7ffff6c22d10 in bus_socket_read_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/bus-socket.c
    #5 0x7ffff6c4d414 in bus_read_message /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/sd-bus.c:2082:16
    #6 0x7ffff6c4d414 in sd_bus_call /systemd-meson-build/../root/systemd/src/libsystemd/sd-bus/sd-bus.c:2480:21
    #7 0x7ffff6682904 in bus_service_manager_reload /systemd-meson-build/../root/systemd/src/shared/bus-unit-util.c:2823:13
    #8 0x1000d570 in daemon_reload /systemd-meson-build/../root/systemd/src/sysext/sysext.c:233:16
    #9 0x100090f8 in merge /systemd-meson-build/../root/systemd/src/sysext/sysext.c:895:21
    #10 0x10006ff4 in verb_merge /systemd-meson-build/../root/systemd/src/sysext/sysext.c:964:16
    #11 0x7ffff69ae894 in dispatch_verb /systemd-meson-build/../root/systemd/src/shared/verbs.c:103:24
    #12 0x10004570 in sysext_main /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1194:16
    #13 0x10004570 in run /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1214:16
    #14 0x10004570 in main /systemd-meson-build/../root/systemd/src/sysext/sysext.c:1217:1
    #15 0x7ffff5f5a968 in generic_start_main.isra.0 (/lib64/libc.so.6+0x2a968) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
    #16 0x7ffff5f5ab00 in __libc_start_main (/lib64/libc.so.6+0x2ab00) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
Indirect leak of 124984 byte(s) in 459 object(s) allocated from:
...
    #11 0x7ffff5f5a968 in generic_start_main.isra.0 (/lib64/libc.so.6+0x2a968) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
    #12 0x7ffff5f5ab00 in __libc_start_main (/lib64/libc.so.6+0x2ab00) (BuildId: c218e04818632a05c23f6fdcca16f93e95ea7de2)
SUMMARY: AddressSanitizer: 493766 byte(s) leaked in 1383 allocation(s).

2 years agonetwork: several follow-ups for TCP-RTO setting
Yu Watanabe [Tue, 22 Aug 2023 07:06:01 +0000 (16:06 +0900)] 
network: several follow-ups for TCP-RTO setting

- rename TCPRetransmissionTimeOutSec= -> TCPRetransmissionTimeoutSec,
- refuse infinity,
- fix the input value verifier (USEC_PER_SEC -> USEC_PER_MSEC),
- use DIV_ROUND_UP() when assigning the value.

Follow-ups for 1412d4a4fea234fd2afda26b1241cd700246a672.
Closes #28898.

2 years agoMerge pull request #28914 from poettering/boot-poweroff
Zbigniew Jędrzejewski-Szmek [Tue, 22 Aug 2023 12:55:24 +0000 (14:55 +0200)] 
Merge pull request #28914 from poettering/boot-poweroff

sd-boot: add quick hotkeys for poweroff/reboot

2 years agocore: simplify get_process_umask() invocation
Lennart Poettering [Tue, 22 Aug 2023 08:35:53 +0000 (10:35 +0200)] 
core: simplify get_process_umask() invocation

2 years agonetwork: fix log message and man page for HopLimit=
Yu Watanabe [Tue, 22 Aug 2023 06:49:49 +0000 (15:49 +0900)] 
network: fix log message and man page for HopLimit=

Follow-up for 88c0642358398240a54d242e812439fcd0564b05.
Closes #28899.

2 years agoupdate TODO 28914/head
Lennart Poettering [Mon, 21 Aug 2023 21:27:21 +0000 (23:27 +0200)] 
update TODO

2 years agoboot: add control-less alias for Ctrl-l hotkey
Lennart Poettering [Tue, 22 Aug 2023 09:28:10 +0000 (11:28 +0200)] 
boot: add control-less alias for Ctrl-l hotkey

I couldn't get ctrl work properly over serial line/qemu. Hence, let's
add an alias for Ctrl-l: a simple Shift-l (i.e. uppercase L)

(Note that lowercase L will result in selection of the first Linux
entry, hence we stay away from that)

2 years agoboot: add hotkeys for rebooting/powering off the system from the boot menu
Lennart Poettering [Mon, 21 Aug 2023 20:59:53 +0000 (22:59 +0200)] 
boot: add hotkeys for rebooting/powering off the system from the boot menu

In a an environment with a serial console it's just too useful to
directly reboot/power off the machine without any further tooling.

2 years agoboot: modernize mangle_stub_cmdline() a bit + drop leading whitespace
Lennart Poettering [Mon, 21 Aug 2023 16:37:46 +0000 (18:37 +0200)] 
boot: modernize mangle_stub_cmdline() a bit + drop leading whitespace

Let's modernize the function a bit, and make it return the string passed
in, as we usually do.

Most importanly though: also drop leading whitespace, not just trailing
whitespace.

2 years agoboot: explain why we refuse to edit kernel cmdline when we do so
Lennart Poettering [Mon, 21 Aug 2023 20:56:07 +0000 (22:56 +0200)] 
boot: explain why we refuse to edit kernel cmdline when we do so

2 years agoMerge pull request #28903 from poettering/verbs-levenshtein
Lennart Poettering [Tue, 22 Aug 2023 08:15:00 +0000 (10:15 +0200)] 
Merge pull request #28903 from poettering/verbs-levenshtein

verbs: give helpful hint when people mistype command verbs on the cmdline of our tools

2 years agotest-execute: add tests for credentials directory with mount namespace 28787/head
Yu Watanabe [Sat, 12 Aug 2023 13:08:47 +0000 (22:08 +0900)] 
test-execute: add tests for credentials directory with mount namespace

This also adds cases that open_tree() and move_mount() are filtered, to
emulate old kernel behavior.

2 years agocore: do not leak mount for credentials directory if mount namespace is enabled
Yu Watanabe [Sat, 12 Aug 2023 06:18:41 +0000 (15:18 +0900)] 
core: do not leak mount for credentials directory if mount namespace is enabled

Since kernel v5.2, open_tree() and move_mount() are added. If a service
loads or sets credentials, then let's try to clone the mount that contains
credentials with open_tree(), then mount it after a (private) mount
namespace is initialized for the service. Then, we can setup a mount for
credentials directory without leaking it to the main shared mount
namespace.

With this change, the credentials for services that request their own
private mount namespace become much much safer. And, the number of mount
events triggered by setting up credential directories can be decreased.

Unfortunately, this does not 'fix' the original issue #25527, as the
reported service does not requests private mount namespace, but the
situation should be better now.

2 years agocore/credential: make setup_credentials() return path to credentials directory
Yu Watanabe [Thu, 10 Aug 2023 06:55:25 +0000 (15:55 +0900)] 
core/credential: make setup_credentials() return path to credentials directory

Then, we can reuse the path when building environment variables and setting up
mount namespace.
No functional change, just refactoring.

2 years agocore: set $CREDENTIALS_DIRECTORY only when we set up credentials
Yu Watanabe [Sat, 12 Aug 2023 06:25:03 +0000 (15:25 +0900)] 
core: set $CREDENTIALS_DIRECTORY only when we set up credentials

It is not necessary to set the environment variable on an execution step
we do not support credentials.

2 years agocore/credential: split out unit_add_default_credential_dependencies()
Yu Watanabe [Sat, 12 Aug 2023 06:06:43 +0000 (15:06 +0900)] 
core/credential: split out unit_add_default_credential_dependencies()

No functional change, just refactoring.

2 years agocore: split out functions and definitions from execute.[ch] to credential.[ch]
Yu Watanabe [Thu, 10 Aug 2023 03:52:13 +0000 (12:52 +0900)] 
core: split out functions and definitions from execute.[ch] to credential.[ch]

The functions and definitions related to credential consume about 1000
lines in execute.c. Let's split out them to dedicated files.

2 years agoverbs: make a helpful suggestion when user types unrecognized verb 28903/head
Lennart Poettering [Mon, 21 Aug 2023 12:44:29 +0000 (14:44 +0200)] 
verbs: make a helpful suggestion when user types unrecognized verb

I have been mistyping commands too often myself, and I think the tools
could simply be more helpful, by suggesting to me what I probably wanted
to write. Copy/Paste FTW, after all!

2 years agostring-util: add a function to determine levenshtein distance of two strings
Lennart Poettering [Mon, 21 Aug 2023 11:38:03 +0000 (13:38 +0200)] 
string-util: add a function to determine levenshtein distance of two strings

2 years agoefi: add comment clarifying we should not use EV_IPL anymore
Lennart Poettering [Mon, 21 Aug 2023 16:38:18 +0000 (18:38 +0200)] 
efi: add comment clarifying we should not use EV_IPL anymore

2 years agoman: mention two more things logind does
Lennart Poettering [Mon, 21 Aug 2023 12:46:56 +0000 (14:46 +0200)] 
man: mention two more things logind does

Prompted by: #28902

2 years agoMerge pull request #28907 from poettering/have-seccomp-tweaks
Lennart Poettering [Mon, 21 Aug 2023 21:15:39 +0000 (23:15 +0200)] 
Merge pull request #28907 from poettering/have-seccomp-tweaks

reduce HAVE_SECCOMP ifdeffery

2 years agotree-wide: drop "static inline" use in .c files
Lennart Poettering [Mon, 21 Aug 2023 16:27:12 +0000 (18:27 +0200)] 
tree-wide: drop "static inline" use in .c files

"static inline" makes sense in .h files. But in .c files it's useless
decoration, the compiler should just make its own decisions there, and
it can do that.

hence, replace all remaining uses of "static line" by a simple" static"
in all .c files (but keep them in .h files, where they make sense)

2 years agoMerge pull request #28911 from weblate/weblate-systemd-master
Frantisek Sumsal [Mon, 21 Aug 2023 17:57:40 +0000 (17:57 +0000)] 
Merge pull request #28911 from weblate/weblate-systemd-master

Translations update from Fedora Weblate

2 years agopo: Translated using Weblate (Finnish) 28911/head
Jan Kuparinen [Mon, 21 Aug 2023 17:21:12 +0000 (19:21 +0200)] 
po: Translated using Weblate (Finnish)

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/fi/
Translation: systemd/main

2 years agopo: Translated using Weblate (Dutch)
Maarten [Mon, 21 Aug 2023 17:21:12 +0000 (19:21 +0200)] 
po: Translated using Weblate (Dutch)

Currently translated at 100.0% (227 of 227 strings)

Co-authored-by: Maarten <maarten@posteo.de>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/nl/
Translation: systemd/main

2 years agotree-wide: don't ifdef seccomp-util.h, drop seccomp.h inclusion everywhere 28907/head
Lennart Poettering [Mon, 21 Aug 2023 16:48:19 +0000 (18:48 +0200)] 
tree-wide: don't ifdef seccomp-util.h, drop seccomp.h inclusion everywhere

seccomp-util.h doesn't need ifdeffing, hence don't. It has worked since
quite a while with HAVE_SECCOMP is off, hence use it everywhere.

Also drop explicit seccomp.h inclusion everywhere (which needs
HAVE_SECCOMP ifdeffery everywhere). seccomp-util.h includes it anyway,
automatically, which we can just rely on, and it deals with HAVE_SECCOMP
at one central place.

2 years agoseccomp: move seccomp_parse_errno_or_action() into common definitions
Lennart Poettering [Mon, 21 Aug 2023 16:39:01 +0000 (18:39 +0200)] 
seccomp: move seccomp_parse_errno_or_action() into common definitions

Let's remove some HAVE_SECCOMP ifdeffery by simply defining the funcion
in question (seccomp_parse_errno_or_action() + related calls) into
common code that is also compiled if HAVE_SECCOMP is off.

This is generally the better approach anyway, since we want as much as
possible and easily feasible parsers work even if the code implementing
them is disabled. THis is easy to achieve here, hence do.

2 years agosd-mount: allow creating tmpfs
Luca Boccassi [Wed, 16 Aug 2023 01:00:47 +0000 (02:00 +0100)] 
sd-mount: allow creating tmpfs

Mount units can do it, but the command line tool cannot, as it needs a
valid 'what'. If --tmpfs/-T if passed, parse the argument as 'where'
and send a literal 'tmpfs' as the 'what' if not specified.

2 years agonetwork: ndisc - Allow to use ICMP6 rate limit from received RA
Susant Sahani [Wed, 16 Aug 2023 12:55:17 +0000 (18:25 +0530)] 
network: ndisc - Allow to use ICMP6 rate limit from received RA

2 years agosysext: support EXTENSION_RELOAD_MANAGER metadata
Mathieu Tortuyaux [Tue, 25 Apr 2023 12:06:59 +0000 (14:06 +0200)] 
sysext: support EXTENSION_RELOAD_MANAGER metadata

This metadata (EXTENSION_RELOAD_MANAGER) can be set to "1" to reload the manager
when merging/refreshing/unmerging a system extension image. This can be useful in case the sysext
image provides systemd units that need to be loaded.

With `--no-reload`, one can deactivate the EXTENSION_RELOAD_MANAGER metadata interpretation.

Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
2 years agogenerators: use generator_open_unit_file where appropriate
Mike Yuan [Sat, 12 Aug 2023 17:15:20 +0000 (01:15 +0800)] 
generators: use generator_open_unit_file where appropriate

2 years agoMerge pull request #28871 from ssahani/route-hoplimit
Luca Boccassi [Sat, 19 Aug 2023 00:12:01 +0000 (01:12 +0100)] 
Merge pull request #28871 from ssahani/route-hoplimit

network: static route - Allow to configure per route hop liimt

2 years agoupdate TODO
Lennart Poettering [Fri, 18 Aug 2023 17:22:46 +0000 (19:22 +0200)] 
update TODO

2 years agoinstall: Drop install_info_may_process() from unit_file_get_default()
Daan De Meyer [Fri, 18 Aug 2023 07:46:38 +0000 (09:46 +0200)] 
install: Drop install_info_may_process() from unit_file_get_default()

This currently makes unit_file_get_default() fail if the default
target is transient which shouldn't make us fail to get the default
unit.

2 years agohomed: reuse openssl-util.h cleanup helpers
Lennart Poettering [Fri, 18 Aug 2023 09:03:22 +0000 (11:03 +0200)] 
homed: reuse openssl-util.h cleanup helpers

2 years agoMerge pull request #28884 from poettering/tpm2-pcr6-name
Mike Yuan [Fri, 18 Aug 2023 12:19:51 +0000 (20:19 +0800)] 
Merge pull request #28884 from poettering/tpm2-pcr6-name

tpm2: give PCR 6 a name

2 years agoCI: network - Add test for route hoplimit 28871/head
Susant Sahani [Fri, 18 Aug 2023 08:30:46 +0000 (14:00 +0530)] 
CI: network - Add test for route hoplimit

2 years agotpm2-util: add _const_/_pure_ to a couple of to_string()/from_string() functions 28884/head
Lennart Poettering [Sun, 16 Jul 2023 09:14:11 +0000 (11:14 +0200)] 
tpm2-util: add _const_/_pure_ to a couple of to_string()/from_string() functions

2 years agotpm2-util: give PCR 6 a name too
Lennart Poettering [Wed, 16 Aug 2023 15:25:05 +0000 (17:25 +0200)] 
tpm2-util: give PCR 6 a name too

The specs call this TCG PC Client Platform Firmware Profile
Specification says this PCR is owned by the Host Platform Manufacturer,
at various places. Hence let's give it that name.

2 years agonetwork: static route - Allow to configure per route hop liimt
Susant Sahani [Wed, 16 Aug 2023 17:07:48 +0000 (22:37 +0530)] 
network: static route - Allow to configure per route hop liimt

2 years agocore/socket: don't consider service active when in SERVICE_AUTO_RESTART_QUEUED
Mike Yuan [Thu, 17 Aug 2023 15:37:01 +0000 (23:37 +0800)] 
core/socket: don't consider service active when in SERVICE_AUTO_RESTART_QUEUED

Follow-up for 09d04ad325473e05e23e6ba8382d7de1dd819bda

Fixes #28856

2 years agoMerge pull request #28870 from ssahani/rto-min-network
Luca Boccassi [Fri, 18 Aug 2023 08:23:45 +0000 (09:23 +0100)] 
Merge pull request #28870 from ssahani/rto-min-network

network: Route - allow to set TCP RTO

2 years agoMerge pull request #28846 from ssahani/custom-duid-dhcp4-26745
Luca Boccassi [Fri, 18 Aug 2023 08:23:30 +0000 (09:23 +0100)] 
Merge pull request #28846 from ssahani/custom-duid-dhcp4-26745

network: DHCP6 client- Allow to send manual DUID

2 years agoMerge pull request #28697 from 1awesomeJ/new_bsod
Luca Boccassi [Thu, 17 Aug 2023 23:20:04 +0000 (00:20 +0100)] 
Merge pull request #28697 from 1awesomeJ/new_bsod

systemd-bsod: Add "--continuous" option

2 years agoMake systemd-bsod not a public binary 28697/head
OMOJOLA JOSHUA [Thu, 17 Aug 2023 13:12:31 +0000 (14:12 +0100)] 
Make systemd-bsod not a public binary

2 years agodissect: Set SYSTEMD_DISSECT_DEVICE to path of loop device
Daan De Meyer [Thu, 17 Aug 2023 13:07:57 +0000 (15:07 +0200)] 
dissect: Set SYSTEMD_DISSECT_DEVICE to path of loop device

For some use cases we want to operate on the loop device that
systemd-dissect has attached the loop device to, so let's make that
easily accessible.

2 years agoCI: network dhcp6 - Add test for custom client identifier 28846/head
Susant Sahani [Thu, 17 Aug 2023 13:50:02 +0000 (19:20 +0530)] 
CI: network dhcp6 - Add test for custom client identifier

2 years agonetwork: DHCP6 client- Allow to send manual DUID
Susant Sahani [Tue, 15 Aug 2023 13:26:19 +0000 (18:56 +0530)] 
network: DHCP6 client- Allow to send manual DUID

```
[DHCPv6]
DUIDType=custom
DUIDRawData=00:00:ab:11:f9:2a:c2:77:29:f9:5c:00
```

```
Client Identifier
    Option: Client Identifier (1)
    Length: 12
    DUID: 0000ab11f92ac27729f95c00
    DUID Type: Unknown (0)
```

2 years agoCI: network - Add test for route TCP RTO 28870/head
Susant Sahani [Thu, 17 Aug 2023 18:19:32 +0000 (23:49 +0530)] 
CI: network - Add test for route TCP RTO

2 years agonetwork: Route - allow to set TCP RTO
Susant Sahani [Thu, 17 Aug 2023 12:07:14 +0000 (17:37 +0530)] 
network: Route - allow to set TCP RTO

2 years agotest: Check that SELinux policy is available before running SELinux test (#28868)
Johannes Segitz [Thu, 17 Aug 2023 17:04:53 +0000 (19:04 +0200)] 
test: Check that SELinux policy is available before running SELinux test (#28868)

* test: Check that SELinux policy is available before running SELinux test

---------

Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
2 years agoMerge pull request #28832 from dtardon/list-clear
Luca Boccassi [Thu, 17 Aug 2023 15:27:43 +0000 (16:27 +0100)] 
Merge pull request #28832 from dtardon/list-clear

Add LIST_CLEAR() helper that empties the list

2 years agoMerge pull request #28869 from DaanDeMeyer/repart-trailing
Daan De Meyer [Thu, 17 Aug 2023 12:55:03 +0000 (14:55 +0200)] 
Merge pull request #28869 from DaanDeMeyer/repart-trailing

repart: Make sure we keep trailing slashes in ExcludeFiles=

2 years agosystemd-bsod: Add "--continuous" option
OMOJOLA JOSHUA [Sun, 6 Aug 2023 16:09:27 +0000 (17:09 +0100)] 
systemd-bsod: Add "--continuous" option

2 years agoMerge pull request #28751 from yuwata/mount-revert
Luca Boccassi [Thu, 17 Aug 2023 12:03:36 +0000 (13:03 +0100)] 
Merge pull request #28751 from yuwata/mount-revert

Revert "mount: check right before invoking /bin/umount if it makes sense"

2 years agomeson: Use rsync to copy test data directories
Daan De Meyer [Wed, 16 Aug 2023 19:22:57 +0000 (21:22 +0200)] 
meson: Use rsync to copy test data directories

install_subdir() does not copy symlinks but copies the file they
point to. We also get a very ugly warning in the meson install
output:

"""
Warning: trying to copy a symlink that points to a file. This will copy the file,
but this will be changed in a future version of Meson to copy the symlink as is. Please update your
build definitions so that it will not break when the change happens.
"""

Let's fix both problems at once by using rsync which does the right
thing. Verified by running systemd-dissect --mtree on both the install
output before and after and all the symlinks are now correctly preserved.

2 years agorepart: Make sure we keep trailing slashes in ExcludeFiles= 28869/head
Daan De Meyer [Thu, 17 Aug 2023 11:00:27 +0000 (13:00 +0200)] 
repart: Make sure we keep trailing slashes in ExcludeFiles=

We conditionalize behavior based on whether these paths have trailing
slashes or not, so let's make sure we keep them intact.

2 years agoparse-helpers: Add PATH_KEEP_TRAILING_SLASH
Daan De Meyer [Thu, 17 Aug 2023 11:11:11 +0000 (13:11 +0200)] 
parse-helpers: Add PATH_KEEP_TRAILING_SLASH

2 years agopath-util: Add path_simplify_full()
Daan De Meyer [Thu, 17 Aug 2023 11:09:19 +0000 (13:09 +0200)] 
path-util: Add path_simplify_full()

Sometimes its useful to keep a trailing slash in the path so let's
add path_simplify_full() and a flag to do just that.

2 years agobus-polkit: don't propagate error from polkit
David Tardon [Thu, 17 Aug 2023 05:49:35 +0000 (07:49 +0200)] 
bus-polkit: don't propagate error from polkit

An error reply from polkit is a valid case and should not be propagated
as failure of async_polkit_callback(). It should only be saved here.
It'll be returned by bus_verify_polkit_async() later, when it's called
for the same method again.

Follow-up for #26365.

2 years agosystemd-stub: ignore EFI shell unauthenticated kernel command line if we are in confi...
Emanuele Giuseppe Esposito [Thu, 10 Aug 2023 13:21:41 +0000 (09:21 -0400)] 
systemd-stub: ignore EFI shell unauthenticated kernel command line if we are in confidential vms

2 years agoopen-file: add missing assert 28832/head
David Tardon [Mon, 14 Aug 2023 15:01:41 +0000 (17:01 +0200)] 
open-file: add missing assert

2 years agosystemctl-show: rename cleanup function
David Tardon [Mon, 14 Aug 2023 14:09:16 +0000 (16:09 +0200)] 
systemctl-show: rename cleanup function

2 years agotree-wide: use LIST_POP()
David Tardon [Mon, 14 Aug 2023 14:32:55 +0000 (16:32 +0200)] 
tree-wide: use LIST_POP()

2 years agotree-wide: use LIST_CLEAR()
David Tardon [Mon, 14 Aug 2023 14:07:46 +0000 (16:07 +0200)] 
tree-wide: use LIST_CLEAR()

2 years agolist: add LIST_CLEAR() helper that empties the list
David Tardon [Wed, 9 Aug 2023 14:35:08 +0000 (16:35 +0200)] 
list: add LIST_CLEAR() helper that empties the list

2 years agocore/mount: disable timer event source when USEC_INFINITY 28751/head
Yu Watanabe [Thu, 10 Aug 2023 01:23:59 +0000 (10:23 +0900)] 
core/mount: disable timer event source when USEC_INFINITY

Setting USEC_INFINITY to timer event source should not cause any
problem. But, disabling timer event source should be preferable.

[zjs: simplify the call to sd_event_source_set_enabled()]

2 years agoMerge pull request #28862 from DaanDeMeyer/swap 28892/head
Luca Boccassi [Wed, 16 Aug 2023 21:24:18 +0000 (22:24 +0100)] 
Merge pull request #28862 from DaanDeMeyer/swap

mkosi: Add a swap partition

2 years agomkosi: Add a swap partition 28862/head
Daan De Meyer [Wed, 16 Aug 2023 14:17:44 +0000 (16:17 +0200)] 
mkosi: Add a swap partition

systemd-oomd keeps complaining about the lack of swap partition, so
let's add one.

2 years agorepart: Default to swap format for swap partitions
Daan De Meyer [Wed, 16 Aug 2023 14:53:02 +0000 (16:53 +0200)] 
repart: Default to swap format for swap partitions

2 years agodocumentation: add man page data for confext
Maanya Goenka [Wed, 16 Aug 2023 16:57:31 +0000 (16:57 +0000)] 
documentation: add man page data for confext

2 years agoMerge pull request #28758 from keszybz/negative-errno-macro
Luca Boccassi [Wed, 16 Aug 2023 16:18:45 +0000 (17:18 +0100)] 
Merge pull request #28758 from keszybz/negative-errno-macro

Use macros to reduce indentation in errno error handling

2 years agojournalctl: minor follow-up for --lines=
Mike Yuan [Wed, 16 Aug 2023 12:35:15 +0000 (20:35 +0800)] 
journalctl: minor follow-up for --lines=

Follow-up for 8d6791d2aa98c989101f572278e9b0a63edfec42

Addresses https://github.com/systemd/systemd/pull/28777#discussion_r1295790102

2 years agocore: stage /run/host/os-release with a symlink to avoid possible race condition
Luca Boccassi [Sun, 13 Aug 2023 21:29:25 +0000 (22:29 +0100)] 
core: stage /run/host/os-release with a symlink to avoid possible race condition

If someone reads /run/host/os-release at the exact same time it is being updated, and it
is large enough, they might read a half-written file. This is very unlikely as
os-release is typically small and very rarely changes, but it is not
impossible.

Bind mount a staging directory instead of the file, and symlink the file
into into, so that we can do atomic file updates and close this gap.
Atomic replacement creates a new inode, so existing bind mounts would
continue to see the old file, and only new services would see the new file.
The indirection via the directory allows to work around this, as the
directory is fixed and never changes so the bind mount is always valid,
and its content is shared with all existing services.

Fixes https://github.com/systemd/systemd/issues/28794

Follow-up for 3f37a82545d461ab

2 years agoMerge pull request #28859 from poettering/btrfs-subvol-fix
Daan De Meyer [Wed, 16 Aug 2023 14:03:54 +0000 (16:03 +0200)] 
Merge pull request #28859 from poettering/btrfs-subvol-fix

btrfs: create subvol fix

2 years agobtrfs: use ERRNO_IS_NOT_SUPPORTED() where appropriate 28859/head
Lennart Poettering [Wed, 16 Aug 2023 10:12:07 +0000 (12:12 +0200)] 
btrfs: use ERRNO_IS_NOT_SUPPORTED() where appropriate

2 years agobtrfs: drop O_PATH from dir_fd passed to btrfs_subvol_make() if needed
Lennart Poettering [Wed, 16 Aug 2023 10:11:06 +0000 (12:11 +0200)] 
btrfs: drop O_PATH from dir_fd passed to btrfs_subvol_make() if needed

Let's make sure btrfs_subvol_make() can operate on O_PATH fds, just like
mkdirat().

Fixes a bunch of tmpfiles errors at boot if we try to create btrfs
subvols, introduced by e54c79ccc2e90a375640815b05f28ec22664e44c

Fixes: e54c79ccc2e90a375640815b05f28ec22664e44c
2 years agojournalctl: support --lines=+N for showing the oldest N entries
Mike Yuan [Thu, 10 Aug 2023 17:41:03 +0000 (01:41 +0800)] 
journalctl: support --lines=+N for showing the oldest N entries

After f58269510727964cb5c10e7d2f9849c442ea1f80, the wrong behavior
occurred when --since= and --lines= are both specified is fixed.
However, it seems that the old behavior is already being somewhat
widely used, and the function itself makes sense, i.e. to allow --lines=
to output the first N journal entries.

Therefore, let's support prefixing the number for --lines= with '+',
and provide such functionality.

Related: #28746

2 years agoMerge pull request #28854 from keszybz/mailmap-and-license-info
Luca Boccassi [Wed, 16 Aug 2023 11:34:22 +0000 (12:34 +0100)] 
Merge pull request #28854 from keszybz/mailmap-and-license-info

Mailmap and license info

2 years agohwdb: update autosuspend rules
Luca Boccassi [Wed, 16 Aug 2023 01:08:08 +0000 (02:08 +0100)] 
hwdb: update autosuspend rules

ninja -C build update-hwdb-autosuspend

2 years agomanager: fix error handling after failure to set up child 28758/head
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:59:55 +0000 (10:59 +0200)] 
manager: fix error handling after failure to set up child

exec_child() is supposed to set *exit_status when returning failure.
Unfortunately, we didn't do that in two cases. The result would be:
- a bogus error message "Failed at step SUCCESS spawning foo: …",
- a bogus success exit status.

Bugs introduced in 390902012c5177b6b01bc634b2e9c704073d9e7d and
ad21e542b20f0fb292d1958d3a759bf3403522c2.

The code is reworked to add some asserts and not set exit_status in the caller
so that it's clearer (also to the compiler) that it needs to be set.

2 years agoshared/barrier: remove parens
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:19:57 +0000 (10:19 +0200)] 
shared/barrier: remove parens

2 years agonspawn,shared: make ERRNO_IS_SECCOMP_FATAL an inline func with _NEG_ variant
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:18:12 +0000 (10:18 +0200)] 
nspawn,shared: make ERRNO_IS_SECCOMP_FATAL an inline func with _NEG_ variant

Also rebreak comments and lines.

No functional change.

2 years agoshared/kbd-util: simplify error handling in keymap_exists()
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 08:02:34 +0000 (10:02 +0200)] 
shared/kbd-util: simplify error handling in keymap_exists()

Once we know the return value, we can just return it, no need to
exit the loop.

2 years agovarious: use _NEG_ macros to reduce indentation
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 15:03:15 +0000 (17:03 +0200)] 
various: use _NEG_ macros to reduce indentation

No functional change intended.

2 years agolibsystemd-network: use _NEG_ macros to reduce indentation
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 07:58:50 +0000 (09:58 +0200)] 
libsystemd-network: use _NEG_ macros to reduce indentation

No functional change intended.

2 years agolibsystemd: use _NEG_ macros, adjust some comments
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 07:58:28 +0000 (09:58 +0200)] 
libsystemd: use _NEG_ macros, adjust some comments

No functional change.

2 years agomanager: use _NEG_ macros to reduce indentation, reword comments, drop parens
Zbigniew Jędrzejewski-Szmek [Thu, 10 Aug 2023 07:16:15 +0000 (09:16 +0200)] 
manager: use _NEG_ macros to reduce indentation, reword comments, drop parens

2 years agoerrno-util: allow ERRNO_IS_* to accept types wider than int
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 16:21:13 +0000 (18:21 +0200)] 
errno-util: allow ERRNO_IS_* to accept types wider than int

This is useful if the variable is ssize_t and we don't want to trigger a
warning or truncation.

With gcc (gcc-13.2.1-1.fc38.x86_64), the resulting systemd binary is identical,
so I assume that the compiler is able to completely optimize away the type.

2 years agosd-id128: introduce ERRNO_IS_NEG_MACHINE_ID_UNSET
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 15:51:24 +0000 (17:51 +0200)] 
sd-id128: introduce ERRNO_IS_NEG_MACHINE_ID_UNSET

2 years agoshared/cgroup-show: do not format path twice
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 14:43:28 +0000 (16:43 +0200)] 
shared/cgroup-show: do not format path twice

Also, invert the "negative" condition to positive so that it matches the assert
right above. Also, print the path in the debug message.

2 years agotree-wide: use cocinnelle to apply _NEG_ macros
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 14:41:58 +0000 (16:41 +0200)] 
tree-wide: use cocinnelle to apply _NEG_ macros

2 years agobasic/errno-util: add wrappers which only accept negative errno
Zbigniew Jędrzejewski-Szmek [Wed, 9 Aug 2023 14:36:38 +0000 (16:36 +0200)] 
basic/errno-util: add wrappers which only accept negative errno

We do 'IN_SET(r, -CONST1, -CONST2)', instead of 'IN_SET(-r, CONST1, CONST2)'
because -r is undefined if r is the minimum value (i.e. INT_MIN). But we know
that the constants are small, so their negative values are fine.