1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00
Commit Graph

55711 Commits

Author SHA1 Message Date
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 b72308d344)
(cherry picked from commit cfd6a14c7d)
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 8f24777156)
(cherry picked from commit 11b8069929)
2022-06-02 20:09:14 +02:00
Zbigniew Jędrzejewski-Szmek
0181604288 man/shutdown: explain -h more
Fixes #23401

(cherry picked from commit 5ee38adea4)
(cherry picked from commit 7c2b2f279c)
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 223a359f21)
(cherry picked from commit 7a73f995e2)
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 93dbc22a95)
(cherry picked from commit 0d3ba825e2)
2022-06-02 20:09:14 +02:00
Eduard Tolosa
4278dbdb1e loader.conf: Clarify the default value of timeout.
(cherry picked from commit 815068d3a3)
(cherry picked from commit d5be915999)
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 7e46a5c093)
(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 ab21290049)
2022-05-26 12:36:33 +01:00
Yu Watanabe
e5613d202d mkosi: test-acl-util requires getfacl
(cherry picked from commit 2481f0369c)
2022-05-26 12:36:33 +01:00
Evgeny Vereshchagin
3354285739 ci: switch from unstable to testing on mkosi
(cherry picked from commit b0f1f76ca1)
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 ba187c9c9c)
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 389db516df)
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 6e9165397f
in systemd upstream that we can't backport directly because that commit
introduces a new feature.

(cherry picked from commit eb76587f33)
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 30e29edf4c)
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 1b43f86893.
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 54cd2d6869)
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 5943d85f34)
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 4313e2b69f)
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 7b2e763242)
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 a2cf73f0b6)
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 29b7114c5d)
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 dcb4e45ad8)
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 1751d8c80c)
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 6a74900002

(cherry picked from commit d1df0466d9)
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 05e022a913)
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 26b23d1187)
2022-05-25 17:02:46 +02:00
Yu Watanabe
89968d6397 resolve: drop unused argument
(cherry picked from commit cd2cdba2fe)
2022-05-25 17:02:41 +02:00
Zbigniew Jędrzejewski-Szmek
fb4634471d man: fix typo
(cherry picked from commit f2f40edcb9)
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 2fd7ecd2da)
2022-05-25 17:01:34 +02:00
Zbigniew Jędrzejewski-Szmek
fbd3459148 man,mkosi: fedora 36 has been released
(cherry picked from commit 7353de27b7)
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 4ce30e4de0)
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 d0880faa5d)
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 9ef15026c0
('logind/systemctl: introduce SetWallMessage and --message', 2015-09-15).

Based on 0cb09bcb82.
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 646cba5c42)
2022-05-25 16:49:36 +02:00
Kazuo Moriwaka
767cd7c75b man: mention to Age parameter in C Type
(cherry picked from commit 4da5e566e7)
2022-05-25 16:49:03 +02:00
Kazuo Moriwaka
eadea065e7 add missing cleanup-age to quickref
(cherry picked from commit 6f310287db)
2022-05-25 16:48:57 +02:00
Zbigniew Jędrzejewski-Szmek
5fa1f78f71 shared/json: fix memleak in sort
(cherry picked from commit 99b1145aae)
2022-05-25 16:48:30 +02:00
Zbigniew Jędrzejewski-Szmek
dcd7dfa520 shared/json: fix another memleak in normalization
(cherry picked from commit 3b6ce05537)
2022-05-25 16:48:26 +02:00
Zbigniew Jędrzejewski-Szmek
e0241a05d2 shared/json: reduce scope of variables
(cherry picked from commit a4669764f7)
2022-05-25 16:48:20 +02:00
Zbigniew Jędrzejewski-Szmek
ec354e792a shared/json: add helper to ref first, unref second
This normally wouldn't happen, but if some of those places were called
with lhs and rhs being the same object, we could unref the last ref first,
and then try to take the ref again. It's easier to be safe, and with the
helper we save some lines too.

(cherry picked from commit ce913e0ec4)
2022-05-25 16:47:12 +02:00
Zbigniew Jędrzejewski-Szmek
f9029ca7d5 networkctl: open the bus just once
We'd connect to the bus twice: the first time to check networkd namespace,
and then the second time to do the deed we were asked to do. It's nicer
to open the bus just once, for efficience and also to avoid the open call
in all functions.

An ASSERT_PTR helper is added:
- sd_bus *bus = userdata;
  ...
- assert(bus);
+ sd_bus *bus = ASSERT_PTR(userdata);
  ...

It can be used in other place too, but I'm leaving that for a later
refactoring.

(cherry picked from commit d821e40ca9)
2022-05-25 16:47:12 +02:00
Zbigniew Jędrzejewski-Szmek
c1dbf637d7 shared/json: fix memory leak on failed normalization
We need to increase the counter immediately after taking the ref,
otherwise we may not unref it properly if we fail before incrementing.

(cherry picked from commit 7e4be6a584)
2022-05-25 16:44:19 +02:00
Zbigniew Jędrzejewski-Szmek
18b3b28e38 shared/calendarspec: fix formatting of entries which collapse to a star
We canonicalize repeats that cover the whole range: "0:0:0/1" → "0:0:*".  But
we'd also do "0:0:0/1,0" → "0:0:*,0", which we then refuse to parse.  Thus,
first go throug the whole chain, and print a '*' and nothing else if any of the
components covers the whole range.

(cherry picked from commit 8e1e59b9ad)
2022-05-25 16:43:58 +02:00
Zbigniew Jędrzejewski-Szmek
e5cb0c072d shared/calendarspec: fix printing of second ranges which start with 0
0..3 is not the same as 0..infinity, we need to check both ends of the range.
This logic was added in 3215e35c40, and back then
the field was called .value. .stop was added later and apparently wasn't taken
into account here.

(cherry picked from commit 3aff2ae9d5)
2022-05-25 16:43:37 +02:00
Yu Watanabe
38410e13ec core/timer: fix potential use-after-free
(cherry picked from commit 756491af39)
2022-05-25 16:42:51 +02:00
Yu Watanabe
82362b16ac core/timer: fix memleak
Fixes #23326.

(cherry picked from commit d3ab7b8078)
2022-05-25 16:42:47 +02:00
Frantisek Sumsal
66784467a3 core: annotate Reexecute() as NoReply
So we're able to tell from the introspection data that the method
doesn't reply.

(cherry picked from commit 624f685fe8)
2022-05-25 16:42:33 +02:00
Lennart Poettering
7670af4add socket-util: don't reference field by macro parameter name
Let's avoid ambigituies here. (Interesting that the current users
compiled at all, in fact)

(cherry picked from commit b501e42e71)
2022-05-25 16:42:18 +02:00
Yu Watanabe
4617bad0a3 core/slice: make slice_freezer_action() return 0 if freezing state is unchanged
Fixes #23278.

(cherry picked from commit d171e72e7a)
2022-05-25 16:42:09 +02:00
Lennart Poettering
1ebbd665ea test: JSON_BUILD_REAL nowadays expects 'double', not 'long double'
Follow-up for 337712e777, aka "the great
un-long-double-ification of 2021".

(cherry picked from commit f9a1fd2a3b)
2022-05-25 16:41:27 +02:00