1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-21 18:03:41 +03:00

55876 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
c46b908d6e Revert "tree-wide: explicitly unpoison getdents64() memory"
This partially reverts commit 0dbce03c37d1e11837dd7f9b80b9964ca539c914.
2022-06-09 17:33:19 +02:00
Yu Watanabe
666d792e85 network: do not update interface group by default
This fixes a minor bug introduced by 10af8bb24b39a815079f6bf31b449c6e5aaa2adf.
Before the commit, the interface group was set only when Group= is explicitly
specified, otherwise the interface group was kept. However, after the commit,
we need to specify Group= with an empty string to keep the current interface
group.

(cherry picked from commit cee683394328ae271348fad93c3474b5784bcc78)
2022-06-09 17:24:40 +02:00
Jan Janssen
4ee49a624c boot: Fix bad CompareMem call
(cherry picked from commit 2d5d72c62b3d7bfd4d0d3e59cf252852237aa10c)
(cherry picked from commit f65f0b642981de071a474a2522969682bbd615ec)
2022-06-09 17:06:32 +02:00
Zbigniew Jędrzejewski-Szmek
ec340a3978 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)
(cherry picked from commit 46db77075da0f4d554b82ee6d54ef64125afec40)
2022-06-09 16:22:07 +02:00
Zbigniew Jędrzejewski-Szmek
c62d033a91 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)
(cherry picked from commit ad74be8f3746dcca066860cbb23befada4af84c6)
2022-06-09 16:22:03 +02:00
Daan De Meyer
a78e72be51 coredump: Fix format string type mismatch
Fixes #23471

(cherry picked from commit 08e86b15fc22a8e9f1ee0a791dfd35b2fc25e4c4)
(cherry picked from commit 421a99e2d681e52a7d471f34bb1bd8a2a4e56540)
2022-06-09 16:21:58 +02:00
Zbigniew Jędrzejewski-Szmek
8feb4b1766 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)
(cherry picked from commit b9f0194aabcce280121fb2f657e38e12f1f0a5b9)
v250.7
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
255264cdf6 core: define a helper function for basic bpf checks
(cherry picked from commit bb0b01ed20436a6322f8b59b19b0b5b98a6ac2bc)
(cherry picked from commit 1b4511849bde3dffe60f7707ecf61558568edf96)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
d4cff445e4 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)
(cherry picked from commit eceaa72f8786f378a63df442d1466b46afd3cb7b)
2022-06-02 20:09:14 +02:00
Yu Watanabe
b4cdb3f346 sha256: use memcpy() when result buffer is unaligned
Fixes #23578.

(cherry picked from commit c7a5eabeba1bc12adab79d2dc2cb20a78fe33227)
(cherry picked from commit 761fc09a001fa8f06ca990736d5189fee7e6353a)
2022-06-02 20:09:14 +02:00
Antonio Alvarez Feijoo
d6abfffdc5 man: add missing arguments to systemd-creds synopsis
(cherry picked from commit 5ad0109cd8ec31b6a7fd72e0fdeaabde2669afe7)
(cherry picked from commit 98a39c30145f527d8c8c0d5c4d2b922efa7f3c0b)
2022-06-02 20:09:14 +02:00
Benjamin Franzke
7a2f1363bb 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)
(cherry picked from commit 7ee5cde34348fb5f75577d2fdfa000f33ea7876c)
2022-06-02 20:09:14 +02:00
msizanoen1
e76a154efe 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)
(cherry picked from commit 1961d84ab55c18cfd908a3a80d60455aea96f369)
2022-06-02 20:09:14 +02:00
Yu Watanabe
a5b0338e89 sd-bus: fix buffer overflow
Fixes #23486.

(cherry picked from commit 89b6a3f13e5f3b8a375dc82cb2a1c2c204a5067e)
(cherry picked from commit a5c4e29b2ca83b0956ea4635e1db7b02ae007d55)
2022-06-02 20:09:14 +02:00
Nick Rosbrook
ebe423270e sd-hwdb: include sys/stat.h in hwdb-internal.h
Include this header to fix errors when including hwdb-internal.h:
  ../src/libsystemd/sd-hwdb/hwdb-internal.h:16:21: error: field ‘st’ has incomplete type
     16 |         struct stat st;

(cherry picked from commit 9745b51c73c78a63003b4cb6e0714829144d297c)
(cherry picked from commit f00716615d54711f0fd584568f04615e4a206c05)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
fb406eac65 man/homectl: adjust man page to match code
Fixes #22966. Since there are competing conventions, let's not
change our code, but make the docs match what is implemented.

