1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-24 02:03:54 +03:00

55437 Commits

Author SHA1 Message Date
Yu Watanabe
9f43dde134 core: update log message
Fixes CID#1469009.

(cherry picked from commit cc8943b84ad5ffb6d327404ff577d9d185a5c316)
2022-01-18 12:18:46 +01:00
Yu Watanabe
0874eaefa3 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)
2022-01-18 12:18:02 +01:00
Yu Watanabe
417622f42b 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)
2022-01-18 12:17:57 +01:00
Zbigniew Jędrzejewski-Szmek
18aff8c857 sd-device: silence gcc warning with newest gcc
(cherry picked from commit 376ee2c312b87951028a0adff96b1052f32475fa)
2022-01-18 12:17:45 +01:00
Daan De Meyer
5b44d30087 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)
2022-01-18 12:17:37 +01:00
Daan De Meyer
ef108015f3 journal: Remove unused arguments from journal_file_next_entry_for_data()
(cherry picked from commit f2eceb5268f0d26d53db5f9dad318dd45fd900bd)
2022-01-18 12:17:32 +01:00
Benjamin Berg
6a6182c3f4 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)
2022-01-18 12:16:31 +01:00
Jan Janssen
7f3e962f08 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)
2022-01-18 12:15:59 +01:00
Jan Janssen
34e5084c14 boot: Fix invalid free
LocateDevicePath() advances the device path pointer, making it invalid
when freed.

(cherry picked from commit 41b74a18b2879e37b1e084f7ab6bd276ce30c6c9)
2022-01-18 12:14:34 +01:00
Yu Watanabe
d44050a015 test: add testcase for broken NTP server option
For issue #22099.

(cherry picked from commit 95c514e9a50925e3c85f3c3e510fd31caffd5c57)
2022-01-18 12:11:58 +01:00
Yu Watanabe
2a7279f226 test: voidify test functions
This also drops unnecessary arguments, and unbreak several lines.

(cherry picked from commit 37408dd2644e5c337774ccb02f2fc9c31aabeefe)
2022-01-18 12:11:57 +01:00
Yu Watanabe
ab73799568 sd-dhcp6-client: expose client_parse_message()
To introduce tests for the function in later commits.

