]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
22 months agosd-netlink: merge sd_nfnl_nft_message_{new,del}_setelems_begin()
Yu Watanabe [Wed, 15 Jun 2022 04:04:46 +0000 (13:04 +0900)] 
sd-netlink: merge sd_nfnl_nft_message_{new,del}_setelems_begin()

And this makes the new merged function `sd_nfnl_nft_message_new_setelems()`
not open container, as containers should be opened and closed in the
same function in general. Otherwise, it is hard to understand which
level we are in the nested attribute tree.

22 months agosd-netlink: drop unused sd_nfnl_nft_message_del_table()
Yu Watanabe [Wed, 15 Jun 2022 03:57:41 +0000 (12:57 +0900)] 
sd-netlink: drop unused sd_nfnl_nft_message_del_table()

22 months agosd-netlink: introduce sd_netlink_message_append_container_data()
Yu Watanabe [Wed, 15 Jun 2022 04:55:20 +0000 (13:55 +0900)] 
sd-netlink: introduce sd_netlink_message_append_container_data()

22 months agosd-netlink: several cleanups for netfilter
Yu Watanabe [Tue, 14 Jun 2022 13:22:54 +0000 (22:22 +0900)] 
sd-netlink: several cleanups for netfilter

- rename family -> nfproto, and other arguments,
- check specified nfproto,
- change type of several function arguments that specify data length,
- add several assertions,
- drop unnecessary headers.

22 months agofirewall-util: drop unnecessary string attribute
Yu Watanabe [Wed, 15 Jun 2022 03:53:32 +0000 (12:53 +0900)] 
firewall-util: drop unnecessary string attribute

As `sd_netlink_message_open_container_union()` also appends the string
attribute.

22 months agofirewall-util-nft: various cleanups
Yu Watanabe [Tue, 14 Jun 2022 08:50:59 +0000 (17:50 +0900)] 
firewall-util-nft: various cleanups

- add missing assertions,
- align enum elements,
- use cleanup attribute, and so on.

22 months agotree-wide: drop unnecessary inclusion of netlink-util.h
Yu Watanabe [Tue, 14 Jun 2022 07:36:45 +0000 (16:36 +0900)] 
tree-wide: drop unnecessary inclusion of netlink-util.h

22 months agosd-netlink: move rtnl_message_type_is_*() to netlink-message-rtnl.c
Yu Watanabe [Tue, 14 Jun 2022 07:36:17 +0000 (16:36 +0900)] 
sd-netlink: move rtnl_message_type_is_*() to netlink-message-rtnl.c

22 months agoman: Fix typo
codefiles [Sat, 23 Jul 2022 00:33:07 +0000 (20:33 -0400)] 
man: Fix typo

22 months agoMerge pull request #24074 from yuwata/network-dhcp6-rapid-commit
Yu Watanabe [Fri, 22 Jul 2022 23:10:01 +0000 (08:10 +0900)] 
Merge pull request #24074 from yuwata/network-dhcp6-rapid-commit

network: dhcp6: re-introduce RapidCommit= setting

22 months agomanager: limit access to private dbus socket
Zbigniew Jędrzejewski-Szmek [Fri, 22 Jul 2022 09:45:12 +0000 (11:45 +0200)] 
manager: limit access to private dbus socket

For the system manager, /run/systemd/private is publicly accessible, because
/run/systemd is 0755, and /run/systemd/private is 0777. For the user manager,
/run/user/<uid> is 0700, and /run/user/<uid>/systemd/private is 0777. This
does not directly cause any security issue because we check the sender in
bus_check_peercred (ucred.uid != 0 && ucred.uid != geteuid()).

But it makes sense to limit access to the socket to avoid wasting time in PID1.
Somebody could send messages there that'd we'd reject anyway. It also makes
things more explicit.

22 months agotests: add a simple test that checks what fexecve_or_execve does
Zbigniew Jędrzejewski-Szmek [Fri, 22 Jul 2022 09:04:01 +0000 (11:04 +0200)] 
tests: add a simple test that checks what fexecve_or_execve does

This can be easily used to show that the issue described in
ceedbf8185fc7593366679f02d31da63af8c4bd1 is still reproduced:

$ strace -e execveat build/test-execve /bin/grep Name /proc/self/status
execveat(3, "", ["/bin/grep", "Name", "/proc/self/status"], NULL, AT_EMPTY_PATH) = 0
Name: 3

