Commit Graph
65045 Commits
Author SHA1 Message Date
Yu Watanabe fcb2343175 update-utmp: reconnect after sleep when PID1 is reexecuting
Fixes #27167.
2023-05-24 20:06:10 +09:00
Yu Watanabe 87ae54533c update-utmp: update log message 2023-05-24 20:06:10 +09:00
Yu Watanabe 86da32ee0c update-utmp: downgrade log level of ignored failure 2023-05-24 20:06:10 +09:00
Yu Watanabe 4c40ab203c update-utmp: swap q <-> r
We usually use 'r' for general purpose.

No functional change, just refactoring.
2023-05-24 20:06:10 +09:00
Yu Watanabe 3950d8f693 update-utmp: modernize get_startup_monotonic_time()
This also downgrade error level, as the failure will be ignored.

No functional change, just refactoring.
2023-05-24 20:06:07 +09:00
Yu Watanabe 309491e4cf update-utmp: rebreak comments 2023-05-24 20:04:33 +09:00
Yu Watanabe 230f663e3e update-utmp: use verbs
No functional change, just refactoring.
2023-05-24 20:04:33 +09:00
Yu Watanabe 5f1f05b961 Merge pull request #27740 from dtardon/list-sessions-idle
Show idle status in `loginctl list-sessions`
2023-05-24 20:03:39 +09:00
Yu Watanabe 8ddc5f7699 Merge pull request #27757 from dtardon/bus-locator
Convert more DBus calls to BusLocator
2023-05-24 20:02:57 +09:00
Luca Boccassi c67d5a027d ukify: add default .sbat section for addons
In order to ensure addons can always be revoked via SBAT, and it is not
left out by mistake, have a default metadata entry if none is specified
by the caller.
https://github.com/rhboot/shim/blob/main/SBAT.md
2023-05-24 11:09:03 +01:00
Luca Boccassi f644ea3ed7 ukify: use empty stub for addons
Instead of picking up sd-stub, which is runnable, add an empty
addon stub that just returns an error if executed
2023-05-24 11:09:03 +01:00
Luca Boccassi e78fc81d30 elf2efi: ensure minimum gap between .text and other sections
When linking an almost empty binary the linker can merged .text with
a later section, creating a RWE segment, that then it rejects.
2023-05-24 11:06:36 +01:00
Luca Boccassi e18e3c4305 elf2efi: add parameter to increase reserved space for headers
When building a minimal empty addon it would not have enough
space to append sections. Add an option that will later be
used to reserve enough space.
2023-05-24 11:06:36 +01:00
Luca Boccassi b6f2e68602 stub/measure: document and measure .uname UKI section 2023-05-24 11:06:36 +01:00
Daan De Meyer e21f75afcd timer: Use dual_timestamp_is_set() in one more place 2023-05-24 11:41:37 +02:00
Luca Boccassi e1f1b5fc62 efi: set EFIVAR to stop Shim from uninstalling its protocol
We'll use it from the stub to validate files. Requires Shim 5.18.
By default, Shim uninstalls its protocol when calling StartImage(),
so when loading systemd-boot via shim and then loading an UKI, the
UKI's sd-stub will no longer be able to use the shim verification
protocol by default.
2023-05-24 10:26:41 +01:00
Luca Boccassi fe830b84d4 Merge pull request #27761 from yuwata/network-vlan-qos-mapping
network: fix vlan qos mapping
2023-05-24 09:59:41 +01:00
Lennart Poettering 00078fb309 execute: add missing NULL handling 2023-05-24 10:57:16 +02:00
Lennart Poettering 1483892a42 mount: check right before invoking /bin/umount if it makes sense
Notifications from /proc/self/mountinfo are async, so if we stop a
service (and while doing so get rid of the credentials mount point of
it), then it will take a while until the notification reaches us and we
actually scan the table again. In particular as we nowadays ratelimit
notifications on the table, since it's so inefficient. And as I learnt
the ratelimiting is actually quite regularly hit during shutdown, where
a flurry of umount events are genreated. Hence, let's check if a mount
point is actually a mountpoint before trying to unmount it. And if it
isn't let's wait for the notification to come in.

(This race might be triggred not just by us on ourselves btw: there are
other daemons that unmount stuff when stopping where the race also
exists, but might simply be harder to trigger: if during service
shutdown these services remove some mount then they might collide with
us doing the same. After all, we have the rule to unmount everything
mounted automatically for you during shutdown.)

In the long run we should also start making us of this when it becomes
available: https://github.com/util-linux/util-linux/issues/2132 With
that we can make issues like this go away entirely from our side of
things at least.

