1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

58144 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
a385019e58 systemctl: stop saying "vendor preset"
We have vendor presets, and local admin presets, and runtime presets
(under /usr/lib, /usr/local/lib and /etc, /run, respectively). When we
display preset state, it can be configured in any of those places, so
we shouldn't say anything about the origin.

(Another nice advantage is that it improves alignment:

[root@f36 ~]# systemctl list-unit-files multipathd.service
UNIT FILE          STATE   VENDOR PRESET
multipathd.service enabled enabled

^ this looks we have a "PRESET" column that is empty.)

(cherry picked from commit c1e0dc9c882dfae7ba4bf49c50fd253ea199e7d9)
2022-07-13 13:12:31 +02:00
Lennart Poettering
81d33ab7f6 man: "enabled commands are started at boot" is rubbish
it's enabled units, and they might be started by various forms of
activation, not just "at boot".

Fix that.

(cherry picked from commit 0c772b1cc1f08bee260addbecb8adc6cdf4ddeef)
2022-07-13 13:12:31 +02:00
Lennart Poettering
2e6e30a92f json: actually use numeric C locale we just allocated
This fixes formatting of JSON real values, and uses C locale for them.
It's kinda interesting that this wasn't noticed before: the C locale
object we allocated was not used, hence doing the dance had zero effect.

This makes "test-varlink" pass again on systems with non-C locale.

(My guess: noone noticed this because "long double" was used before by
the JSON code and that had no locale supporting printer or so?)

(cherry picked from commit 93258c7d72fae23c9f8103c98dd0e79a24838e26)
2022-07-13 13:12:31 +02:00
Lennart Poettering
6e6da09bd0 sd-id128: don't allow chars > f in valid id128 values
(cherry picked from commit 82c3a0b74c8decccf2e1e384e7ad02def4a07459)
2022-07-13 13:12:31 +02:00
Yu Watanabe
5478878067 nspawn: support PrivateUsers=identity
Follow-up for 33eac552ab22af58b303342b1fa912900fa42820.

Fixes #23825.

(cherry picked from commit 5ad08191d85d6dd058b9d07ccf37ae4b709564e5)
2022-07-13 13:12:31 +02:00
Yu Watanabe
4bcd8bf893 unit: prioritize module devices
Also, prioritize tty and network devices.

Follow-up for 2336bde96420475ccb054326f27290fa0228f27d

Fixes #23850.

(cherry picked from commit 12bdeb58a63d790f5f83fc45819f61029c0d89bd)
2022-07-13 13:12:31 +02:00
Yu Watanabe
9d86a5ac92 journalctl: fix to show user slice
Fixes #23867.

(cherry picked from commit 3daf1f913c3bcf500f2c7e2b186185090c495256)
2022-07-13 13:12:31 +02:00
Daan De Meyer
437978fe51 journal: Fix missing parenthesis
(cherry picked from commit f63d1b0efa64fe716c2855a0410ac47ad67f7dec)
2022-07-13 13:12:31 +02:00
Yu Watanabe
0c36233a84 virt: fix detection of Parallels virtualization
If Parallels virtualization is detected from DMI, then trust that over CPUID.

Fixes issue caused by 28b1a3eac252d471de4fbb6f317353af30d68878.

Fixes #23856.

(cherry picked from commit 840a49f3dcee9a5243f9a31ede2edaa0a3b89e26)
2022-07-13 13:12:31 +02:00
Yu Watanabe
c45bdd7cfb sd-journal: data object may be invalid after data_object_in_hash_table()
Fixes a bug introduced by 578cd1855b73d2710ae14a8d77c4fac1d8ea7f48.

The function `data_object_in_hash_table()` calls
`journal_file_move_to_object()` with `OBJECT_DATA`. Hence,
previously obtained pointer to a data object may be now invalid.

Fixes #23794.

