Yu Watanabe [Wed, 12 Jan 2022 15:09:38 +0000 (00:09 +0900)]
pid1,cgroup-show: ignore -EOPNOTSUPP in cg_read_pid()
The function is called in recursion, and cgroup.procs in some subcgroups
may not be read.
Fixes #22089.
(cherry picked from commit
1fb50408ce23e67e0be94ead69c891d26b4823e2)
Zbigniew Jędrzejewski-Szmek [Mon, 17 Jan 2022 10:44:44 +0000 (11:44 +0100)]
stdio-bridge: make the error more straightforward
(cherry picked from commit
a80f17844ef1d7c622d17cb4b41eb337d438fffb)
Yu Watanabe [Fri, 14 Jan 2022 18:37:40 +0000 (03:37 +0900)]
kernel-install: also remove modules.builtin.alias.bin
Fixes RHBZ#
2016630.
(cherry picked from commit
06006691b5c56b6123044179d934b3ed81c237ca)
Zbigniew Jędrzejewski-Szmek [Mon, 17 Jan 2022 10:43:48 +0000 (11:43 +0100)]
man: enhance the description of systemd-stdio-bridge
I hope that this fixes the comment
https://github.com/systemd/systemd/pull/22141#issuecomment-
1013960371
> As someone who doesn't know what this prog does
The listing in the man page is sorted according to logical
use: all the options setting the address are now together.
(cherry picked from commit
b7bb58ef70b0c876941a1c31ed4e2f5f1dc5ed0e)
Luca Boccassi [Sun, 16 Jan 2022 18:41:10 +0000 (18:41 +0000)]
systemd-stdio-bridge: add manpage
(cherry picked from commit
cf18de1b265d06b8f72646a11a469e1191826030)
Luca Boccassi [Sun, 16 Jan 2022 12:44:52 +0000 (12:44 +0000)]
man: change 'allow[s] to' -> 'allow[s] one to'
Lintian is opinionated about this and we get nagged
(cherry picked from commit
6eed65d455e9e76b020acbd858c20eafa43cebf8)
Yu Watanabe [Sun, 16 Jan 2022 06:32:27 +0000 (15:32 +0900)]
core: add missing dependency DBus properties
Follow-up for
0bc488c99ab2ed3464237607e381f4d72cd321d5.
Also sort dependency properties to make them match the definition of
`enum UnitDependency` in basic/unit-def.h.
Fixes #22133.
(cherry picked from commit
adc1b76c30940da2f3fb11275f5b0e54ebbcd7f1)
Yu Watanabe [Sun, 16 Jan 2022 11:19:19 +0000 (20:19 +0900)]
core: update log message
Fixes CID#
1469009.
(cherry picked from commit
cc8943b84ad5ffb6d327404ff577d9d185a5c316)
Yu Watanabe [Sun, 16 Jan 2022 06:59:45 +0000 (15:59 +0900)]
network: wireguard: also accept negative boolean values to disable adding routes
RouteTable=off was introduced to provide consistency with wg-quick
command. This makes the RouteTable= settings accepts other negative
boolean values.
(cherry picked from commit
e135559d805e749a0a1f8d1396cf71f6edd94831)
Yu Watanabe [Sun, 16 Jan 2022 06:53:13 +0000 (15:53 +0900)]
network: wireguard: do not add routes to AllowedIPs= by default
As setting such routes may break existing setups.
Closes #21964.
(cherry picked from commit
cfe1237f3859c0cb19b98a47870f49942d5537d9)
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jan 2022 12:38:30 +0000 (13:38 +0100)]
sd-device: silence gcc warning with newest gcc
(cherry picked from commit
376ee2c312b87951028a0adff96b1052f32475fa)
Daan De Meyer [Wed, 12 Jan 2022 18:10:54 +0000 (18:10 +0000)]
journal: Fix entry array iteration corruption checks
Previously, we'd try to handle corruption by bumping the index even
if it was an entry array object that was corrupted (which we can't
deal with).
Now, we only try to deal with corrupted entry objects by moving the
corruption handling into generic_array_get().
On top, we also add an additional check for -EADDRNOTAVAIL which can
also be caused by corrupted journal data.
(cherry picked from commit
8d801e35cb155faa08235a5af8b4d6ad60715837)
Daan De Meyer [Wed, 12 Jan 2022 17:31:57 +0000 (17:31 +0000)]
journal: Remove unused arguments from journal_file_next_entry_for_data()
(cherry picked from commit
f2eceb5268f0d26d53db5f9dad318dd45fd900bd)
Benjamin Berg [Thu, 13 Jan 2022 17:47:08 +0000 (18:47 +0100)]
man: Add more details about desktop file processing
In particular, mention the contract the generator has with external
ExecCondition= binaries that may be provided by desktop environments.
But, also mention all the other relevant keys. In particular
X-systemd-skip= is important to be documented.
(cherry picked from commit
048d46999995847095e3b7a513ba0627e0179dec)
Jan Janssen [Thu, 13 Jan 2022 13:29:46 +0000 (14:29 +0100)]
boot: Don't try to free loaded_image
EFI_LOADED_IMAGE is a protocol pointer and thus, we shouldn't try
to free it.
(cherry picked from commit
acd28f39126289dd0cb76efc79def673c27c4d04)
Jan Janssen [Thu, 13 Jan 2022 11:32:07 +0000 (12:32 +0100)]
boot: Fix invalid free
LocateDevicePath() advances the device path pointer, making it invalid
when freed.
(cherry picked from commit
41b74a18b2879e37b1e084f7ab6bd276ce30c6c9)
Yu Watanabe [Thu, 13 Jan 2022 11:19:46 +0000 (20:19 +0900)]
test: add testcase for broken NTP server option
For issue #22099.
(cherry picked from commit
95c514e9a50925e3c85f3c3e510fd31caffd5c57)
Yu Watanabe [Thu, 13 Jan 2022 09:55:51 +0000 (18:55 +0900)]
test: voidify test functions
This also drops unnecessary arguments, and unbreak several lines.
(cherry picked from commit
37408dd2644e5c337774ccb02f2fc9c31aabeefe)
Yu Watanabe [Thu, 13 Jan 2022 11:19:01 +0000 (20:19 +0900)]
sd-dhcp6-client: expose client_parse_message()
To introduce tests for the function in later commits.
(cherry picked from commit
16de849fd866c9b75b269ed902c7d591df983174)
Yu Watanabe [Thu, 13 Jan 2022 11:13:03 +0000 (20:13 +0900)]
sd-dhcp6-client: ignore broken non-critical options
The commit
b89a3758e92894162e3c2dcb594a55acff3274d5 made the validity
check of the received message stricter. E.g. if the client received a
message with broken NTP server option, then the entire message is
dropped.
This relaxes the check. If some non-critical options are broken, then
ignore the options, but the message itself is still accepted.
Fixes #22099.
(cherry picked from commit
0ac9daa4a169f627f5b3f85a4cdcdbd2c2b2e2ca)
Daan De Meyer [Thu, 13 Jan 2022 13:26:25 +0000 (13:26 +0000)]
journal: Don't discard -b arg when followed by -e
Allowing -e to be used to view the last logs of a previous boot seems
like a useful feature so let's not discard -b options anymore when
followed by -e.
Fixes #22107
(cherry picked from commit
4d6455c0754e31ddc9590c7b9c9a373d82ec0ed4)
Daan De Meyer [Wed, 12 Jan 2022 14:44:50 +0000 (14:44 +0000)]
journal: Skip data objects with invalid offsets
We already skip invalid objects, but don't yet skip invalid offsets.
Let's skip these as well to improve robustness when we're dealing with
corrupted journals.
Before:
```
➜ systemd git:(main) build/journalctl -r -n 5 --file ~/Downloads/system@
0005d2b275abaaf8-
f243a2818cb39b98.journal_
Failed to get journal fields: Cannot assign requested address
-- No entries --
```
After:
```
➜ systemd git:(main) ✗ build/journalctl -r -n 5 --file ~/Downloads/system@
0005d2b275abaaf8-
f243a2818cb39b98.journal_
Dec 09 08:32:38 snowball3 NetworkManager[911]: <info> [
1639038758.1464] device (wlp1s0): supplicant interface state: scanning -> authenticating
Dec 09 08:32:38 snowball3 kernel: wlp1s0: send auth to ec:a9:40:79:fb:ad (try 1/3)
Dec 09 08:32:38 snowball3 kernel: wlp1s0: authenticate with ec:a9:40:79:fb:ad
Dec 09 08:32:38 snowball3 wpa_supplicant[1003]: wlp1s0: SME: Trying to authenticate with ec:a9:40:79:fb:ad (SSID='UPC949397B' freq=5500 MHz)
```
(cherry picked from commit
df207ccb7be02b1ca6bdd0a2066a898e5b24ee86)
Benjamin Berg [Mon, 10 Jan 2022 11:35:46 +0000 (12:35 +0100)]
xdg-autostart-service: Ignore missing desktop-sepcific condition binary
If a desktop specific ExecCondition= binary does not exist, this just
means that the desktop environment is not available. As such, it is not
an error condition that should prevent the service from being installed
in the .wants target.
Fix this by simply returning zero.
(cherry picked from commit
6d0aef1dd15088e7379681b3bd93c3cb450f3c55)
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 10:32:53 +0000 (11:32 +0100)]
man+docs: adjust links to the new page
(cherry picked from commit
717e92ceb96471251f8242ad4f4c45cc2c68ecc9)
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:42:22 +0000 (10:42 +0100)]
policy files: adjust landing page link
(cherry picked from commit
d6e2c1ab7158d52425d3cb72459c5624db12368c)
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:39:00 +0000 (10:39 +0100)]
docs: use https:// for fd.o links
(cherry picked from commit
931bc1957b13817fcb0ffe69958dd562202c8e4c)
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:33:57 +0000 (10:33 +0100)]
README: link to the new page
Lennart's blog is now mostly of historical interest, and the wiki
landing page has been replaced by systemd.io.
(cherry picked from commit
2777a4a3bfe153cb675d3d66b383a26043c187b8)
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:33:10 +0000 (10:33 +0100)]
NEWS: adjust links to moved pages
All those pages contain a redirect at the top of the page, so it doesn't
make much sense to tell people to take the detour. Linking directly will
also increase the search rankings of the new pages.
(cherry picked from commit
a794a4d87219367e8b24469fcafce83a9f224080)
yangmingtai [Tue, 11 Jan 2022 12:22:11 +0000 (20:22 +0800)]
fix test-string-util failed when locale is not utf8
(cherry picked from commit
647082cf7f07a87c65601626e86c3ed9f78fb387)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 12:36:39 +0000 (13:36 +0100)]
nss: only read logging config from environment variables
log_parse_environment() uses should_parse_proc_cmdline() to determine whether
it should parse settings from the kernel command line. But the checks that
should_parse_proc_cmdline() apply to the whole process, and we could get a positive
answer also when log_parse_environment() was called from one of the nss modules.
In case of nss-modules, we don't want to look at the kernel command line.
log_parse_environment_variables() that only looks at the environment variables
is split out and used in the nss modules.
Fixes #22020.
(cherry picked from commit
a7d15a24659770b0fa9f4cd26fc7bbb17765cbb7)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 12:23:27 +0000 (13:23 +0100)]
nss: drop dummy setup_logging() helpers
log_parse_environment() stopped being a macro in
9fdee66f2d9.
As reported by @bauen1 in https://github.com/systemd/systemd/issues/22020,
the comment was out of date.
(cherry picked from commit
56a5f4969b96529c82ec8cc08db4fa8e9c61e7b9)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 09:56:50 +0000 (10:56 +0100)]
bootctl: do not update sd-boot if it wasn't installed in the first place
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
2038289.
(cherry picked from commit
49927ad81313b77eab09749520d20a8f4ba7cc96)
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 09:49:37 +0000 (10:49 +0100)]
bootctl: split out the check whether sd-boot is installed
(cherry picked from commit
d9f048b5d113b85b65093f582a8153f79110c49e)
lincoln auster [Tue, 11 Jan 2022 10:47:31 +0000 (03:47 -0700)]
sd-bus/man: document EBUSY error in bus_message_read (#21954)
* sd-bus/man: document EBUSY error in bus_message_read
The EBUSY error can be returned from sd_bus_exit_container(), and, if
that happens, it will be propogated upwards towards bus_message_read. In
terms of documentation, this means that bus_message_read's man page
can't just include the error text for sd_bus_message_read_basic, as
reading basic types exclusively doesn't have the potential for this
error.
sd_bus_message_read_basic's error documentation isn't incorrect when
applied to sd_bus_message_read, it's just incomplete. While EBUSY is
documented in sd_bus_message_open_container.xml,
it's explanation is unique to the sd_bus_message_exit_container function
and makes for poor documentation of the general read API.
(cherry picked from commit
a1a03fa54bfb45315eefaa49ceb38a21aceafde8)
Jan Janssen [Mon, 10 Jan 2022 10:16:26 +0000 (11:16 +0100)]
boot: Fix readdir_harder() on VirtualBox
Fixes: #22073
(cherry picked from commit
ed3abbfbde674bd163cb1c64d9e31dd24e352f85)
Julia Kartseva [Mon, 10 Jan 2022 05:35:35 +0000 (21:35 -0800)]
bpf: fix bpf_can_link_lsm_program condition
Since bpf_can_link_lsm_program return value is boolean, the expression
`r < 0` is always false.
(cherry picked from commit
ccfc534deed2f3873c967851497af10d8a1ee01c)
Julia Kartseva [Fri, 7 Jan 2022 23:02:57 +0000 (15:02 -0800)]
bpf: check if lsm link ptr is libbpf error
BPF_RAW_TRACEPOINT_OPEN is expected to work only on x86 and x86_64,
since BPF trampoline is implemented only on these architectures.
Attach probing by bpf_program__attach_lsm already happens in
`bpf_lsm_supported`. The resulting pointer can store libbpf error and
that is the case for unsupported architectures.
Add libbpf error check to `bpf_lsm_supported` so execution does not
reach the point where unit startup fails.
(cherry picked from commit
f409aa5c6363144c9711226319614f3b248d9828)
Zbigniew Jędrzejewski-Szmek [Tue, 30 Nov 2021 21:29:05 +0000 (22:29 +0100)]
shared/rm-rf: loop over nested directories instead of instead of recursing
To remove directory structures, we need to remove the innermost items first,
and then recursively remove higher-level directories. We would recursively
descend into directories and invoke rm_rf_children and rm_rm_children_inner.
This is problematic when too many directories are nested.
Instead, let's create a "TODO" queue. In the the queue, for each level we
hold the DIR* object we were working on, and the name of the directory. This
allows us to leave a partially-processed directory, and restart the removal
loop one level down. When done with the inner directory, we use the name to
unlinkat() it from the parent, and proceed with the removal of other items.
Because the nesting is increased by one level, it is best to view this patch
with -b/--ignore-space-change.
This fixes CVE-2021-3997, https://bugzilla.redhat.com/show_bug.cgi?id=
2024639.
The issue was reported and patches reviewed by Qualys Team.
Mauro Matteo Cascella and Riccardo Schirone from Red Hat handled the disclosure.
(cherry picked from commit
5b1cf7a9be37e20133c0208005274ce4a5b5c6a1)
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 15:56:42 +0000 (16:56 +0100)]
shared/rm_rf: refactor rm_rf() to shorten code a bit
(cherry picked from commit
84ced330020c0bae57bd4628f1f44eec91304e69)
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 14:55:45 +0000 (15:55 +0100)]
shared/rm_rf: refactor rm_rf_children_inner() to shorten code a bit
(cherry picked from commit
3bac86abfa1b1720180840ffb9d06b3d54841c11)
Ludwig Nussel [Tue, 4 Jan 2022 09:03:49 +0000 (10:03 +0100)]
systemctl: Fix --show timestamp
(cherry picked from commit
2dbb54788ee8d4c3d84e1af309335ad3c3885f1a)
Jan Janssen [Sun, 9 Jan 2022 13:22:15 +0000 (14:22 +0100)]
boot-timestamps: Discard firmware init time when running in a VM
Fixes: #22060
(cherry picked from commit
f699bd81e8e18da2d2fc11e7fb7dce95f8bb3f9e)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 18:24:49 +0000 (19:24 +0100)]
bpf: actually skip RestrictFileSystems= when not supported
Units would fail to start, incl. systemd-journald.service and systemd-udevd.service.
Since unit->manager->restrict_fs will be set if and only if we can use it,
we can just check for that and remove the other checks.
Follow-up for
299d9417238e0727a48ebaabb5a9de0c908ec5c8.
(cherry picked from commit
46004616a12dcdaf11020b8d58f956a006c9d9cf)
Luca Boccassi [Sun, 9 Jan 2022 14:00:25 +0000 (14:00 +0000)]
test: store empty files rather than symlinks for test-fstab-generator
Dangling symlinks get pruned when packaging up the installation
directory. Just store empty files instead, and compare the names
rather than the content for .requires/.wants - the filename is
what is important anyway, the content is ignored.
Fixes #22059
(cherry picked from commit
e683878c0f03a4ffa123e37b27933fbf7e144901)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 08:52:19 +0000 (09:52 +0100)]
man: add missing example title in systemd.network(5)
Also rename the file to match the example being extended.
(cherry picked from commit
55ac274ef4c1661f3053ae3a709202c918365f3b)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 14:23:55 +0000 (15:23 +0100)]
seccomp: move arch_prctl to @default
It was reported as used by the linker:
> [It is] called in the setup of ld-linux-x86-64.so.2 from _dl_sysdep_start.
> My local call stack (with LTO):
>
> #0 init_cpu_features.constprop.0 (/usr/lib64/ld-linux-x86-64.so.2)
> #1 _dl_sysdep_start (/usr/lib64/ld-linux-x86-64.so.2)
> #2 _dl_start (/usr/lib64/ld-linux-x86-64.so.2)
> #3 _start (/usr/lib64/ld-linux-x86-64.so.2)
>
> Looking through the source, I think it's this (links for glibc 2.34):
> - First dl_platform_init calls _dl_x86_init_cpu_features, a wrapper for init_cpu_features.
> - Then init_cpu_features calls get_cet_status.
> - At last, get_cet_status invokes arch_prctl.
Fixes #22033.
(cherry picked from commit
5f02870a74aa3a758115cc9bd6d68f239caf8453)
Yu Watanabe [Thu, 6 Jan 2022 11:12:27 +0000 (20:12 +0900)]
test: add test cases for fstab-generator
(cherry picked from commit
8cc8a073a834f3882b17115cd3e9a81f6a105898)
Yu Watanabe [Thu, 6 Jan 2022 10:04:54 +0000 (19:04 +0900)]
meson: install test-network-generator-conversion.sh even if networkd is not enabled
Follow-up for
987dd89c775815831ae21736fe60aef59cb7a6fa.
(cherry picked from commit
b322e683acf3ca3c86ea38be8a8b20a29459ec5f)
Yu Watanabe [Wed, 5 Jan 2022 13:06:03 +0000 (22:06 +0900)]
fstab-generator: also skip other network filesystems and live image
(cherry picked from commit
155e1bb4e7cf87191007488cf6a68a558a16eca1)
Yu Watanabe [Wed, 5 Jan 2022 10:24:46 +0000 (19:24 +0900)]
fstab-generator: skip root directory handling when nfsroot is requested
Fixes RHBZ#
2037233 (https://bugzilla.redhat.com/show_bug.cgi?id=
2037233).
(cherry picked from commit
77b8e92de8264c0b656a7d2fb437dd8d598ab597)
Adam Williamson [Wed, 5 Jan 2022 22:07:14 +0000 (14:07 -0800)]
kernel-install: prefer /boot over /boot/efi for $BOOT_ROOT
This restores the preference order from before
9e82a74. The code
previous to that change 'preferred' /boot over /boot/efi; that
commit changed it to check /boot/efi before checking /boot.
Changing this precedence could (and did, for me) have unexpected
effects - it seems safer to leave it how it was.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit
a5307e173bf86d695fe85b8e15e91126e8618a14)
Markus Weippert [Tue, 4 Jan 2022 12:56:11 +0000 (13:56 +0100)]
homed: stop before stopping dbus
Otherwise, systemd-homed-active.service will fail to deactivate all
homes because homectl can no longer talk to homed if dbus stops first.
As a result, /home cannot be umounted.
Doing this on systemd-homed-active.service instead works as well, but
systemd-homed will exit 1 if dbus is already shut down.
(cherry picked from commit
e00a25a7b41bd45ab73b47cbd94b3af909b8f8a1)
Yu Watanabe [Wed, 5 Jan 2022 00:10:35 +0000 (09:10 +0900)]
udev-util: ignore USB-C ports in power source mode when detecting system is running on AC power
Fixes #21988.
(cherry picked from commit
795e86b4f1e8a1fd440f8c817621779c6aedbdb5)
Yu Watanabe [Tue, 4 Jan 2022 23:29:00 +0000 (08:29 +0900)]
udev-util: re-implement on_ac_power() with sd-device
(cherry picked from commit
01d4ad3bde9efbbc5856846fea328ee9bbcef87e)
Yu Watanabe [Tue, 4 Jan 2022 23:05:26 +0000 (08:05 +0900)]
util: move on_ac_power() from util.c -> udev-util.c
(cherry picked from commit
06795b02e386763ca919bb4cd03990b9036e2e0a)
Julia Kartseva [Thu, 6 Jan 2022 00:34:56 +0000 (16:34 -0800)]
bpf: do not freeze if bpf lsm fails to set up
BPF LSM is cgroup unaware and it's set up is happening in core manager.
It occures that the current implementation is too restrictive and causes
pid 1 to freeze.
Instead:
* in bpf_lsm_setup set manager->restrict_fs pointer last,
so it is an indicator that the set up was successful
* check for manager->restrict_fs before applying unit options
(cherry picked from commit
299d9417238e0727a48ebaabb5a9de0c908ec5c8)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 10:14:18 +0000 (11:14 +0100)]
core/bpf: tighten handling of return values, improve messages
The code was written unidiomatically, using r as a boolean value, and
confusing errno and r in some places. AFAICS, there wasn't any actual
problem: even in the one place where errno was used instead of r, it would
almost certainly be initialized.
It seems that some libbpf functions set errno, while others return the
error, possibly encoded. Since there are almost no docs, the only way to
know is to read the code of the function. To make matters worse, there is
a global libbpf_mode which can be set to change the convention. With
LIBBPF_STRICT_DIRECT_ERRS in libbpf_mode, some functions set errno while others
return a negative error, and the only way to know is to read the code, except
that the split is now different. We currently don't set
LIBBPF_STRICT_DIRECT_ERRS, but even the possibility makes everything harder
to grok.
This is all very error-prone. Let's at least add some asserts to make sure that
the returned values are as expected.
(cherry picked from commit
b7cba81553d0d958f23182ba9ab1739842ff9f5a)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 09:29:13 +0000 (10:29 +0100)]
core/bpf: avoid unnecessary initialization of variables, tighten scope
No funtional change.
(cherry picked from commit
92698b0f9e34d69bc97e9ed8830eafaa06f41a46)
Pigmy-penguin [Thu, 6 Jan 2022 16:01:38 +0000 (17:01 +0100)]
userdbctl: fix "Password OK" shown even when password is empty or locked (#21308)
userdbctl: fix "Password OK" shown even when password is empty or locked
(cherry picked from commit
cd933f14bd70d8311799972ca71280a733eb1d6a)
Mike Gilbert [Wed, 5 Jan 2022 04:43:10 +0000 (23:43 -0500)]
test-watchdog: mark as unsafe
If something goes wrong with this test it may result in an unsafe
system restart. Let's avoid running it automatically.
See https://github.com/systemd/systemd/issues/22001.
(cherry picked from commit
70652c2a6fa9c06c7faac62f41c72e2e4eaa9340)
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 14:10:33 +0000 (15:10 +0100)]
logind: do not propagate error in delayed action
If the action failed, we should log about the issue, and continue.
Exiting would bring the graphical session down, which of course is not
appreciated by users.
As documented in previous commits, a non-negative return from the callback
doesn't matter, so the callback is simplified a bit.
Fixes #21991.
(cherry picked from commit
8207b8321bbbcbd19a345deb77d455d98e6ffb84)
Frantisek Sumsal [Wed, 5 Jan 2022 11:06:52 +0000 (12:06 +0100)]
test: use full date & time when checking for coredumps
Otherwise we might hit a window where the coredump happens before
midnight, but we check for it after midnight, which yields no results.
E.g.:
```
$ coredumpctl --no-legend --no-pager --file system.journal
Wed 2022-01-05 01:00:06 CET 359 0 0 SIGABRT journal /usr/bin/udevadm n/a
$ coredumpctl --since 23:59:55 --no-legend --no-pager --file system.journal
No coredumps found.
$ coredumpctl --since "2022-01-04 23:59:59" --no-legend --no-pager --file system.journal
Wed 2022-01-05 01:00:06 CET 359 0 0 SIGABRT journal /usr/bin/udevadm n/a
```
(cherry picked from commit
1b51599f29d245f2214349498bf2c1f0aa36873f)
Daan De Meyer [Wed, 5 Jan 2022 10:46:39 +0000 (10:46 +0000)]
journal: Log filename when we fail to write an entry
(cherry picked from commit
5b4a634a03c54a4d18b01686ac86b1133b54a939)
Daan De Meyer [Wed, 5 Jan 2022 10:24:20 +0000 (10:24 +0000)]
journal: Log a better message when we're rotating because a file is full
The previous message was confusing errors. When we're rotating because
we've reached the file size limit, let's log a better message.
Fixes #22007.
(cherry picked from commit
eff79e4e22e7c745fea259c4414f685363d9f16a)
Yu Watanabe [Wed, 5 Jan 2022 09:26:46 +0000 (18:26 +0900)]
backlight: ignore error if the backlight device is already removed
Fixes #21997.
(cherry picked from commit
f0f65087834198d4dabf8b389ddc34223400aab7)
Yu Watanabe [Sun, 2 Jan 2022 20:13:59 +0000 (05:13 +0900)]
test-repart: append /sbin and /usr/sbin to $PATH= to make sfdisk can be found
Fixes #21972.
(cherry picked from commit
329a5b91d9ec780b2ce84ee336448291a568ae0d)
Yu Watanabe [Sun, 2 Jan 2022 20:03:45 +0000 (05:03 +0900)]
test-repart: disable pager
(cherry picked from commit
31cf58864d3f437c7e3f0497df0fef85130f159d)
Yu Watanabe [Wed, 5 Jan 2022 06:09:43 +0000 (15:09 +0900)]
sd-boot: select newest kernel entry matching with the default glob pattern
This fixes a bug introduced by
0c674ce5f24a6e52561ec6520e43a1ca45d90f01.
Fixes #22004.
(cherry picked from commit
e37d30f334830fab4decd52ef3c17fa09b7b0d92)
Yu Watanabe [Wed, 5 Jan 2022 02:33:26 +0000 (11:33 +0900)]
resolve: add missing initialization of libgcrypt
Fixes #21951.
(cherry picked from commit
e28df39269e03d49f540ebfe6b2e507d0f26c844)
Bastien Nocera [Mon, 3 Jan 2022 09:14:39 +0000 (10:14 +0100)]
hwdb: Allow end-users root-less access to TL866 EPROM readers
As is currently done in the upstream minipro tool:
https://gitlab.com/DavidGriffith/minipro/-/tree/master/udev
(cherry picked from commit
f097f4ab896ea81e76b5764e218d7c644bfda199)
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 09:47:57 +0000 (10:47 +0100)]
hwdb: make usb match patterns uppercase
Those patterns were always supposed to be uppercase.
(cherry picked from commit
cc1746bbedb3c508cb39ce9c299f4f098bebb1a8)
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jan 2022 09:39:53 +0000 (10:39 +0100)]
hwdb: fix check for uppercasedness of match patterns
The check was added in
77547d5313ea916d2fb64ca5a8812734e9b50f92, but
it doesn't work as expected. Because the second part is wrapped in Optional(),
it would silently "succeed" when the lowercase digits were in the second part:
>>> from parse_hwdb import *
>>> g = 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4))
>>> g.parseString('v04D8pE11C*')
(['v', '04D8', 'p', 'E11C'], {})
>>> g.parseString('v04D8pe11c*')
(['v', '04D8'], {})
The following matches are OK:
usb:v0627p0001:*QEMU USB Keyboard*
usb:v0627p0001:*
usb:v0627p0001*
usb:v0627*
(cherry picked from commit
1a37237e2ffe6dfe142224a9d9e8b24135e93244)
Marco Scardovi [Sat, 1 Jan 2022 14:20:45 +0000 (15:20 +0100)]
make HP 15s-eq0xxx changes specific to sku9MG38EA#ABZ
Signed-Off-By: Marco Scardovi <marco@scardovi.com>
(cherry picked from commit
7bd3d6e35a6de8b1bf93e2fae28a64f0c7ffd2ac)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 17:38:23 +0000 (18:38 +0100)]
meson: generate better arch defines for clang bpf compilation
The code assume that meson's cpu_family can be mapped directly to
'-D__<cpu_family>__'. This works in a surprising number of cases, but not for a
few architectures. PPC uses "powerpc", and RISC-V omits the trailing underscores.
ARM and RISC-V require a second define too.
Fixes #21900.
(I don't think this matters too much: we need *something* so that gnu/stubs.h
can be successfully included. But we don't actually call syscalls or depend too
much on the host environment, so things should be fine as long as we don't get
a compilation error.)
(cherry picked from commit
e897b07f97cf25e092a4cc8e1144e06564b45d53)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 16:53:29 +0000 (17:53 +0100)]
basic/log: allow errno values higher than 255
When the support for "synthetic errno" was added, we started truncating
the errno value to just the least significant byte. This is generally OK,
because errno values are defined up to ~130.
The docs don't really say what the maximum value is. But at least in principle
higher values could be added in the future. So let's stop truncating
the values needlessly.
The kernel (or libbpf?) have an error where they return 524 as an errno
value (https://bugzilla.redhat.com/show_bug.cgi?id=
2036145). We would
confusingly truncate this to 12 (ENOMEM). It seems much nicer to let
strerror() give us "Unknown error 524" rather than to print the bogus
message about ENOMEM.
(cherry picked from commit
5f74fcd41cb1a1b26c23e0f2ab405ae9cf6bcc93)
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 08:24:03 +0000 (09:24 +0100)]
coredump: do not crash if we failed to acquire exe path
The COREDUMP_EXE attribute is "optional", i.e. we continue to process the
crash even if we didn't acquire it. The coredump generation code assumed
that it is always available:
#5 endswith at ../src/fundamental/string-util-fundamental.c:41
[ endswith() is called with NULL here, and an assertion fails. ]
#6 submit_coredump at ../src/coredump/coredump.c:823
#7 process_socket at ../src/coredump/coredump.c:1038
#8 run at ../src/coredump/coredump.c:1413
We use the exe path for loop detection, and also (ultimately) pass it to
dwfl_core_file_report(). The latter seems to be fine will NULL, so let's just
change our code to look at COMM, which should be more reliable anyway.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=
2036517.
(cherry picked from commit
c790632cabf5691b0910fc6b7a5c6af31a7786aa)
Yu Watanabe [Mon, 3 Jan 2022 17:02:12 +0000 (02:02 +0900)]
elf-util: add missing assertion
(cherry picked from commit
80b241f2ec98509cbc89d2fb1626403167a832fb)
Yu Watanabe [Mon, 3 Jan 2022 16:55:03 +0000 (01:55 +0900)]
elf-util: executable argument for parse_elf() may be NULL
Fixes assertion triggered by parse_package_metadata() and json_build().
(cherry picked from commit
d090049c01d9939b12989a74b1edc5fee75c1710)
Yu Watanabe [Thu, 30 Dec 2021 18:56:59 +0000 (03:56 +0900)]
hostname-util: drop GET_HOSTNAME_ALLOW_NONE flag and always refuse "(none)"
The flag is now only used in test-sysctl-util.c, and it should be
replaced with uname(), because of the same reason as the previous
commit.
(cherry picked from commit
9383fa08bd263277d9a17a8999c3497458f273e3)
Yu Watanabe [Thu, 30 Dec 2021 18:48:17 +0000 (03:48 +0900)]
hostname-setup: gracefully handle kernel with empty CONFIG_DEFAULT_HOSTNAME
Previously, sethostname_idempotent_full() calls gethostname_full() with
GET_HOSTNAME_ALLOW_NONE and GET_HOSTNAME_ALLOW_LOCALHOST flags. That
intended to get any values set by kernel. But, that does not work, as
the hostname may be empty.
Let's simplify the logic. The function sethostname_idempotent_full()
intends to set the requested hostname only when the current hostname
is different from the requested one. So, no check in getostname_full()
is required. Hence, simply use the result of uname() here.
Fixes #21896.
(cherry picked from commit
d8d6b2275f7b7a5b58c6b0d89b78c927333c6af9)
Jan Janssen [Sun, 2 Jan 2022 13:37:32 +0000 (14:37 +0100)]
boot: Do not warn if an initializing driver returns EFI_ABORTED
Fixes: #21965
(cherry picked from commit
8fb16fee96a1563738e7fa784fc45d152b8c2694)
Yu Watanabe [Sun, 2 Jan 2022 18:47:27 +0000 (03:47 +0900)]
seccomp-util: include missing_syscall_def.h to make __SNR_foo mapped to __NR_foo
Fixes #21969.
(cherry picked from commit
e83156c264d149e8f92f05b4d777317824a430f1)
Yu Watanabe [Sun, 2 Jan 2022 18:44:50 +0000 (03:44 +0900)]
missing-syscall: add __NR_openat2
(cherry picked from commit
d96ad9e8cb9fc8a9adfeebf69a645b809705daa0)
Yu Watanabe [Sun, 2 Jan 2022 18:48:10 +0000 (03:48 +0900)]
syscalls: update syscall definitions
(cherry picked from commit
0c718b1a67cd0d3512eafeb4659458694bf3865b)
Jan Janssen [Sun, 2 Jan 2022 19:05:58 +0000 (20:05 +0100)]
ci: Test efi binaries for section table gaps
(cherry picked from commit
bbbf1c3d3229d328f1bcbf039db8e15e221a1d85)
Jan Janssen [Sat, 1 Jan 2022 15:37:27 +0000 (16:37 +0100)]
boot: Use objcopy to align sections
Not aligning these can create gaps in the section table. Some
firmware does not handle this nicely resulting in secure boot
signature fails.
Using objcopy ensures that any new sections in the future will be
properly aligned.
Fixes: #21956
(cherry picked from commit
75747c8a399967fa5d815a8f70f724436d035652)
Yu Watanabe [Fri, 31 Dec 2021 00:13:00 +0000 (09:13 +0900)]
nss-myhostname: do not apply non-zero offset to null pointer
Fixes https://github.com/systemd/systemd/issues/21935#issuecomment-
1003216503.
(cherry picked from commit
92e9df9ca031b9b04487a46afd986ab3122183fd)
Yu Watanabe [Thu, 30 Dec 2021 21:59:42 +0000 (06:59 +0900)]
nss-systemd: fix alignment of gr_mem
Follow-up for
1e65eb8f9b7d567462030b2e625998d77677e636.
Fixes #21935.
(cherry picked from commit
420a35c1fadfb4d67be6316436233d98b5688de5)
Yu Watanabe [Thu, 30 Dec 2021 21:05:21 +0000 (06:05 +0900)]
udev: fix ID_NET_NAME_MAC= udev property
This fixes a bug introduced by
eaba9bb3e69635d2c490c5e1b0d262b763753e1d.
The commit mistakenly drops 'x' in ID_NET_NAME_MAC, and adds colons.
The colons were dropped by the commit
dfa4876c417e2a9935d58100d44d94bb41cd5bfb,
but the missing 'x' was not added at that time.
Follow-up for
dfa4876c417e2a9935d58100d44d94bb41cd5bfb.
(cherry picked from commit
60e930fc3e6eb8a36fbc184773119eb8d2f30364)
Zbigniew Jędrzejewski-Szmek [Thu, 30 Dec 2021 13:51:44 +0000 (14:51 +0100)]
meson: fix detection of libcryptsetup functions
Meson would generate the following compile test:
#define crypt_set_metadata_size meson_disable_define_of_crypt_set_metadata_size
#include <limits.h>
#undef crypt_set_metadata_size
#ifdef __cplusplus
extern "C"
#endif
char crypt_set_metadata_size (void);
#if defined __stub_crypt_set_metadata_size || defined __stub___crypt_set_metadata_size
fail fail fail this function is not going to work
#endif
int main(void) {
return crypt_set_metadata_size ();
}
This works fine when the identifier being queried is an actual function. But
crypt_token_max() is an inline function, so getting the address would fail,
leading to a false negative result. Complation would fail because the function
would be defined twice.
With this patch, the check is changed to include the header:
#include <libcryptsetup.h>
#include <limits.h>
#if defined __stub_crypt_set_metadata_size || defined __stub___crypt_set_metadata_size
fail fail fail this function is not going to work
#endif
int main(void) {
void *a = (void*) &crypt_set_metadata_size;
long long b = (long long) a;
return (int) b;
}
which seems to work correctly.
(cherry picked from commit
aac8071730bd0bca3c2289bda628b1ef7a2591d2)
Yu Watanabe [Thu, 30 Dec 2021 17:15:40 +0000 (02:15 +0900)]
test-network: add testcase for invalid AllowedIPs=
(cherry picked from commit
14b451f20aaffa25f7091a7f1240aa711459b13e)
Yu Watanabe [Thu, 30 Dec 2021 17:08:56 +0000 (02:08 +0900)]
network: wireguard: warn about invalid allowed IP addresses
But handle them gracefully. Otherwise, when the route to the address is
being configured, kernel refuse the route.
Note that kernel's wireguard module handle e.g. 192.168.10.3/24 as
192.168.10.0/24.
Fixes #21929.
(cherry picked from commit
af670fc635d1b7cd987fdb1acaf35d74c370e73f)
Yu Watanabe [Thu, 30 Dec 2021 15:31:51 +0000 (00:31 +0900)]
nss-systemd: fix required buffer size calculation
This also fixes the pointer assigned to the gr_mem element of struct group.
Fixes a bug introduced by
47fd7fa6c650d7a0ac41bc89747e3b866ffb9534.
Fixes #21935.
(cherry picked from commit
1e65eb8f9b7d567462030b2e625998d77677e636)
Yu Watanabe [Thu, 30 Dec 2021 15:11:01 +0000 (00:11 +0900)]
sysusers: use filename if /proc is not mounted
During system install, /proc may not be mounted yet.
Fixes RHBZ#
2036217 (https://bugzilla.redhat.com/show_bug.cgi?id=
2036217).
(cherry picked from commit
b78d7f246899687a1697cdcebe93d8512c5e7c4b)
Noel Kuntze [Thu, 30 Dec 2021 11:49:23 +0000 (12:49 +0100)]
network: complete example for xfrm setup
(cherry picked from commit
0d03e672a97c6ee85f563648e1ff40c88ce81d85)
Luca Boccassi [Thu, 30 Dec 2021 00:54:32 +0000 (00:54 +0000)]
systemd-run: ensure error logs suggest to use '--user' when appropriate
Before:
$ systemd-run --service-type=notify --user false
Job for run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service failed because the control process exited with error code.
See "systemctl status run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service" and "journalctl -xeu run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service" for details.
After:
$ systemd-run --service-type=notify --user false
Job for run-r7791e380a7b6400ea01d6a0e5a458b23.service failed because the control process exited with error code.
See "systemctl --user status run-r7791e380a7b6400ea01d6a0e5a458b23.service" and "journalctl --user -xeu run-r7791e380a7b6400ea01d6a0e5a458b23.service" for details.
Fixes https://github.com/systemd/systemd/issues/21933
(cherry picked from commit
466f2351bbb5c0fdc9f153e35506570e59b14c5f)
Luca Boccassi [Thu, 30 Dec 2021 00:53:29 +0000 (00:53 +0000)]
dbus-wait-for-jobs: add extra_args to bus_wait_for_jobs_one()
And pass it through to bus_wait_for_jobs()
(cherry picked from commit
86980de64bf8c03505eec729808f52f3b3042998)
Jan Janssen [Wed, 29 Dec 2021 13:35:07 +0000 (14:35 +0100)]
boot: Introduce helper macros for offset checking
This fixes a subtle sizeof overflow on 32bit machines.
(cherry picked from commit
aa1d0f25873f737fb9306a12f9283872012f2d9a)
Jan Janssen [Tue, 28 Dec 2021 15:07:09 +0000 (16:07 +0100)]
boot: Reject unaligned data
The data seems to be properly aligned in real BCD stores, so it
should be fine to just reject bad ones.
Fixes: #21917
(cherry picked from commit
1cadb35fd68f0255e50627dffd25c83e7e2081e5)
Yu Watanabe [Wed, 29 Dec 2021 03:04:46 +0000 (12:04 +0900)]
manager: always close idle pipe when sending ready notification
This fixes a bug introduced by
6d9326595592f98e8126eacb4176acd8c3516d5c.
The commit makes several functions skipped if the manager is already
in finished state, as
> In manager_check_finished(), more steps are skipped if MANAGER_IS_FINISHED().
> Those steps are idempotent, but no need to waste cycles trying to do them
> more than once.
However, the idle pipe may be re-opened after manager is finished:
manager_dispatch_run_queue() -> manager_watch_idle_pipe().
So, the closing the pipe is not idempotent here.
Fixes #21889.
(cherry picked from commit
9c1b17c3dc1541df02118ee3aaf6dd5dd540cdc2)