22 months agoudev: enable BLKID_SUBLKS_FSINFO tags
Andrey Albershteyn [Fri, 8 Jul 2022 20:19:48 +0000 (22:19 +0200)] 
udev: enable BLKID_SUBLKS_FSINFO tags

libblkid gained new tags - FSSIZE, FSLASTBLOCK and FSBLOCKSIZE.
These tags are filesystem related properties probed from superblock.
All of them are enabled by BLKID_SUBLKS_FSINFO flag.

Set the flag to allow these tags to be cached in udev db.

22 months agotest: wait for user service or slice to be finished
Yu Watanabe [Fri, 22 Jul 2022 06:45:24 +0000 (15:45 +0900)] 
test: wait for user service or slice to be finished

Hopefully fixes #24040.

22 months agoMerge pull request #24084 from pothos/mask-sysext-docs
Luca Boccassi [Fri, 22 Jul 2022 19:02:07 +0000 (20:02 +0100)] 
Merge pull request #24084 from pothos/mask-sysext-docs

man: Sysext docs improvements

22 months agoman: Use correct target type for sysupdate entry
Kai Lueke [Fri, 22 Jul 2022 12:57:55 +0000 (14:57 +0200)] 
man: Use correct target type for sysupdate entry

While Type=file works because it seems to be the default, the line gets
ignored as printed on the stderr output.
Use the correct value "regular-file" for the target type.

22 months agoTODO/NEWS: write down that we intend to remove cgroupsv1 support by EOY 2023
Lennart Poettering [Fri, 22 Jul 2022 15:18:46 +0000 (17:18 +0200)] 
TODO/NEWS: write down that we intend to remove cgroupsv1 support by EOY 2023

After discussions here:

https://lists.freedesktop.org/archives/systemd-devel/2022-July/thread.html

EOY 2023 is apparently what people can agree with, hence let formalize
this in the TODO list, so we don't forget.

22 months agoman: Document mask workaround for sysext images 24084/head
Kai Lueke [Fri, 22 Jul 2022 13:09:21 +0000 (15:09 +0200)] 
man: Document mask workaround for sysext images

A read-only /usr may ship a sysext image by default and the user wants
to opt out. Currently it's not clear how to do this.
Document that a /dev/null symlink in /etc/extensions/ works to "mask" a
sysext image in a folder with lower precedence.

22 months agoman: Do not recommend to overlay files with sysext even if possible
Kai Lueke [Fri, 22 Jul 2022 13:03:12 +0000 (15:03 +0200)] 
man: Do not recommend to overlay files with sysext even if possible

While overlaying files with a sysext can be useful, it may lead to
unexpected problems depending on when a process got started and which
version of the file it gets.
Call out that overlaying files is possible but don't recommend to make
use of it.

22 months agotest-network: add tests for RapidCommit= 24074/head
Yu Watanabe [Fri, 22 Jul 2022 04:23:41 +0000 (13:23 +0900)] 
test-network: add tests for RapidCommit=

22 months agonetwork: dhcp6: re-introduce RapidCommit= setting
Yu Watanabe [Fri, 22 Jul 2022 04:11:20 +0000 (13:11 +0900)] 
network: dhcp6: re-introduce RapidCommit= setting

Previous implementation of disabling rapid commit was broken, and
dropped by 308d01f3c4decf3240ca0c6c7f91049953df7299.

Let's re-introduce the option in the correct way, as some servers seem
to return borked message when the solicit message contain the rapid
commit option.

Closes #24065.

22 months agosd-dhcp6-client: introduce sd_dhcp6_client_set_rapid_commit()
Yu Watanabe [Fri, 22 Jul 2022 04:05:15 +0000 (13:05 +0900)] 
sd-dhcp6-client: introduce sd_dhcp6_client_set_rapid_commit()

22 months agoman: document udevadm lock's exit code
Ulrich Ölmann [Thu, 21 Jul 2022 12:04:49 +0000 (14:04 +0200)] 
man: document udevadm lock's exit code

22 months agoMerge pull request #24073 from yuwata/test-network
Frantisek Sumsal [Fri, 22 Jul 2022 07:31:14 +0000 (07:31 +0000)] 
Merge pull request #24073 from yuwata/test-network

test-network: do not stop/restart udevd and relevant sockets

22 months agotest-network: drop unnecessary call of systemctl 24073/head
Yu Watanabe [Fri, 22 Jul 2022 01:35:58 +0000 (10:35 +0900)] 
test-network: drop unnecessary call of systemctl

As the units are not started at that stage.