(cherry picked from commit b72308d34440530df3bb8b6b3d272dfc303d1d37)
(cherry picked from commit cfd6a14c7d21fc4e4b0d8a5b684127b69231fa96)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
80f6c459b5 man/sd-bus: discuss negative-return values and add example
Fixes #22816.

(cherry picked from commit 8f2477715691f96b93d277b023f086203f76653f)
(cherry picked from commit 11b806992986cc44df303b2de1ccdc15407e3698)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
0181604288 man/shutdown: explain -h more
Fixes #23401

(cherry picked from commit 5ee38adea4d590424fc840cd0e411a3cde73695e)
(cherry picked from commit 7c2b2f279c3dc6163330e7c79190b1559203af2f)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
ba90084542 man/automount: say that automounts should not be nested
Fixes #21832.

(cherry picked from commit 223a359f21af1572a5b98629a3c684f764f3f26e)
(cherry picked from commit 7a73f995e29d8e1c673c5c032e0ad2ac9e3f66a9)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
a402228745 man/systemd.automount: move the main description up and clarify deps
(cherry picked from commit 93dbc22a9533ab4fbf8a4b6c176b95f8cef7a9a6)
(cherry picked from commit 0d3ba825e224ddf8ea5838cd6c7be9ff9892a4ea)
2022-06-02 20:09:14 +02:00
Eduard Tolosa
4278dbdb1e loader.conf: Clarify the default value of timeout.
(cherry picked from commit 815068d3a3bab32df94dff2cfe8e84d0ab973ceb)
(cherry picked from commit d5be9159995ce29c4002fc2f401996ab3087b6bd)
2022-06-02 20:09:14 +02:00
Anita Zhang
f0c4650378 test-seccomp: check for CAP_IPC_OWNER before calling shmat()
shmat() requires the CAP_IPC_OWNER capability. When running test-seccomp
in environments with root + CAP_SYS_ADMIN, but not CAP_IPC_OWNER,
memory_deny_write_execute_shmat would fail. This fixes it.

(cherry picked from commit 7e46a5c093e9e0d2e1ec734058e0caf1725ff37e)
(cherry picked from commit d4ca019870e9c31026c75633be12b5893ffa4ecf)
(cherry picked from commit 9a50c7c1499cb84b068552c503b9139c9e3a2e17)
2022-06-02 20:09:14 +02:00
Yu Watanabe
0041f0d609 mkosi: drop libiptc from build for Fedora
It is mostly deprecated on Fedora.

(cherry picked from commit ab2129004956d5b075267fce8b304c2d8ebf8c57)
2022-05-26 12:36:33 +01:00
Yu Watanabe
e5613d202d mkosi: test-acl-util requires getfacl
(cherry picked from commit 2481f0369ca680085001c8779bbbce1a2d61dd43)
2022-05-26 12:36:33 +01:00
Evgeny Vereshchagin
3354285739 ci: switch from unstable to testing on mkosi
(cherry picked from commit b0f1f76ca11e4c3f12de3ec4ade1af4bb9894bcf)
2022-05-26 12:36:33 +01:00
Zbigniew Jędrzejewski-Szmek
3784472f64 manager: skip BPF cleanup if we never initialized
This fixes a spurious warning from the manager running in user mode:

systemd[1668]: Reached target sockets.target.
systemd[1669]: Failed to create BPF map: Operation not permitted
systemd[1669]: Finished systemd-tmpfiles-setup.service.
systemd[1669]: Listening on dbus.socket.
systemd[1669]: Reached target sockets.target.
systemd[1669]: Reached target basic.target.
systemd[1]: Started user@6.service.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2084955.

(cherry picked from commit ba187c9c9ce9c0d16e09aca8c3d3c38975ce05a9)
v250.6
2022-05-25 17:27:19 +02:00
Zbigniew Jędrzejewski-Szmek
9d6fa4e17d core/bpf: lsm_bpf_supported() returns a boolean
The code was corret, but confusing, because it was treating the int
as a boolean.

(cherry picked from commit 389db516df2106bf50d7c83192a05f033baa4c2b)
2022-05-25 17:27:14 +02:00
Daan De Meyer
6f8adbad80 bootctl: Make sure bootctl install returns 0 on success
This backports the same fix from 6e9165397faa1b546d367bdfc28dd4377a8f1d0a
in systemd upstream that we can't backport directly because that commit
introduces a new feature.

(cherry picked from commit eb76587f33a08c91f025d4c7fa685c44f7b2d332)
2022-05-25 17:20:40 +02:00
Yu Watanabe
6100e1dded sysext: refuse empty release ID to avoid triggering assertion
Otherwise, the assertion in extension_release_validate() will be
triggered.

(cherry picked from commit 30e29edf4c0bb025aa7dc03c415b727fddf996ac)
2022-05-25 17:20:33 +02:00
Zbigniew Jędrzejewski-Szmek
684585719b kernel-install: restore priority of check for /boot/loader/entries
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2071034.