Fixes: #25527
2023-05-24 10:57:16 +02:00
Lennart Poettering 2fdc274c66 sd-event: add an explicit API for leaving the ratelimit state
Sometimes, it might make sense to end the ratelimit window early.
2023-05-24 10:52:08 +02:00
Lennart Poettering 75b0952982 core: split out default network dep generation into own function
Just some simple refactoring: let's split out network dep generation
into its own function mount_add_default_network_dependencies().

This way mount_add_default_dependencies() only does preparatory stuff,
and then calls both mount_add_default_network_dependencies() and
mount_add_default_ordering_dependencies() with that, making things
nicely symmetric.
2023-05-24 10:20:36 +02:00
Lennart Poettering 92e64e9ae9 core: suppress various defaults deps for credentials mounts
The per-unit credentials mounts might show up for any kind of service,
including very very early ones. Hence let's not order them after
local-fs-pre.target, because otherwise we might trigger cyclic deps of
services that want to plug before that but still use credentials.
2023-05-24 10:18:14 +02:00
Lennart Poettering ce18c39623 unit: add ordering dep relative to credentials dir
See: #25527
2023-05-24 10:17:31 +02:00
Daan De Meyer 6546045fa0 core/timer: Always use inactive_exit_timestamp if it is set
If we're doing a daemon-reload, we'll be going from TIMER_DEAD => TIMER_WAITING,
so we won't use inactive_exit_timestamp because TIMER_DEAD != UNIT_ACTIVE, even
though inactive_exit_timestamp is serialized/deserialized and will be valid after
the daemon-reload.

This issue can lead to timers never firing as we'll always calculate the next
elapse based on the current realtime on daemon-reload, so if daemon-reload happens
often enough, the elapse interval will be moved into the future every time, which
means the timer will never trigger.