22 months agotest-network: drop unnecessary default argument
Yu Watanabe [Fri, 22 Jul 2022 01:34:33 +0000 (10:34 +0900)] 
test-network: drop unnecessary default argument

22 months agotest-network: do not stop/restart udevd and related socket units
Yu Watanabe [Fri, 22 Jul 2022 01:24:09 +0000 (10:24 +0900)] 
test-network: do not stop/restart udevd and related socket units

That's not necessary. Moreover, if the socket units are stopped in
`setUpModule()`, then there exists a short timespan that we cannot call
`udevadm control`, as the control socket may not be opened yet.

If we run whole tests, then the first test is
NetworkctlTests.test_altname, and it calls `udevadm control` in `setUp()`.
Hence, the test may fail.

Fixes https://github.com/systemd/systemd-centos-ci/pull/512#issuecomment-1191591008.

22 months agoMerge pull request #24014 from poettering/tmpfiles-extra-creds
Luca Boccassi [Thu, 21 Jul 2022 10:55:43 +0000 (11:55 +0100)] 
Merge pull request #24014 from poettering/tmpfiles-extra-creds

tmpfiles: accept additional tmpfiles lines via credential

22 months agoMerge pull request #23986 from poettering/cache-selinux-unit-labels
Lennart Poettering [Thu, 21 Jul 2022 08:24:51 +0000 (10:24 +0200)] 
Merge pull request #23986 from poettering/cache-selinux-unit-labels

selinux: make selinux access checks based on unit file contexts read at unit load time

22 months agocoredumpctl: Use BusLocator functions
Alexander Wilson [Wed, 20 Jul 2022 18:02:56 +0000 (11:02 -0700)] 
coredumpctl: Use BusLocator functions

22 months agoMerge pull request #24051 from yuwata/json-fpclassify
Zbigniew Jędrzejewski-Szmek [Thu, 21 Jul 2022 07:35:19 +0000 (09:35 +0200)] 
Merge pull request #24051 from yuwata/json-fpclassify

json: use fpclassify() macro and refuse -ffinite-math-only

22 months agotree-wide: Introduce free_and_replace_full()
Daan De Meyer [Wed, 20 Jul 2022 15:11:34 +0000 (17:11 +0200)] 
tree-wide: Introduce free_and_replace_full()

Let's have all our free_and_replace() functions use a single
implementation.

22 months agomeson: refuse -ffinite-math-only 24051/head
Yu Watanabe [Sun, 17 Jul 2022 20:02:48 +0000 (05:02 +0900)] 
meson: refuse -ffinite-math-only

Closes #23610.

22 months agojson: use fpclassify() or its helper functions
Yu Watanabe [Mon, 18 Jul 2022 19:30:59 +0000 (04:30 +0900)] 
json: use fpclassify() or its helper functions

22 months agomath-util: introduce iszero_safe() and fp_equal()
Yu Watanabe [Mon, 18 Jul 2022 19:28:57 +0000 (04:28 +0900)] 
math-util: introduce iszero_safe() and fp_equal()

22 months agotest: use fabs() as the argument is double
Yu Watanabe [Sun, 17 Jul 2022 19:37:53 +0000 (04:37 +0900)] 
test: use fabs() as the argument is double

This also drop unnecessary cast.

22 months agoMerge pull request #23963 from matoro/main
Lennart Poettering [Wed, 20 Jul 2022 22:10:01 +0000 (00:10 +0200)] 
Merge pull request #23963 from matoro/main

Replace __sync intrinsics with __atomic

22 months agotmpfiles: automatically provision /etc/issue.d/ + /etc/motd.d/ + /etc/hosts from... 24014/head
Lennart Poettering [Fri, 15 Jul 2022 14:33:20 +0000 (16:33 +0200)] 
tmpfiles: automatically provision /etc/issue.d/ + /etc/motd.d/ + /etc/hosts from credentials

22 months agoman: split out "Type Modifiers" section from "Types" section in tmpfiles.d docs
Lennart Poettering [Fri, 15 Jul 2022 14:23:56 +0000 (16:23 +0200)] 
man: split out "Type Modifiers" section from "Types" section in tmpfiles.d docs

I had trouble finding the right paragraphs, so I guess others might have
too. Hence let's add a tiny bit more structure by separating these two
parts out.

22 months agotmpfiles: add ^ line modifier for loading file contents from specific credential
Lennart Poettering [Wed, 13 Jul 2022 12:55:45 +0000 (14:55 +0200)] 
tmpfiles: add ^ line modifier for loading file contents from specific credential