(cherry picked from commit 16de849fd866c9b75b269ed902c7d591df983174)
2022-01-18 12:11:49 +01:00
Yu Watanabe
bc56b640f6 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)
2022-01-18 12:11:35 +01:00
Daan De Meyer
d72db2d7ca 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)
2022-01-18 12:11:20 +01:00
Daan De Meyer
556f46aa3b 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)
2022-01-12 22:17:47 +01:00
Benjamin Berg
19fbd7764d 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)
2022-01-12 22:11:22 +01:00
Zbigniew Jędrzejewski-Szmek
704d859eeb man+docs: adjust links to the new page
(cherry picked from commit 717e92ceb96471251f8242ad4f4c45cc2c68ecc9)
2022-01-12 22:11:10 +01:00
Zbigniew Jędrzejewski-Szmek
944d8d9050 policy files: adjust landing page link
(cherry picked from commit d6e2c1ab7158d52425d3cb72459c5624db12368c)
2022-01-12 22:10:55 +01:00
Zbigniew Jędrzejewski-Szmek
e7ed0ba895 docs: use https:// for fd.o links
(cherry picked from commit 931bc1957b13817fcb0ffe69958dd562202c8e4c)
2022-01-12 22:10:51 +01:00
Zbigniew Jędrzejewski-Szmek
26271c128a 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)
2022-01-12 22:10:36 +01:00
Zbigniew Jędrzejewski-Szmek
2b075f74cb 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)
2022-01-12 22:10:30 +01:00
yangmingtai
32f33c9474 fix test-string-util failed when locale is not utf8
(cherry picked from commit 647082cf7f07a87c65601626e86c3ed9f78fb387)
2022-01-12 22:09:36 +01:00
Zbigniew Jędrzejewski-Szmek
27d141acdf 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)
2022-01-11 20:31:54 +01:00
Zbigniew Jędrzejewski-Szmek
2176cec5ec 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)
2022-01-11 20:31:51 +01:00
Zbigniew Jędrzejewski-Szmek
96826c48ad 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)
2022-01-11 20:31:42 +01:00
Zbigniew Jędrzejewski-Szmek
527c9002b5 bootctl: split out the check whether sd-boot is installed
(cherry picked from commit d9f048b5d113b85b65093f582a8153f79110c49e)
2022-01-11 20:31:34 +01:00
lincoln auster
9a109a9a11 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)
2022-01-11 20:30:50 +01:00
Jan Janssen
e9a0404b76 boot: Fix readdir_harder() on VirtualBox
Fixes: #22073
(cherry picked from commit ed3abbfbde674bd163cb1c64d9e31dd24e352f85)
2022-01-11 20:30:40 +01:00
Julia Kartseva
617c67a039 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)
v250.2
2022-01-10 21:47:30 +01:00
Julia Kartseva
f9370f9188 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)
2022-01-10 21:47:21 +01:00
Zbigniew Jędrzejewski-Szmek
911516e161 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)
2022-01-10 21:47:03 +01:00
Zbigniew Jędrzejewski-Szmek
664529efa9 shared/rm_rf: refactor rm_rf() to shorten code a bit
(cherry picked from commit 84ced330020c0bae57bd4628f1f44eec91304e69)
2022-01-10 21:47:00 +01:00
Zbigniew Jędrzejewski-Szmek
47741ff9ea shared/rm_rf: refactor rm_rf_children_inner() to shorten code a bit
(cherry picked from commit 3bac86abfa1b1720180840ffb9d06b3d54841c11)
2022-01-10 21:46:56 +01:00
Ludwig Nussel
1d5687278c systemctl: Fix --show timestamp
(cherry picked from commit 2dbb54788ee8d4c3d84e1af309335ad3c3885f1a)
2022-01-10 21:46:34 +01:00
Jan Janssen
3c5c13f82c boot-timestamps: Discard firmware init time when running in a VM
Fixes: #22060
(cherry picked from commit f699bd81e8e18da2d2fc11e7fb7dce95f8bb3f9e)
2022-01-09 21:27:07 +01:00
Zbigniew Jędrzejewski-Szmek
8ec64d0778 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)
2022-01-09 21:26:58 +01:00
Luca Boccassi
76e23c1cbe 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)
2022-01-09 21:26:13 +01:00
Zbigniew Jędrzejewski-Szmek
d1612a7163 man: add missing example title in systemd.network(5)
Also rename the file to match the example being extended.

(cherry picked from commit 55ac274ef4c1661f3053ae3a709202c918365f3b)
2022-01-09 21:25:17 +01:00
Zbigniew Jędrzejewski-Szmek
d08f6ff204 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)
2022-01-07 17:41:17 +01:00
Yu Watanabe
7dbfdefca3 test: add test cases for fstab-generator
(cherry picked from commit 8cc8a073a834f3882b17115cd3e9a81f6a105898)
2022-01-07 16:03:06 +01:00
Yu Watanabe
c6e4d8d9bd meson: install test-network-generator-conversion.sh even if networkd is not enabled
Follow-up for 987dd89c775815831ae21736fe60aef59cb7a6fa.

(cherry picked from commit b322e683acf3ca3c86ea38be8a8b20a29459ec5f)
2022-01-07 16:03:03 +01:00
Yu Watanabe
41134e766a fstab-generator: also skip other network filesystems and live image
(cherry picked from commit 155e1bb4e7cf87191007488cf6a68a558a16eca1)
2022-01-07 16:02:50 +01:00
Yu Watanabe
7ca41c509e 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)
2022-01-07 16:02:46 +01:00
Adam Williamson
d0e98b7a12 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)
2022-01-07 16:00:24 +01:00
Markus Weippert
11f3040d0a 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)
2022-01-07 16:00:18 +01:00
Yu Watanabe
7a003166fb 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)
2022-01-07 15:59:30 +01:00
Yu Watanabe
dbfaed242e udev-util: re-implement on_ac_power() with sd-device
(cherry picked from commit 01d4ad3bde9efbbc5856846fea328ee9bbcef87e)
2022-01-07 15:59:25 +01:00
Yu Watanabe
435bd3077a util: move on_ac_power() from util.c -> udev-util.c
(cherry picked from commit 06795b02e386763ca919bb4cd03990b9036e2e0a)
2022-01-07 15:59:23 +01:00
Julia Kartseva
95a43a476f 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)
2022-01-07 15:59:13 +01:00
Zbigniew Jędrzejewski-Szmek
428425ddc6 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)
2022-01-07 15:59:10 +01:00