(cherry picked from commit b8478c14c7367c3ec5d47d2680a3390b0dedecb1)
2022-07-13 13:12:31 +02:00
Yu Watanabe
bde6e95213 test: add another test for inotify event source
The test case is for issue #23826.

(cherry picked from commit c7b5a5a7360984df4524ffac5e443e12814448d5)
2022-07-13 13:12:31 +02:00
Yu Watanabe
632ba5b2f0 sd-event: make sd_event_prepare() return positive when buffered inotify data exists
Previously, even if there is buffered inotify data, sd_event_prepare()
did not process the data when there is no pending event source.

Fixes #23826.

(cherry picked from commit 067fc917026fd1fe601de0198c5ea7b3ba782d1e)
2022-07-13 13:12:31 +02:00
Zbigniew Jędrzejewski-Szmek
09e0ccf293 test-sd-hwdb: adjust the test to actually do anything
Without the terminating colon we wouldn't match anything, so the loop over
properties was skipped.

(cherry picked from commit 6b0485c29a28aa238cfd8ccf123bf6f4ff3507f2)
2022-07-13 13:12:31 +02:00
Jacek Migacz
596dc75d18 emacs: ignore .dir-locals-2.el (personal customization) versioning
(cherry picked from commit 25e17bddec601b97516a071c6ee73060abc8b09c)
2022-07-13 13:12:31 +02:00
Yu Watanabe
0c5b7ee318 udev: allow to execute longer command line
Fixes #23607.

(cherry picked from commit c3613ee51e3aff61dfea22501c48d19c20cb7b71)
2022-07-13 13:12:31 +02:00
Yu Watanabe
b5fbf3972a core: close watchdog device if watchdog device is unspecified now
If a watchdog device was specified previously, and unspecified later and
PID1 is reloaded, then we need to close the device.

(cherry picked from commit 82d7a151db3f504fee705bcd0ded2fa0d64eafb2)
2022-07-13 13:12:31 +02:00
Łukasz Stelmach
12b790995c core: Fix memory leaks
arg_early_core_pattern and arg_watchdog_device hold pointers to memory
allocated with strdup() (inside path_make_absolute_cwd). The memory needs
to be freed in reset_arguments() during reload rather than forgotten.

(cherry picked from commit 919ea64f69f710840c1bc93f0f7cb7c51aae45d0)
2022-07-13 12:57:39 +02:00
Alban Bedel
8539a62207 units: remove the restart limit on the modprobe@.service
They are various cases where the same module might be repeatedly
loaded in a short time frame, for example if a service depending on a
module keep restarting, or if many instances of such service get
started at the same time. If this happend the modprobe@.service
instance will be marked as failed because it hit the restart limit.

Overall it doesn't seems to make much sense to have a restart limit on
the modprobe service so just disable it.

Fixes: #23742
(cherry picked from commit 9625350e5381a68c1179ae4581e7586c206663e1)
2022-07-13 12:57:39 +02:00
Pavel Zhukov
b777390814 Add sys/file.h for LOCK_
Fixes build with musl:
| ../git/src/shared/dissect-image.c: In function 'mount_image_privately_interactively':
| ../git/src/shared/dissect-image.c:2986:34: error: 'LOCK_SH' undeclared (first use in this function)
|  2986 |         r = loop_device_flock(d, LOCK_SH);
|       |                                  ^~~~~~~

(cherry picked from commit 19df770fe14da601d4e54e1592c11c10ffe4df5a)
2022-07-13 12:57:39 +02:00
Zbigniew Jędrzejewski-Szmek
a82d8d1916 pkgconfig,rpm: expose vars for user-tmpfiles.d location
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2098553.

(cherry picked from commit 107795a7592084699f68125f3d79c25a0ebca819)
2022-07-13 12:57:39 +02:00
Frantisek Sumsal
9facc51e2f test: use saved process PID instead of %%
As the `%%` specifier might fail if the current job (i.e. the last
background job) already finished:

```
[   61.692196] testsuite-04.sh[656]: ++ systemd-id128 new
[   61.705407] testsuite-04.sh[263]: + ID=912cb8f8ef304153a123f772bb0fe9e0
[   61.706318] testsuite-04.sh[657]: + systemd-cat -t 912cb8f8ef304153a123f772bb0fe9e0 bash -c 'echo parent; (echo child) & wait'
[   61.720940] testsuite-04.sh[263]: + PID=657
[   61.721126] testsuite-04.sh[263]: + wait %%
[   61.723014] testsuite-04.sh[263]: /usr/lib/systemd/tests/testdata/units/testsuite-04.sh: line 96: wait: %%: no such job
```

(cherry picked from commit 08970485003c25ce2c4adfaeea2d58558d311d42)
2022-07-13 12:57:39 +02:00
Marc Kleine-Budde
16b8ae51b0 networkctl: fix output of "status": replace "Queue Length" by "Number of Queues"
Commit 0307afc681e1 ("networkctl: add support to display Transmit/Recieve queue
length (#12633)") added the display of the number of RX and TX Queues to the
output of `networkctl status $DEV`. However the row description says "Queue
Length".

This patch fixes the output by replacing "Queue Length" by "Number of Queues".

Fixes: 0307afc681e1 ("networkctl: add support to display Transmit/Recieve queue length (#12633)")
(cherry picked from commit 25ed7633b1d231acf61246bbdca29faa80d7f00f)
2022-07-13 12:57:39 +02:00
Yu Watanabe
996979f513 seccomp-util: make @known include @obsolete
@known is generated from syscall-list.txt, which generated from kernel
headers. So, some syscalls in @obsolete may not be listed in
syscall-list.txt.

(cherry picked from commit 6d6a08547c03f96dc798cda1ef4a8d3013d292d5)
2022-07-13 12:57:39 +02:00
Yu Watanabe
20a265b416 analyze-security: always save syscall name
This reverts dd51e725df9aec2847482131ef601e0215b371a0 and fixes bugs
introduced by 1624114d74f55ad9791b7624b08d89d2339a68b3.

Previously,
- On online scan, the syscall filter was a string Hashmap, but it
  might contain syscall name with errno or error action. Hence, we need
  to drop the errno or error action in the string.
- On offline scan, the syscall filter was a Hashmap of syscall ID, so
  hashmap_contains() with syscall name did not work. We need to convert
  syscall IDs to syscall names.
- If hashmap_contains() in syscall_names_in_filter() is true, then
  the syscall is allowed when the list is an allow-list, and vice versa.
  Hence, the condition in syscall_names_in_filter() was errnously
  inverted by dd51e725df9aec2847482131ef601e0215b371a0.

This makes syscalls are always stored with its name, instead of ID,
and also correct the condition.

Fixes #23663.

(cherry picked from commit 5862e5561c9bbe87ad201e8d6b2ce2d0f04e7c37)
2022-07-13 12:57:39 +02:00
Yu Watanabe
a64c080ccf set: introduce set_put_strndup()
Note, if `n != SIZE_MAX`, we cannot check the existence of the specified
string in the set without duplicating the string. And, set_consume() also
checks the existence of the string. Hence, it is not necessary to call
set_contains() if `n != SIZE_MAX`.

(cherry picked from commit cb649d12bf3283974305c98ecf51e4bf7596a8bf)
2022-07-13 12:57:39 +02:00
Yu Watanabe
20037219b7 nspawn: fix UID map string
We send/recv the set of payload uid, host uid, payload gid, host gid.
Hence, the index must be incremented with 4, instead of 2.

Fixes #23664.

(cherry picked from commit 05ab439a62de8bb47e4137d2a8a473a307ccfb33)
2022-07-13 10:49:07 +02:00
Shreenidhi Shedi
73a327d2f4 sd-journal: check retval of sd_id128_from_string call
Fixes: CID#1469712

CID 1469712 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from sd_id128_from_string(word + 2, &boot_id) to r here,
but that stored value is overwritten before it can be used.

(cherry picked from commit c9f5ac0917409cd9eb3d55b72c2443d9b5374709)
2022-07-13 10:48:21 +02:00
Shreenidhi Shedi
18517e849c homework: initialize we_detached
Fixes: CID#1469711

CID 1469711 (#1 of 1): Uninitialized scalar variable (UNINIT)
14. uninit_use: Using uninitialized value we_detached.

(cherry picked from commit 2f4ad535492be33a4cfa6d87fb28ebd9c4f1ac07)
2022-07-13 10:48:12 +02:00
Jan Luebbe
adcd345156 hwdb: analyzers: remove generic "STM Device in DFU Mode"
The USB ID v0483pDF11 is used by the ROM code in many STMicroelectronics
devices (for firmware download) and not just signal analyzers.

(cherry picked from commit 5d049ff9204b9aad48c62c296def4daa4b53005e)
2022-07-13 10:42:52 +02:00
Shreenidhi Shedi
4509a06382 network: l2tp: initialize a to NULL
Fixes: CID#1475788
(cherry picked from commit a4433b453218ccd5bc8c49ebbfad1df199bb8d4f)
2022-07-13 10:42:31 +02:00
Yu Watanabe
25158b2944 dns-domain: make each label nul-terminated
dns_label_unescape() does not nul-terminate the buffer if it does not
have enough space. Hence, if a lable is enough long, then strjoin()
triggers buffer-overflow.

Fixes #23705.

(cherry picked from commit 9db01ca5b0322bc035e1ccd6b8a0d98a26533b4a)
2022-06-12 14:47:59 +02:00
Elias Probst
4925a108ff systemctl: add edit verb to arguments' help text
The arguments `--global`, `--runtime` and `--root` also affect the
`edit` verb.

(cherry picked from commit 4218f81d83318019fbc898c60907da23a523b70d)
2022-06-12 11:51:11 +02:00
Jan Janssen
2c1257a590 boot: Fix bad CompareMem call
(cherry picked from commit 2d5d72c62b3d7bfd4d0d3e59cf252852237aa10c)
2022-06-09 17:51:57 +02:00
Zbigniew Jędrzejewski-Szmek
6ffda7bb54 sha256: fix compilation on efi-ia32
/usr/bin/gcc -c ../src/fundamental/sha256.c -o src/boot/efi/sha256.c.o -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wno-unused-result -fno-stack-protector -fno-strict-aliasing -fpic -fwide-exec-charset=UCS2 -Wall -Wextra -Wsign-compare -nostdlib -std=gnu99 -ffreestanding -fshort-wchar -fvisibility=hidden -isystem /usr/include/efi -isystem /usr/include/efi/ia32 -I /builddir/build/BUILD/systemd-stable-250.7/src/fundamental -DSD_BOOT -DGNU_EFI_USE_MS_ABI -include src/boot/efi/efi_config.h -include version.h -mno-sse -mno-mmx -flto -O2 -flto=auto
../src/fundamental/sha256.c: In function ‘sha256_finish_ctx’:
../src/fundamental/sha256.c:61:25: error: ‘false’ undeclared (first use in this function)
   61 | # define UNALIGNED_P(p) false
      |                         ^~~~~
../src/fundamental/sha256.c:136:21: note: in expansion of macro ‘UNALIGNED_P’
  136 |                 if (UNALIGNED_P(resbuf))
      |                     ^~~~~~~~~~~
../src/fundamental/sha256.c:32:1: note: ‘false’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?
   31 | #include "sha256.h"
  +++ |+#include <stdbool.h>
   32 |
...

(cherry picked from commit 38c87ca2ab96d085158485ecfc46c7cb6af0f166)
2022-06-09 17:51:57 +02:00
Zbigniew Jędrzejewski-Szmek
eadd4f7bb0 shared/microhttp-util: silence gcc warning
../src/journal-remote/microhttpd-util.c: In function ‘check_permissions’:
../src/journal-remote/microhttpd-util.c:301:5: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]
  301 | int check_permissions(struct MHD_Connection *connection, int *code, char **hostname) {
      |     ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Fixes #23630.

(cherry picked from commit b547241728487c0dca22780241b04964f2eb37af)
2022-06-09 17:51:57 +02:00
Daan De Meyer
7028d6d2ac coredump: Fix format string type mismatch
Fixes #23471

(cherry picked from commit 08e86b15fc22a8e9f1ee0a791dfd35b2fc25e4c4)
2022-06-09 17:51:57 +02:00
Christian Hesse
baa3291b5d shared/utmp-wtmp: fix build without utmp
Commit 16618332388442f2f1c3e52b0a9fde00121564a3 changed a function to
add an extra argument. The data types used when building without utmp
missed the change.

(cherry picked from commit d6e2c2d34d336398f5948a8b731fefff3dc0ff12)
2022-06-02 22:05:22 +02:00
Zbigniew Jędrzejewski-Szmek
253052686c core/bpf: prefix log messages from different bpf subsystems
When something goes awry, we would get identical log messages from all the
bpf subsystems. E.g. "Failed to load BPF object: %m" appeared 5 times in the
sources. But it is very important to know *which* object we failed to load.
This could be guessed, e.g. from surroudning messages or from filename/line
metadata, but when we get log messages in bug reports, this might not be
available. Let's make the messages distinguishable.

While at it, some messages were adjusted a bit. In particular, we shouldn't use
internal names like BPFProgram which have no meaning outside of the codebase.

(cherry picked from commit b1acbc08e29cf92ebff3d3e726474c9d642f6d32)
v251.2
2022-06-02 20:07:11 +02:00
Zbigniew Jędrzejewski-Szmek
b9f0194aab various: add %m in messages
Sometimes we want to suppress strerror() message because the are providing
something better. But in those cases, it seems it was just forgotten.

(cherry picked from commit 2e09b2235a27df3ada3542a2402b6e1727fc2c6c)
2022-06-02 20:07:11 +02:00
Zbigniew Jędrzejewski-Szmek
1b4511849b core: define a helper function for basic bpf checks
(cherry picked from commit bb0b01ed20436a6322f8b59b19b0b5b98a6ac2bc)
2022-06-02 20:07:11 +02:00
Zbigniew Jędrzejewski-Szmek
eceaa72f87 shared/bpf: install log callback and suppress most messages from libbpf
$ build/test-socket-bind
...
libbpf: load bpf program failed: Operation not permitted
libbpf: failed to load program 'sd_bind4'
libbpf: failed to load object 'socket_bind_bpf'
libbpf: failed to load BPF skeleton 'socket_bind_bpf': -1
Failed to load BPF object: Operation not permitted

Now all lines with "libbpf:" are at debug level and will be hidden by
default.

Partially fixes https://bugzilla.redhat.com/show_bug.cgi?id=2084955#c14
(i.e. the error that was exposed when the initial error was fixed.)

(cherry picked from commit 44005a5778ca66848bf7e8dfe4c51ae62919bd69)
2022-06-02 20:07:11 +02:00
Yu Watanabe
01dca14d5f test: add test for sha256
(cherry picked from commit 3bccc736c6de30660bba019147a887295bb60663)
2022-06-02 20:07:11 +02:00
Yu Watanabe
761fc09a00 sha256: use memcpy() when result buffer is unaligned
Fixes #23578.

(cherry picked from commit c7a5eabeba1bc12adab79d2dc2cb20a78fe33227)
2022-06-02 20:07:11 +02:00
Antonio Alvarez Feijoo
98a39c3014 man: add missing arguments to systemd-creds synopsis
(cherry picked from commit 5ad0109cd8ec31b6a7fd72e0fdeaabde2669afe7)
2022-06-02 20:07:11 +02:00
Benjamin Franzke
7ee5cde343 resolved: define source address for proxy-only stub replies
DnsPacket.ifindex=1 (loopback) is normalized to 0 whenever a message is
received on the loopback iface, so for both listeners, 127.0.0.53 and
127.0.0.54, the ifindex will be set to 0 by manager_recv() for queries
that have a local origin.

Replies to such local messages need to set a proper ifindex in any
case, as the supplied source-address would otherwise be ignored in
manager_ipv4_send() (CMSG generation is skipped due to ifindex > 0 check).

Note that this change only forces `ifindex` to loopback if it was actually
normalized to `0` before (due to a loopback detection) in order to keep the
nat-to-127.0.0.54-from-another-interface usecase that was described in
a8d09063447568d87288a8e868fe386c1da7ce09 intact.
Also note that nat is not supported for the main stub 127.0.0.53 which is
why forcing LOOPBACK_IFINDEX was/is fine for that case.

Fixes #23495

(cherry picked from commit dfa14e2859418593b2f9bfae8936d780148c4e6a)
2022-06-02 20:07:11 +02:00
Christian Göttsche
423c60aff1 login: do not issue wall messages on local terminals for suspend and hibernate
Fixes: #23520

[zjs: I added the comment and tweaked the patch a bit.

The call to reset_scheduled_shutdown() is moved down a bit to allow the
callback to have access to information about the operation being cancelled.
This all happens within the same function, so there should be no observable
change in behaviour.]

(cherry picked from commit ea74f39c24344eafc238d1c69155bd5aca5f2e08)
2022-06-02 20:07:11 +02:00
Zbigniew Jędrzejewski-Szmek
befd8769c2 logind: do not print wall messages to local pseudoterminals
Fixes #23520. Replaces #23555.

The problem started with cdf370626f08ed509a5dde9d5618eed29d625032 and
90b1ec03b2ce939f589239133a32f4429f2ad6a6 which together started printing the
wall message in more cases. The motivation for those change was reasonable, but
this clearly causes problems described in #23520: users are getting unexpected
wall messages. Xterm, urxvt, (anything using libutempter?), and tmux (in some
configurations), register local pty sessions in utmp.

So let's try to suppress the message for local pseudo-terminal logins. This
patch based on #23538, but instead of filtering just on /dev/pts, it uses the
.ut_addr_v6 to only filter out local entries.

(cherry picked from commit 51a2b575d751c257f2603f12fe9bb883014c37c1)
2022-06-02 20:07:11 +02:00
Zbigniew Jędrzejewski-Szmek
865b5fb04e shared/utmp-wtmp: pass information if entry is local to filter function
This just adds an unused parameter for future use. No change in
behaviour.

(cherry picked from commit 16618332388442f2f1c3e52b0a9fde00121564a3)
2022-06-02 20:07:11 +02:00
Frantisek Sumsal
f44e534caa seccomp: fix a typo in error message
(cherry picked from commit a52765a5504108fb1d89f3d79b639b0a20efbd5e)
2022-06-02 20:07:11 +02:00
msizanoen1
1961d84ab5 cgroup-util: Properly handle conditions where cgroup.threads is empty after SIGKILL but processes still remain
After sending a SIGKILL to a process, the process might disappear from
`cgroup.threads` but still show up in `cgroup.procs` and still remains in the
cgroup and cause migrating new processes to `Delegate=yes` cgroups to fail with
`-EBUSY`. This is especially likely for heavyweight processes that consume more
kernel CPU time to clean up.

Fix this by only returning 0 when both `cgroup.threads` and
`cgroup.procs` are empty.

(cherry picked from commit 37f0289bf5f2283c187032f83c33ea955b75f119)
2022-06-02 20:07:11 +02:00