22 months agotmpfiles: accept additional tmpfiles lines via credential
Lennart Poettering [Wed, 13 Jul 2022 09:32:39 +0000 (11:32 +0200)] 
tmpfiles: accept additional tmpfiles lines via credential

22 months agoselinux: include precise low-level error string in returned D-Bus errors 23986/head
Lennart Poettering [Tue, 12 Jul 2022 14:23:02 +0000 (16:23 +0200)] 
selinux: include precise low-level error string in returned D-Bus errors

22 months agocore: cache unit file selinux label, and make decisions based on that
Lennart Poettering [Tue, 12 Jul 2022 14:13:40 +0000 (16:13 +0200)] 
core: cache unit file selinux label, and make decisions based on that

Do not go back to disk on each selinux access, but instead cache the
label off the inode we are actually reading. That way unit file contents
and unit file label we use for access checks are always in sync.

Based on discussions here:

https://github.com/systemd/systemd/pull/10023#issuecomment-1179835586

Replaces:

https://github.com/systemd/systemd/pull/23910

This changes behaviour a bit, because we'll reach and cache the label at
the moment of loading the unit (i.e. usually on boot and reload), but
not after relabelling. Thus, users must refresh the cache explicitly via
a "systemctl daemon-reload" if they relabelled things.

This makes the SELinux story a bit more debuggable, as it adds an
AccessSELinuxContext bus property to units that will report the label we are
using for a unit (or the empty string if not known).

This also drops using the "source" path of a unit as label source. if
there's value in it, then generators should manually copy the selinux
label from the source files onto the generated unit files, so that the
rule that "access labels are read when we read the definition files" is
upheld. But I am not convinced this is really a necessary, good idea.

22 months agoMerge pull request #23640 from cerebro1/week1
Luca Boccassi [Wed, 20 Jul 2022 17:07:22 +0000 (18:07 +0100)] 
Merge pull request #23640 from cerebro1/week1

Estimate battery level

22 months agosleep: store battery discharge rate/hour with hash 23640/head
Sonali Srivastava [Wed, 20 Jul 2022 09:17:04 +0000 (14:47 +0530)] 
sleep: store battery discharge rate/hour with hash

Estimated battery discharge rate per hour is stored in :
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour

This value is used to determine the initial suspend interval. In case
this file is not available or value is invalid, HibernateDelaySec
interval is used.
After wakeup from initial suspend, this value is again estimated and
written to file if value is in range of 1-199.

Logs for reference : HibernateDelaySec=15min
- Updated in /etc/systemd/sleep.conf

Jul 14 19:17:58 localhost systemd-sleep[567]: Current battery charge
percentage: 100%
Jul 14 19:17:58 localhost systemd-sleep[567]: Failed to read discharge
rate from /var/lib/systemd/sleep/batt
ery_discharge_percentage_rate_per_hour: No such file or directory
Jul 14 19:17:58 localhost systemd-sleep[567]: Set timerfd wake alarm
for 15min
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: Attempting to estimate
battery discharge rate after wakeup from 15min sleep
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Estimated discharge rate
39 successfully updated to
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Set timerfd wake alarm
for 1h 48min 27s
Jul 14 21:21:30 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 21:21:30 localhost systemd-sleep[567]: Battery was not
discharged during suspension

22 months agosleep: use current charge level to decide suspension
Sonali Srivastava [Fri, 15 Jul 2022 02:26:30 +0000 (07:56 +0530)] 
sleep: use current charge level to decide suspension

If battery current charge percentage is below 5% hibernate directly.
Else initial suspend interval is set for HibernateDelaySec. On wakeup
estimate battery discharge rate per hour and if battery charge
percentage is not below 5% system is suspended else hibernated.

22 months agotree-wide: fix typo
Yu Watanabe [Wed, 20 Jul 2022 04:15:37 +0000 (13:15 +0900)] 
tree-wide: fix typo

22 months agoupdate TODO
Lennart Poettering [Tue, 19 Jul 2022 20:33:08 +0000 (22:33 +0200)] 
update TODO

22 months agomkosi: Silence gdb debuginfo messages/prompts
Daan De Meyer [Tue, 19 Jul 2022 11:45:24 +0000 (13:45 +0200)] 
mkosi: Silence gdb debuginfo messages/prompts

Let's silence gdb asking about debuginfod and complaining about
missing debuginfo to reduce friction when using mkosi to work
on systemd.