To fix the issue, let's always use inactive_exit_timestamp if it is set, and only
fall back to the current realtime if it is not set.
2023-05-24 10:05:08 +02:00
David Tardon 556723e738 loginctl: show session idle status in list-sessions 2023-05-24 10:04:45 +02:00
Yu Watanabe 5c4e96c28c test: rotate journal before storing coredumps
Hopefully fixes the failure like
https://jenkins-systemd.apps.ocp.cloud.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/2558/
---
[   66.708894] testsuite-74.sh[728]: + coredumpctl --json=off
[   66.709344] testsuite-74.sh[826]: TIME                        PID UID GID SIG     COREFILE EXE             SIZE
[   66.709773] testsuite-74.sh[826]: Tue 2023-05-23 22:10:17 UTC 739   0   0 SIGTRAP journal  /tmp/test-dump     -
[   66.711134] testsuite-74.sh[826]: Tue 2023-05-23 22:10:18 UTC 747   0   0 SIGABRT journal  /tmp/test-dump     -
[   66.711789] testsuite-74.sh[826]: Tue 2023-05-23 22:10:19 UTC 763   0   0 SIGTRAP present  /tmp/test-dump 53.5K
[   66.712460] testsuite-74.sh[826]: Tue 2023-05-23 22:10:20 UTC 776   0   0 SIGABRT present  /tmp/test-dump 53.3K
[   66.713505] testsuite-74.sh[728]: + coredumpctl --root=/
[   66.714144] testsuite-74.sh[828]: TIME                        PID UID GID SIG     COREFILE EXE             SIZE
[   66.714535] testsuite-74.sh[828]: Tue 2023-05-23 22:10:17 UTC 739   0   0 SIGTRAP journal  /tmp/test-dump     -
[   66.715208] testsuite-74.sh[828]: Tue 2023-05-23 22:10:18 UTC 747   0   0 SIGABRT journal  /tmp/test-dump     -
[   66.715907] testsuite-74.sh[828]: Tue 2023-05-23 22:10:19 UTC 763   0   0 SIGTRAP present  /tmp/test-dump 53.5K
[   66.716565] testsuite-74.sh[828]: Tue 2023-05-23 22:10:20 UTC 776   0   0 SIGABRT present  /tmp/test-dump 53.3K
[   66.717494] testsuite-74.sh[728]: + coredumpctl --directory=/var/log/journal
[   66.718188] testsuite-74.sh[830]: TIME                        PID UID GID SIG     COREFILE EXE             SIZE
[   66.882072] testsuite-74.sh[830]: Tue 2023-05-23 22:10:17 UTC 739   0   0 SIGTRAP journal  /tmp/test-dump     -
[   66.882642] testsuite-74.sh[830]: Tue 2023-05-23 22:10:18 UTC 747   0   0 SIGABRT journal  /tmp/test-dump     -
[   66.883450] testsuite-74.sh[830]: Tue 2023-05-23 22:10:19 UTC 763   0   0 SIGTRAP present  /tmp/test-dump 53.5K
[   66.883944] testsuite-74.sh[830]: Tue 2023-05-23 22:10:20 UTC 776   0   0 SIGABRT present  /tmp/test-dump 53.3K
[   66.885448] testsuite-74.sh[728]: + coredumpctl --file=/var/log/journal/2e1ed84be19a4e22adfc99ad849be1f6/system.journal
[   66.885989] testsuite-74.sh[728]: + at_exit
[   66.894162] coredumpctl[833]: No coredumps found.
---
2023-05-24 09:22:13 +02:00
David Tardon 3ac26d0718 oomctl: convert a oom1.Manager call to BusLocator 2023-05-24 08:50:02 +02:00
David Tardon 86257d9fd8 bus-locator: sort the list 2023-05-24 08:50:02 +02:00
David Tardon 1925011748 bus-locator: declare bus locator for oom1 and timesync1 2023-05-24 08:50:02 +02:00
David Tardon d14bd34f25 hostnamectl: convert more hostname1 calls to BusLocator 2023-05-24 08:33:22 +02:00
David Tardon 7f8a85e6d8 tree-wide: convert more resolve1.Manager calls to BusLocator 2023-05-24 08:33:22 +02:00
David Tardon daecc5b95b journalctl: convert a machine1.Manager call to BusLocator 2023-05-24 08:33:22 +02:00
David Tardon a29f13f296 sleep: convert a home1.Manager call to BusLocator 2023-05-24 08:33:22 +02:00
David Tardon 6ce68c7c51 login: use NULL to denote arg-less method call
"" and NULL are equivalent, but the latter is normally used.
2023-05-24 08:32:13 +02:00
David Tardon d962e73796 tree-wide: convert more login1.Manager calls to BusLocator 2023-05-24 08:24:00 +02:00
David Tardon b71471684a tree-wide: convert more system1.Manager calls to BusLocator 2023-05-24 08:23:59 +02:00
Yu Watanabe 73d24e45f8 test-network: add tests for vlan QoS mapping 2023-05-24 11:15:44 +09:00
Yu Watanabe 4194478af8 network/vlan: paranoia about type safety
No functional change, as the struct is defined as the following:
```
struct ifla_vlan_qos_mapping {
      __u32 from;
      __u32 to;
};
```
2023-05-24 11:06:43 +09:00
Yu Watanabe 4d13d175f8 network/vlan: drop unnecessary restriction for QoS mapping
Fixes #27460.
2023-05-24 11:02:39 +09:00
Yu Watanabe 5dc0c21b31 core/slice: shorten code a bit 2023-05-24 10:26:21 +09:00
Yu Watanabe 93ec924c41 test: add test cases for defining mount and swap units from kernel cmdline 2023-05-24 08:23:22 +09:00
Yu Watanabe 55365b0a23 fstab-generator: support defining mount units through kernel command line
Now, the following kernel command line options are supported:
  systemd.mount-extra=what:where:fstype:options
  systemd.swap-extra=what:options

Closes #27260.
2023-05-24 08:23:22 +09:00
Yu Watanabe 2646f18445 fstab-generator: fix error code propagation in run_generator()
Previously, some errors might be ignored.
2023-05-24 08:23:22 +09:00
Yu Watanabe 6742eca134 fstab-generator: refuse invalid mount point path in fstab earlier 2023-05-24 08:23:22 +09:00
Yu Watanabe 9445623363 fstab-generator: refuse to add swap earlier if disabled
No functional change, preparation for later commits.
2023-05-24 08:23:22 +09:00
Yu Watanabe 256604ccdd fstab-generator: call add_swap() earlier
As 'where' field will be ignored for swap entry.
2023-05-24 08:23:22 +09:00
Yu Watanabe cfeb4d378e fstab-generator: split out several functions from parse_fstab()
No functional changes, just refactoring and preparation for later
commits.
2023-05-24 08:23:22 +09:00
Yu Watanabe 82c29dbee0 test-fstab-generator: add tests for mount options 2023-05-24 08:23:22 +09:00
Yu Watanabe 70bf9f62b9 test-fstab-generator: also check file contents
Since e683878c0f, only filenames are
checked. Let's check contents of generated unit files.
2023-05-24 08:23:22 +09:00
Luca Boccassi e715d82de6 efi: support passing empty cmdline to mangle_stub_cmdline()
Just return instead of crashing
2023-05-23 23:22:51 +01:00