Based on 1b43f868934e971480249a6e0fa2f45da906ea2e.
2022-05-25 17:19:56 +02:00
Luca Boccassi
54201434be sd-bus: add comment and test in sd_bus_path_decode() for empty string
3970	        e = object_path_startswith(path, prefix);
(gdb) p path
$1 = 0x55c5a166f768 "/org/freedesktop/portable1/image"
(gdb) p prefix
$2 = 0x55c59ffc2928 "/org/freedesktop/portable1/image"
(gdb) p e
$1 = 0x5581a1675788 ""

This can be a bit confusing in certain cases, so add a comment and a
test to make the behaviour clearer and explicit.

(cherry picked from commit 54cd2d6869d20f0df3d8264168e17c31893dc0ca)
2022-05-25 17:04:57 +02:00
Zbigniew Jędrzejewski-Szmek
4abf21875c portabled: wrap long lines and fix typo in error message
(cherry picked from commit 5943d85f34bc39742291cb1a43f040d4bd581477)
2022-05-25 17:04:48 +02:00
Zbigniew Jędrzejewski-Szmek
a03ce6d1a2 portabled: refuse queries for empty image name
I took inspiration from pid1:
bus_unit_find()
  → find_unit()
    → manager_load_unit_from_dbus_path()
      → unit_name_from_dbus_path()
        → !startswith(path, "/org/freedesktop/systemd1/unit/")
          → return -EINVAL
          ←
        ←
      ←
    ← if (r < 0) return 0
  ← 0
←

i.e. we return 0 when queried for "/org/freedesktop/systemd1/unit".

Fixes #23445.

(cherry picked from commit 4313e2b69fe1bcddd7b551e171f1fa3554155968)
2022-05-25 17:04:42 +02:00
Luca Boccassi
7ff8ddd623 portable: reject root directories without an ID field in os-release
We always require at least ID to be set in os-release, reject
and propagate error to the caller instead of asserting later

(cherry picked from commit 7b2e763242e7736ef941f275977aa0c30d832c63)
2022-05-25 17:04:38 +02:00
Luca Boccassi
7970db60f5 dissect: ID from os-release should be non-empty, not just non-NULL
(cherry picked from commit a2cf73f0b602a93a32107cfc066a5e307263c577)
2022-05-25 17:04:05 +02:00
Khem Raj
1b83390ff4 Add sys/stat.h for S_IFDIR
Fixes
../git/src/shared/mkdir-label.c:13:61: error: use of undeclared identifier 'S_IFDIR'
        r = mac_selinux_create_file_prepare_at(dirfd, path, S_IFDIR);

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 29b7114c5d9624002aa7c17748d960cd1e45362d)
2022-05-25 17:03:59 +02:00
Daan De Meyer
236c55d1c5 sd-bus: Fix introspect memory leak
We have to free the contents of the set on top of the set itself.

Fixes #23443.

(cherry picked from commit dcb4e45ad8cb74b84c89b136060385c454d13c69)
2022-05-25 17:03:55 +02:00
Daan De Meyer
2db4bf991e portable: Remove unnecessary assert()
Fixes #23433

matches is plumbed through until it finally gets used in unit_match()
which can deal with NULL matches so the assert() is unnecessary and
can be removed.

The two call sites of extract_image_and_extensions() also don't
assert() on matches either.

(cherry picked from commit 1751d8c80cef40777b782c737947b4e86d99e7d6)
2022-05-25 17:03:45 +02:00
Tomasz Pala
a6f542c0d0 udev: fixed config_parse_ifalias() logic not to skip setting IFLA_IFALIAS
this flaw was introduced in 6a74900002981eacbde382f659ab706ca36155cc

(cherry picked from commit d1df0466d9d312eb06dac2bd41e85a15061e7429)
2022-05-25 17:03:29 +02:00
Yu Watanabe
c87bdab927 networkctl: fix units for bond parameters
Fixes RHBZ#2086166 (https://bugzilla.redhat.com/show_bug.cgi?id=2086166).

(cherry picked from commit 05e022a913533560a86a9b6a3ffda252df0cad1f)
2022-05-25 17:02:53 +02:00
Yu Watanabe
5ec8884fea resolve: always request records to validate negative answer
Otherwise, dns_transaction_requires_nsec() may not find no required
transaction, and return true. That sets
`answer_dnssec_result = DNSSEC_NO_SIGNATURE`, and the entire transaction fails.

Fixes #21414.