22 months agoman: Miscellaneous fixes
Jan Janssen [Tue, 19 Jul 2022 08:57:33 +0000 (10:57 +0200)] 
man: Miscellaneous fixes

Fixes: #24056
22 months agopo: Translated using Weblate (Korean)
김인수 [Mon, 18 Jul 2022 15:19:05 +0000 (17:19 +0200)] 
po: Translated using Weblate (Korean)

Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main

22 months agoMerge pull request #24025 from DaanDeMeyer/mkosi-sanitizers
Evgeny Vereshchagin [Mon, 18 Jul 2022 16:24:51 +0000 (19:24 +0300)] 
Merge pull request #24025 from DaanDeMeyer/mkosi-sanitizers

mkosi: Changes to allow booting with sanitizers in mkosi

22 months agomkosi: Remove usage of deprecated option names/sections 24025/head
Daan De Meyer [Mon, 18 Jul 2022 10:43:37 +0000 (12:43 +0200)] 
mkosi: Remove usage of deprecated option names/sections

22 months agomkosi: Changes to allow booting with sanitizers in mkosi
Daan De Meyer [Fri, 15 Jul 2022 00:26:52 +0000 (02:26 +0200)] 
mkosi: Changes to allow booting with sanitizers in mkosi

- Extra memory because ASAN needs it
- The environment variables to make the sanitizers more useful
- LD_PRELOAD because the ASAN DSO needs to be the first in the list
- The sanitizer library packages
- Disable syscall filters because they interfere with ASAN
- Disable systemd-hwdb-update because it's super slow when systemd-hwdb
  is built with sanitizers
- Take the value for meson's b_sanitize option from the SANITIZERS
  environment variable

22 months agoman/system-or-user-ns.xml: explicitly refer to `PrivateUsers=` option
Ansgar Burchardt [Mon, 18 Jul 2022 12:13:40 +0000 (14:13 +0200)] 
man/system-or-user-ns.xml: explicitly refer to `PrivateUsers=` option

It is not clear what "unprivileged user namespaces are available" means.
It could mean either that they are only usable, that is, enabled in the kernel,
or they have been enabled for the specific service. Referring to the
`PrivateUsers=` options makes it clear that the latter is meant.

22 months agoMerge pull request #24001 from yuwata/network-lifetime-fix
Luca Boccassi [Mon, 18 Jul 2022 09:02:02 +0000 (10:02 +0100)] 
Merge pull request #24001 from yuwata/network-lifetime-fix

network: fixes for lifetime handling

22 months agomkosi: Update Ubuntu config to 22.04
Daan De Meyer [Sun, 17 Jul 2022 21:52:23 +0000 (23:52 +0200)] 
mkosi: Update Ubuntu config to 22.04

22 months agomkosi: Fix build script indentation
Daan De Meyer [Sat, 16 Jul 2022 08:15:29 +0000 (10:15 +0200)] 
mkosi: Fix build script indentation

22 months agomkosi: Enable meson developer mode
Daan De Meyer [Fri, 15 Jul 2022 12:59:03 +0000 (14:59 +0200)] 
mkosi: Enable meson developer mode

22 months agomkosi: Don't try to install systemd-boot in non-efi images
Daan De Meyer [Fri, 15 Jul 2022 00:33:07 +0000 (02:33 +0200)] 
mkosi: Don't try to install systemd-boot in non-efi images

When using mkosi's direct linux boot support, there's no EFI
system partition so don't try to install systemd-boot in that case.

22 months agomkosi: Install xxd in images
Daan De Meyer [Fri, 15 Jul 2022 00:30:01 +0000 (02:30 +0200)] 
mkosi: Install xxd in images

Came in handy while working on
https://github.com/systemd/systemd/pull/24024 so let's install it
in the image by default.

22 months agoMerge pull request #24047 from dtardon/list-users-linger
Yu Watanabe [Mon, 18 Jul 2022 06:05:25 +0000 (15:05 +0900)] 
Merge pull request #24047 from dtardon/list-users-linger

Add linger status to `loginctl list-users`

22 months agoUpdate sleep.conf HibernateDelaySec default to match implementation
Richard Huang [Mon, 18 Jul 2022 03:28:33 +0000 (20:28 -0700)] 
Update sleep.conf HibernateDelaySec default to match implementation

22 months agohwdb: Add Acer Aspire A317-33 (#24050)
Mitchell Freiderich [Mon, 18 Jul 2022 06:03:44 +0000 (01:03 -0500)] 
hwdb: Add Acer Aspire A317-33 (#24050)

Enables the power button on the Acer Aspire 3 A317-33

22 months agosystemctl: include upheld units in dependencies
David Tardon [Sat, 16 Jul 2022 11:23:46 +0000 (13:23 +0200)] 
systemctl: include upheld units in dependencies

Fixes: #22706
22 months agotest: merge grep | awk calls 24047/head
David Tardon [Sun, 17 Jul 2022 13:41:38 +0000 (15:41 +0200)] 
test: merge grep | awk calls

22 months agotest: add a simple test for list-users
David Tardon [Sun, 17 Jul 2022 13:35:22 +0000 (15:35 +0200)] 
test: add a simple test for list-users

22 months agologinctl: add linger status to list-users output
David Tardon [Sat, 16 Jul 2022 13:10:26 +0000 (15:10 +0200)] 
loginctl: add linger status to list-users output

Fixes: #3907
22 months agoman: fix grammatical error in --cursor-file description
Vito Caputo [Sat, 16 Jul 2022 01:53:43 +0000 (18:53 -0700)] 
man: fix grammatical error in --cursor-file description

Just a minor cleanup to fix unparseable wording

22 months agocore: drop a stray %m specifier from a warning message
Frantisek Sumsal [Fri, 15 Jul 2022 19:19:42 +0000 (21:19 +0200)] 
core: drop a stray %m specifier from a warning message

since in this specific case (r == 0) `errno` is irrelevant and most likely
set to zero, leading up to a confusing message:

```
[  120.595085] H systemd[1]: session-5.scope: No PIDs left to attach to the scope's control group, refusing: Success
[  120.595144] H systemd[1]: session-5.scope: Failed with result 'resources'.
```

22 months agoMerge pull request #24018 from keszybz/generator-cleanups
Yu Watanabe [Fri, 15 Jul 2022 20:11:49 +0000 (05:11 +0900)] 
Merge pull request #24018 from keszybz/generator-cleanups

Make generators easier to test, fix various corner issues

22 months agoMerge pull request #24035 from yuwata/sd-event-cleanup
Yu Watanabe [Fri, 15 Jul 2022 20:11:00 +0000 (05:11 +0900)] 
Merge pull request #24035 from yuwata/sd-event-cleanup

sd-event: tiny cleanups

22 months agocoredump: Try to write journald coredump metadata to the journal
Daan De Meyer [Wed, 13 Jul 2022 12:46:33 +0000 (14:46 +0200)] 
coredump: Try to write journald coredump metadata to the journal

Currently, if journald coredumps, the coredump is written to
/var/lib/systemd/coredump but the coredump metadata is not written
to  the journal meaning we can't find out about the coredump's
existence via the journal. This means that coredumpctl can't be
used to work with journald coredumps, as well as any other tools
that rely on journald to know about coredumps.

To solve the issue, let's have systemd-coredump try to write
systemd-journald coredump metadata to the journal. We have to be
careful though, since if journald coredumps, there's no active
reader on the receive end of the journal socket, so we have to make
sure we don't deadlock trying to write to the socket. To avoid the
deadlock, we put the socket in nonblocking mode before trying to
write to it.

22 months agosysusers: allow defining additional sysusers lines via credentials
Lennart Poettering [Wed, 13 Jul 2022 09:06:04 +0000 (11:06 +0200)] 
sysusers: allow defining additional sysusers lines via credentials

22 months agoman: fix typo in systemd.network documentation in IPv6RoutePrefix section (#24030)
lastkrick [Fri, 15 Jul 2022 15:45:56 +0000 (18:45 +0300)] 
man: fix typo in systemd.network documentation in IPv6RoutePrefix section (#24030)

22 months agosd-event: introduce PROTECT_EVENT() macro 24035/head
Yu Watanabe [Fri, 15 Jul 2022 15:42:39 +0000 (00:42 +0900)] 
sd-event: introduce PROTECT_EVENT() macro

22 months agosd-event: drop redundant code
Yu Watanabe [Fri, 15 Jul 2022 15:38:30 +0000 (00:38 +0900)] 
sd-event: drop redundant code

The function `source_io_unregister()` will be anyway called in
`source_disconnect()`.

22 months agofstab-generator: do not skip /sysroot prefix if the mount point is missing 24018/head
Zbigniew Jędrzejewski-Szmek [Thu, 14 Jul 2022 15:33:13 +0000 (17:33 +0200)] 
fstab-generator: do not skip /sysroot prefix if the mount point is missing

When chase_symlinks() is called on something on a doesn't exist, it immediately
returns an error. But we were relying on it to prepend "/sysroot/". If it
fails, we need to do that ourselves.

For example, with /sysroot/etc/fstab containing a line for /foo, if /sysroot/foo
doesn't exist, we'd generate a mount point for /foo.

22 months agofsck,sulogin: fix cargo-culted comment
Zbigniew Jędrzejewski-Szmek [Thu, 14 Jul 2022 14:46:24 +0000 (16:46 +0200)] 
fsck,sulogin: fix cargo-culted comment

22 months agofstab-generator: rename 'post' variable
Zbigniew Jędrzejewski-Szmek [Thu, 14 Jul 2022 14:16:25 +0000 (16:16 +0200)] 
fstab-generator: rename 'post' variable

Originally (6b1dc2bd3cdb3bd932b0692be636ddd2879edb92) we had 'pre' and 'post'
to refer to remote-fs-pre.target and remote-fs.target or local-fs-pre.target
and local-fs.target. But 'pre' is long gone, and 'post' by itself doesn't
make much sense. Rename it for clarity.

22 months agofstab-generator: tweak comments
Zbigniew Jędrzejewski-Szmek [Thu, 14 Jul 2022 12:35:37 +0000 (14:35 +0200)] 
fstab-generator: tweak comments

22 months agofstab-generator: allow overriding path to /sysroot/etc/fstab too
Zbigniew Jędrzejewski-Szmek [Thu, 14 Jul 2022 11:29:06 +0000 (13:29 +0200)] 
fstab-generator: allow overriding path to /sysroot/etc/fstab too

This adds $SYSTEMD_SYSROOT_FSTAB analoguous to $SYSTEMD_FSTAB.

22 months agofstab-generator: properly report the source of data
Zbigniew Jędrzejewski-Szmek [Thu, 14 Jul 2022 10:46:18 +0000 (12:46 +0200)] 
fstab-generator: properly report the source of data

Mount information can come from /etc/fstab, /sysroot/etc/fstab, and
/proc/cmdline. Even when we had the path to the right source handy, we would
often write something inaccurate. In particular, in the initrd, we would
generally write "/etc/fstab" instead of "/sysroot/etc/fstab" for no good
reason.

22 months agofstab-generator: use path_equal() to detect alternate spellings of /usr
Zbigniew Jędrzejewski-Szmek [Wed, 13 Jul 2022 16:58:15 +0000 (18:58 +0200)] 
fstab-generator: use path_equal() to detect alternate spellings of /usr

In the initrd we would treat e.g. "/usr/" as different from "/usr", which
doesn't seem right.

22 months agogenerators: only redirect logging when invoked by systemd
Zbigniew Jędrzejewski-Szmek [Wed, 13 Jul 2022 16:43:05 +0000 (18:43 +0200)] 
generators: only redirect logging when invoked by systemd

We would always print output to the kmsg or journal, but that is only needed
and useful when invoked by systemd. So let's skip redirection unless we are
invoked by systemd. Otherwise, let's log normally. This makes test invocations
easier, and also helps when the generator is invoked by mistake. If redirection
is necessary, the generator can be invoked with SYSTEMD_LOG_TARGET=… even
during tests.

22 months agobasic/log: split out invoked_by_systemd() utility function
Zbigniew Jędrzejewski-Szmek [Fri, 15 Jul 2022 09:38:01 +0000 (11:38 +0200)] 
basic/log: split out invoked_by_systemd() utility function

22 months agocore: drop ambient capabilities in user manager
Łukasz Stelmach [Tue, 12 Jul 2022 11:57:32 +0000 (13:57 +0200)] 
core: drop ambient capabilities in user manager

Ambient capabilities should not be passed implicitly to user
services. Dropping them does not affect the permitted and effective sets
which are important for the manager itself to operate.

22 months agoimport: fix format strings
Lennart Poettering [Fri, 15 Jul 2022 13:24:24 +0000 (15:24 +0200)] 
import: fix format strings

22 months agoMerge pull request #24011 from poettering/condition-cred
Lennart Poettering [Fri, 15 Jul 2022 13:03:49 +0000 (15:03 +0200)] 
Merge pull request #24011 from poettering/condition-cred

pid1: add new condition type "ConditionCredential=" for checking for credentials passed into the system

22 months agocgroups-agent: connect stdin/stdout/stderr to /dev/null
Lennart Poettering [Fri, 15 Jul 2022 09:02:40 +0000 (11:02 +0200)] 
cgroups-agent: connect stdin/stdout/stderr to /dev/null

Inspired by https://github.com/systemd/systemd/pull/24024 this is
another user mode helper, where this might be an issue. hence let's
rather be safe than sorry, and also connect stdin/stdout/stderr
explicitly with /dev/null.

22 months agoMerge pull request #24010 from poettering/tmpfiles-base64-data
Lennart Poettering [Fri, 15 Jul 2022 12:50:56 +0000 (14:50 +0200)] 
Merge pull request #24010 from poettering/tmpfiles-base64-data

tmpfiles: optionally allow configuring file contents for f/w lines to be encoded in base64

22 months agogenerators: accept one or three args, do not write to /tmp
Zbigniew Jędrzejewski-Szmek [Wed, 13 Jul 2022 16:19:04 +0000 (18:19 +0200)] 
generators: accept one or three args, do not write to /tmp

Since the general generator logic was established in the rewrite in
07719a21b6425d378b36bb8d7f47ad5ec5296d28, generators would always write to /tmp
by default. I think this not a good default at all, because generators write a
bunch of files and would create a mess in /tmp. And for debugging, one
generally needs to remove all the files in the output directory, because
generators will complain in the output paths are already present. Thus the
approach of disabling console logging and writing many files to /tmp when
invoked with no arguments is not nice, so let's disallow operation with no
args.

But when debugging, one generally does not care about the separate output dirs
(most generators use only one). Thus the general pattern I use is something
like:
  rm -rf /tmp/x && mkdir /tmp/x && build/some-generator /tmp/{x,x,x}
This commit allows only one directory to be specified and simplifies this to:
  rm -rf /tmp/x && mkdir /tmp/x && build/some-generator /tmp/x

22 months agobless-boot-generator: use DEFINE_MAIN_GENERATOR_FUNCTION()
Zbigniew Jędrzejewski-Szmek [Wed, 13 Jul 2022 16:35:42 +0000 (18:35 +0200)] 
bless-boot-generator: use DEFINE_MAIN_GENERATOR_FUNCTION()

DEFINE_MAIN_GENERATOR_FUNCTION() always sets dest*, so there should be no
change in behaviour.

22 months agohibernate-resume-generator: use DEFINE_MAIN_GENERATOR_FUNCTION()
Zbigniew Jędrzejewski-Szmek [Wed, 13 Jul 2022 16:29:36 +0000 (18:29 +0200)] 
hibernate-resume-generator: use DEFINE_MAIN_GENERATOR_FUNCTION()

DEFINE_MAIN_GENERATOR_FUNCTION() always sets dest*, so there should be no
change in behaviour.

22 months agotmpfiles: minor shortening of code 24010/head
Lennart Poettering [Tue, 12 Jul 2022 21:53:11 +0000 (23:53 +0200)] 
tmpfiles: minor shortening of code

22 months agotmpfiles: optionally, decode string to write to files with base64
Lennart Poettering [Tue, 12 Jul 2022 21:51:15 +0000 (23:51 +0200)] 
tmpfiles: optionally, decode string to write to files with base64

This is useful to use "f" or "w" to write arbitrary binary files to
disk, or files with newlines and similar (for example to provision SSH
host keys and similar).

22 months agoupdate TODO
Lennart Poettering [Fri, 15 Jul 2022 09:46:01 +0000 (11:46 +0200)] 
update TODO

22 months agocoredump: Connect stdout/stderr to /dev/null before doing anything
Daan De Meyer [Thu, 14 Jul 2022 23:49:25 +0000 (01:49 +0200)] 
coredump: Connect stdout/stderr to /dev/null before doing anything

When invoked as the coredump handler by the kernel, systemd-coredump's
stdout and stderr streams are closed. This is dangerous as this means
the fd's can get reallocated, leading to hard to debug errors such as
log messages ending up being appended to a compressed coredump file.

To avoid such issues in the future, let's bind stdout/stderr to
/dev/null so the file descriptors can't get used for anything else.

22 months agoman: fix copy/paste typo 24011/head
Lennart Poettering [Fri, 15 Jul 2022 08:53:23 +0000 (10:53 +0200)] 
man: fix copy/paste typo

22 months agofuzz: add ConditionCredential= to fuzz files, and sort their sections
Lennart Poettering [Thu, 14 Jul 2022 08:41:15 +0000 (10:41 +0200)] 
fuzz: add ConditionCredential= to fuzz files, and sort their sections