(cherry picked from commit 26b23d11870185b2ddab51bb1684d6761e8aa553)
2022-05-25 17:02:46 +02:00
Yu Watanabe
89968d6397 resolve: drop unused argument
(cherry picked from commit cd2cdba2fedf2dc71ff6429157c2e3b39938a93d)
2022-05-25 17:02:41 +02:00
Zbigniew Jędrzejewski-Szmek
fb4634471d man: fix typo
(cherry picked from commit f2f40edcb99295bc4655d0f057b8321b63db0e10)
2022-05-25 17:01:43 +02:00
Zbigniew Jędrzejewski-Szmek
edb479849c rpm: remove check if systemd is running in a few cases
rpms can be installed in two different modes: into a chroot, where the system
is not running, and onto a live system. In the first mode, where should create
all changes that are "permanent", and in the second mode, all changes which are
"permanent" but also those which only affect the running system. Thus, changes
like new modprobe rules, tmpfiles rules, binfmt rules, udev rules, etc., are
guarded by 'test -d "/run/systemd/system"' which is the official way to check
if systemd is running, so that they are *not* executed when installed into a
chroot. But the same logic does not apply to sysusers, hwdb, and the journal
catalog: all those files can and should result in changes being performed
immediately to the system. This makes the creation of immutable images possible
(because there are no permanent changes to executed after a reboot), and allows
other packages to depend on the the effect of those changes.

Thus, the guard to check if we're not in a chroot is dropped from triggers for
sysusers, hwdb, and the journal catalog. This means that those triggers will
execute, and no subsequent work is needed. systemd-sysusers.service,
systemd-journal-catalog-update.service, and systemd-hwdb-update.service.in all
have ConditionNeedsUpdate= so they they generally won't be invoked after a
reboot. (systemd.rpm does not touch /usr to trigger the condition, because the
%transfiletriggers make that unnecessary.)

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=2085481
(cherry picked from commit 2fd7ecd2da699d2fece777062e408b62162768f6)
2022-05-25 17:01:34 +02:00
Zbigniew Jędrzejewski-Szmek
fbd3459148 man,mkosi: fedora 36 has been released
(cherry picked from commit 7353de27b7b4382783dad8437cd9d3b56d41156d)
2022-05-25 16:59:51 +02:00
Yu Watanabe
61e030e173 resolve: first increment the reference counter
When `exist->rr` and `rr` point to the same object, then it may be freed by
the `dns_resource_record_unref()`.

(cherry picked from commit 4ce30e4de05971ea93bc727695000d0025eb1591)
2022-05-25 16:59:26 +02:00
Evgeny Vereshchagin
013de49db5 tests: ignore dbus-broker-launcher
There are memory leaks there https://github.com/bus1/dbus-broker/issues/289
and it crashes from time to time
https://github.com/matusmarhefka/dfuzzer/issues/20#issuecomment-1114097840
so let's just skip it by analogy with dbus-daemon to avoid
reports that have nothing to do with systemd itself.

It's kind of a part of https://github.com/systemd/systemd/pull/22547

(cherry picked from commit d0880faa5dda495c7c77425697b82a94b4e68bf6)
2022-05-25 16:59:01 +02:00
Zbigniew Jędrzejewski-Szmek
95058a435e logind: fix crash in logind on user-specified message string
This is trivially exploitable (in the sense of causing a crash from SEGV) e.g.
by 'shutdown now "Message %s %s %n"'. The message is settable through polkit,
but is limited to auth_admin:

<action id="org.freedesktop.login1.set-wall-message">
         <description gettext-domain="systemd">Set a wall message</description>
         <message gettext-domain="systemd">Authentication is required to set a wall message</message>
         <defaults>
                <allow_any>auth_admin_keep</allow_any>
                <allow_inactive>auth_admin_keep</allow_inactive>
                <allow_active>auth_admin_keep</allow_active>
        </defaults>
</action>

Bug introduced in 9ef15026c0e7e6600372056c43442c99ec53746e
('logind/systemctl: introduce SetWallMessage and --message', 2015-09-15).

Based on 0cb09bcb825ab86ba4ca70be4e6322eaf9baee95.
2022-05-25 16:58:23 +02:00
Luca Boccassi
16b95a18e7 test: ignore LXC filesystem when checking for writable locations
test-execute checks that only /var/lib/private/waldo is writable, but there are
some filesystems that are always writable and excluded. Add /sys/devices/system/cpu
which is created by lxcfs.

Fixes https://github.com/systemd/systemd/issues/23263

(cherry picked from commit 646cba5c4208c28c56dbe52d676ab1a176c69b7f)
2022-05-25 16:49:36 +02:00
Kazuo Moriwaka
767cd7c75b man: mention to Age parameter in C Type
(cherry picked from commit 4da5e566e7e92fd45539b8e7e7079bcb46fc9dd7)
2022-05-25 16:49:03 +02:00