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

55667 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
61c143b08c man: say that we ignore ignored options
Fixes #22057.

(cherry picked from commit 382586894b)
2022-03-05 21:03:32 +00:00
Zbigniew Jędrzejewski-Szmek
b634a0a615 man: drop outdated info about polkit in pid1
Fixes #22648.

(cherry picked from commit 46d362f406)
2022-03-05 21:03:32 +00:00
David Tardon
543c73300e devnode-acl: use _cleanup_ to free acl_t
(cherry picked from commit 203ea2c8f1)
2022-03-05 21:03:32 +00:00
Alfonso Sánchez-Beato
7be5734d02 sd-stub: do not print warning if filesystem is not supported
Do not print a warning in case we try to load the file system protocol for an
unsupported file system, just return EFI_SUCCESS instead.

(cherry picked from commit 178d598b5f)
2022-03-05 21:03:32 +00:00
Tobias Stoeckmann
6b37adf4a1 core: check size before mmap
The data type off_t can be 64 on 32 bit systems if they have large
file support. Since mmap expects a size_t with 32 bits as second
argument truncation could occur. At worst these huge files could
lead to mmaps smaller than the previous check for small files.

This in turn shouldn't have a lot of impact because mmap allocates
at page size boundaries. This also made the PAGE_ALIGN call in
open_mmap unneeded. In fact it was neither in sync with other mmap
calls nor with its own munmap counterpart in error path.

If such large files are encountered, which is very unlikely in these
code paths, treat them with the same error as if they are too small.

(cherry picked from commit 1a823cdeb9)
2022-03-05 21:03:32 +00:00
Lennart Poettering
b707664eee killall: show PID of processes killed in final killing spree
Let's show the PID of killed processes in all cases, to make debugging
easier.

See: https://lists.freedesktop.org/archives/systemd-devel/2022-March/047504.html
(cherry picked from commit 94ce42bcb6)
2022-03-05 21:03:32 +00:00
Daan De Meyer
1ef5fd61bd shared: Add more dlopen() tests
Add dlopen_dw(), dlopen_elf() and dlopen_pcre2() to the dlopen test.
To enable adding dlopen_pcre2(), we move pcre2-dlopen.h/c from
src/journal to src/shared.

(cherry picked from commit ee48779e05)
2022-03-05 21:03:32 +00:00
Josh Triplett
3dc6881d87 file-hierarchy: Document /sys/fs/cgroup
file-hierarchy does not mention anything about the expected mountpoint
for cgroups. This may lead some software to believe it will need to
search for it (e.g. by scanning mountinfo) rather than just looking in
the canonical location.

Document the canonical mountpoint as /sys/fs/cgroup. Also provide
information on the non-default configurations, but
make it clear that in such configurations if cgroup2 is mounted (hybrid
mode) it won't have resource controllers attached. This will help
software know if it should fall back to /sys/fs/cgroup/unified or just
ignore that case.

(cherry picked from commit c8aeb9d672)
2022-03-05 21:03:32 +00:00
Zbigniew Jędrzejewski-Szmek
d4dd289f82 man: recommend built-in platform.freedesktop_os_release() in our page
Python gained support for reading os-release, let's advertise it a bit more.
Our open-coded example is still useful, but let's not suggest it as the
default implementation.

I added quotes around the printed string because it looks a bit better
this way.

(cherry picked from commit ee6fd6a509)
2022-03-05 21:03:32 +00:00
Frantisek Sumsal
99d291eee9 test: accept both unpadded and padded partition sizes
Since util-linux/util-linux@921c7da55e
libfdisk aligns the last partition (on GPT) for optimal I/O. Let's
account for that.

Fixes: #22606
(cherry picked from commit d490188b8f)
2022-03-05 21:03:32 +00:00
Daan De Meyer
f0cc6d2f99 mkosi: Remove Arch nspawn workaround
This has been fixed so the workaround can be removed.

(cherry picked from commit 6b2ab8fc5c)
2022-03-05 21:03:32 +00:00
Daan De Meyer
e517b37922 meson: Drop required libfdisk version to 2.32
We initially pinned this to 2.33 in
e71f5585b9 because libfdisk 2.32 in
CentOS 8 didn't have
2f35c1ead6
backported.

If we check now, we can see it has been backported
(https://git.centos.org/rpms/util-linux/blob/c8s/f/SOURCES/0048-libfdisk-count-gaps-to-possible-size-when-resize.patch)
which means we can drop the required version to 2.32 instead of 2.33.

(cherry picked from commit baec7d782b)
2022-03-05 21:03:32 +00:00
Peter Hutterer
ea5701eb64 udev-builtin-input_id: don't label absolute mice as pointing sticks
The Getac UX10 tablet exposes a "CUST0000:00 0EEF:C002 Mouse" device
with BTN_LEFT/RIGHT and ABS_X/Y on the i2c bus. This causes the builtin
to incorrectly label it as pointing stick (all i2c mice are
tagged as ID_INPUT_POINTING_STICK, see 3d7ac1c655).

Fix this by adding a separate variable for absolute pointing
devices like the VMmouse USB mouse or this Getac tablet - this way we
skip the pointing stick check.

See https://gitlab.freedesktop.org/libinput/libinput/-/issues/743
for recordings.

(cherry picked from commit 8ac9ec4d5c)
2022-03-05 21:03:32 +00:00
Zbigniew Jędrzejewski-Szmek
ea65b10aab man: various issues reported in #22432
Fixes #22432.

(cherry picked from commit fe003f02dd)
2022-03-05 21:03:32 +00:00
Zbigniew Jędrzejewski-Szmek
b568be2aec man/systemd-analyze: split out example to a separate section
It turns out we can't have an Example nested in a list, and every
combination of nesting I tried looked bad either in troff or in html.
The whole example is moved to a separate section.

(cherry picked from commit e6ce195163)
2022-03-05 21:03:32 +00:00
Zbigniew Jędrzejewski-Szmek
c1cdb13193 man: adjust command for Fedora installations
glibc now has Suggests:glibc-minimal-langpack, so we don't
need to mention it ourselves.

--repo=… is a nicer alternative to --disablerepo=* --enablerepo=….
It also avoids the issue with quoting.

Let's exclude weak deps, but install systemd-networkd, so the container
can configure networking if necessary.

(cherry picked from commit 8c4db5629c)
2022-03-05 21:03:32 +00:00
Yu Watanabe
a7ec2be150 journal-send: close fd on exit when running with valgrind
Fixes an issue reported in #22576.

(cherry picked from commit eb9752d2be)
2022-03-05 21:03:32 +00:00
Yu Watanabe
4d24a36990 test-journal-send: close fd opend by syslog()
Fixes an issue reported in #22576.

(cherry picked from commit 9048a6ccf3)
2022-03-05 21:03:32 +00:00
Yu Watanabe
02bebaef30 unit: escape %
Fixes #22601.

(cherry picked from commit 6e4d122ad1)
2022-03-05 21:03:32 +00:00
Lennart Poettering
4a90c12f4f clang-format: we actually typically use 16ch continuation indentation
We use 8 for blocks, and 16 for continuation in most cases afaics, hence
say so in .clang-format too

(cherry picked from commit 92148fb777)
2022-03-05 21:03:32 +00:00
Yu Watanabe
81d3e2abff test: fix file descriptor leak in test-psi-util
Fixes an issue reported in #22576.

(cherry picked from commit be99883e13)
2022-03-05 21:03:32 +00:00
Yu Watanabe
d9189c3111 test: fix file descriptor leak in test-tmpfiles.c
Also fixes a typo in assertion.

Fixes an issure reported in #22576.

(cherry picked from commit 1da5325d19)
2022-03-05 21:03:32 +00:00
Yu Watanabe
cfe1cd0a06 test: fix file descriptor leak in test-fs-util
Fixes an issue reported in #22576.

(cherry picked from commit 19962747ca)
2022-03-05 21:03:32 +00:00
Jan Janssen
e37912e4bc boot: Handle shift and logo keys too
Some firmware supports sending input events for shift and logo keys.
Previously, we would suppress these with EFI_NOT_READY unless
some other key was pressed alongside, but it is really the job of the
caller to decide how to handle these.

Note that for keys that already have a printable shift representation
the reported input event will not have the shift key bits set
(Shift+a is reported as A). Should some firmware turn out to violate the
spec here we can always remove that part.

(cherry picked from commit 3f9973bf36)
2022-03-05 21:03:32 +00:00
Jan Janssen
c6603da3ad boot: Properly check status code of console_key_read
In some cases there was a unlikely possibility that we would look
at an uninitialized key value.
Also, returning in case of unexpected input error cases should prevent
infinite looping.

(cherry picked from commit 1cb5d7857b)
2022-03-05 21:03:32 +00:00
Yu Watanabe
55ec995341 test: fix file descriptor leak in test-oomd-util
Fixes an issue reported in #22576.

(cherry picked from commit 282696ce52)
2022-03-05 21:03:32 +00:00
Yu Watanabe
92b86911c0 test: fix file descriptor leak in test-catalog
Fixes an issue reported in #22576.

(cherry picked from commit 62d4b3b36e)
2022-03-05 21:03:32 +00:00
Yu Watanabe
b10cc2de7d test-oomd-util: fix conditional jump on uninitialised value
Fixes #22577.

(cherry picked from commit a6d6a51d83)
2022-03-05 21:03:32 +00:00
Yu Watanabe
1343c2efd5 test-oomd-util: style fixlets
(cherry picked from commit d9fe39b24a)
2022-03-05 21:03:32 +00:00
Franck Bui
2198c08d07 core: really skip automatic restart when a JOB_STOP job is pending
It's not clear why we rescheduled a service auto restart while a stop job for
the unit was pending. The comment claims that the unit shouldn't be restarted
but the code did reschedule an auto restart meanwhile.

In practice that was rarely an issue because the service waited for the next
auto restart to be rescheduled, letting the queued stop job to be proceed and
service_stop() to be called preventing the next restart to complete.

However when RestartSec=0, the timer expired right away making PID1 to
reschedule the unit again, making the timer expired right away... and so
on. This busy loop prevented PID1 to handle any queued jobs (and hence giving
no chance to the start rate limiting to trigger), which made the busy loop last
forever.

This patch breaks this loop by skipping the reschedule of the unit auto restart
and hence not depending on the value of u->restart_usec anymore.

Fixes: #13667
(cherry picked from commit c972880640)
2022-03-05 21:03:32 +00:00
Matthias Lisin
d016749c00 docs: swap Name and Partition Type UUID in header
(cherry picked from commit 7d5beae28c)
2022-03-05 21:03:32 +00:00
Matthias Lisin
5a322fd54b tools: adjust re.match to recent gpt.h additions
with addition of SD_ID128_MAKE_UUID_STR entries to src/shared/gpt.h the tool
failed halfway due to falsly matching the new entries

(cherry picked from commit 5fa87e9651)
2022-03-05 21:03:32 +00:00
Luca Boccassi
7f28c0f3f3 mkosi CI: mask isc-dhcp-server units
The packages are installed to provide the dhcpd binary, used by
test/test-network/systemd-networkd-tests.py, but we don't need the units
to run, and in fact in some cases the image fails to boot because of
them:

Spawning container image on /home/runner/work/systemd/systemd/image.raw.
Press ^] three times within 1s to kill container.
● isc-dhcp-server.service  loaded failed failed ISC DHCP IPv4 server
● isc-dhcp-server6.service loaded failed failed ISC DHCP IPv6 server
Container image failed with error code 1.
Error: Process completed with exit code 1.

Mask the units with an --extra-tree.

(cherry picked from commit 21838f36a6)
2022-03-05 21:03:32 +00:00
Frantisek Sumsal
e59c381e23 systemctl: make --timestamp= affect the show verb as well
Currently the `--timestamp=` option has no effect on timestamps shown by
`systemctl show`, let's fix that.

Spotted in #22567.

Before:
```
$ systemctl show --timestamp=us+utc systemd-journald | grep Timestamp=
ExecMainStartTimestamp=Sat 2021-12-11 15:25:57 CET
StateChangeTimestamp=Sat 2021-12-11 15:25:57 CET
InactiveExitTimestamp=Sat 2021-12-11 15:25:57 CET
ActiveEnterTimestamp=Sat 2021-12-11 15:25:57 CET
ActiveExitTimestamp=Sat 2021-12-11 15:25:57 CET
InactiveEnterTimestamp=Sat 2021-12-11 15:25:57 CET
ConditionTimestamp=Sat 2021-12-11 15:25:57 CET
AssertTimestamp=Sat 2021-12-11 15:25:57 CET
```

After:
```
$ systemctl show --timestamp=us+utc systemd-journald | grep Timestamp=
ExecMainStartTimestamp=Sat 2021-12-11 14:25:57.177848 UTC
StateChangeTimestamp=Sat 2021-12-11 14:25:57.196714 UTC
InactiveExitTimestamp=Sat 2021-12-11 14:25:57.177871 UTC
ActiveEnterTimestamp=Sat 2021-12-11 14:25:57.196714 UTC
ActiveExitTimestamp=Sat 2021-12-11 14:25:57.144677 UTC
InactiveEnterTimestamp=Sat 2021-12-11 14:25:57.176331 UTC
ConditionTimestamp=Sat 2021-12-11 14:25:57.176980 UTC
AssertTimestamp=Sat 2021-12-11 14:25:57.176980 UTC

```

(cherry picked from commit a59e5c625d)
2022-03-05 21:03:32 +00:00
Lennart Poettering
367041af81 pid1: set SYSTEMD_NSS_DYNAMIC_BYPASS=1 env var for dbus-daemon
There's currently a deadlock between PID 1 and dbus-daemon: in some
cases dbus-daemon will do NSS lookups (which are blocking) at the same
time PID 1 synchronously blocks on some call to dbus-daemon. Let's break
that by setting SYSTEMD_NSS_DYNAMIC_BYPASS=1 env var for dbus-daemon,
which will disable synchronously blocking varlink calls from nss-systemd
to PID 1.

In the long run we should fix this differently: remove all synchronous
calls to dbus-daemon from PID 1. This is not trivial however: so far we
had the rule that synchronous calls from PID 1 to the dbus broker are OK
as long as they only go to interfaces implemented by the broke itself
rather than services reachable through it. Given that the relationship
between PID 1 and dbus is kinda special anyway, this was considered
acceptable for the sake of simplicity, since we quite often need
metadata about bus peers from the broker, and the asynchronous logic
would substantially complicate even the simplest method handlers.

This mostly reworks the existing code that sets SYSTEMD_NSS_BYPASS_BUS=
(which is a similar hack to deal with deadlocks between nss-systemd and
dbus-daemon itself) to set SYSTEMD_NSS_DYNAMIC_BYPASS=1 instead. No code
was checking SYSTEMD_NSS_BYPASS_BUS= anymore anyway, and it used to
solve a similar problem, hence it's an obvious piece of code to rework
like this.

Issue originally tracked down by Lukas Märdian. This patch is inspired
and closely based on his patch:

       https://github.com/systemd/systemd/pull/22038

Fixes: #15316
Co-authored-by: Lukas Märdian <slyon@ubuntu.com>
(cherry picked from commit de90700f36)
2022-03-05 21:03:32 +00:00
Lennart Poettering
4ec9aec4b6 docs: $SYSTEMD_NSS_BYPASS_BUS is not honoured anymore, don't document it
It was removed back in 1684c56f40

Follow-up for: 1684c56f40

(cherry picked from commit cec16155e3)
2022-03-05 21:03:32 +00:00
Lennart Poettering
cf390149cb pid1: lookup owning PID of BusName= name of services asynchronously
A first step of removing blocking calls to the D-Bus broker from PID 1.
There's a lot more to got (i.e. grep src/core/ for sd_bus_creds
basically), but it's a start.

Removing blocking calls to D-Bus broker deals systematicallly with
deadlocks caused by dbus-daemon blocking on synchronous IPC calls back
to PID1 (e.g. Varlink calls through nss-systemd). Bugs such as #15316.

Also-see: https://github.com/systemd/systemd/pull/22038#issuecomment-1042958390
(cherry picked from commit e39eb045a5)
2022-03-05 21:03:32 +00:00
Lennart Poettering
a51e540b27 pid1: watch bus name always when we have it
Previously we'd only watch configured service bus names if Type=dbus was
set. Let's also watch it for other types. This is useful to pick up the
main PID of such a service. In fact the code to pick it up was already
in place, alas it didn't do anything given the signal was never received
for it. Fix that.

(It's also useful for debugging)

(cherry picked from commit 1e8b312e5a)
2022-03-05 21:03:32 +00:00
Yu Watanabe
d57147ef56 resolve: synthesize empty domain only when A and/or AAAA key is requested
Follow-up for 3b2ac14ac4 (#22231).

Before this commit.
---
$ dig -t SRV '.'

; <<>> DiG 9.16.24-RH <<>> -t SRV .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16836
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;.				IN	SRV

;; Query time: 1 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Fri Feb 04 12:01:09 JST 2022
;; MSG SIZE  rcvd: 28
---

After this commit.
---
$ dig -t SRV '.'

; <<>> DiG 9.16.24-RH <<>> -t SRV .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19861
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;.				IN	SRV

;; AUTHORITY SECTION:
.			86394	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2022020302 1800 900 604800 86400

;; Query time: 20 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Fri Feb 04 12:00:12 JST 2022
;; MSG SIZE  rcvd: 103
---

Fixes #22401.

(cherry picked from commit 30fa3aa1fa)
2022-02-24 10:20:14 +01:00
Yu Watanabe
54ab65f5f3 resolve: make dns_scope_good_domain() take DnsQuery*
(cherry picked from commit 176a9a2cca)
2022-02-24 10:20:14 +01:00
Yu Watanabe
499115dbc3 resolve: drop never matched condition
As dns_scope_good_domain() does not return negative errno.

(cherry picked from commit 830f50ab1e)
2022-02-24 10:20:14 +01:00
Yu Watanabe
89b439ee00 resolve: synthesize null address, IPv4 broadcast address, or invalid domain
These are filtered in `dns_scope_good_domain()`, but not synthesized.

Fixes #22229.

(cherry picked from commit 46b53e8035)
2022-02-24 10:20:14 +01:00
Yu Watanabe
0fd3ccca64 resolve: synthesize empty name
Do not return any error for empty name. Just returns empty answer.

Before:
---
$ dig .

; <<>> DiG 9.16.24-RH <<>> .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 13617
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;.				IN	A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 24 05:49:30 JST 2022
;; MSG SIZE  rcvd: 28
---

After:
---
$ dig .

; <<>> DiG 9.16.24-RH <<>> .
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7957
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;.				IN	A

;; Query time: 1 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 24 06:05:02 JST 2022
;; MSG SIZE  rcvd: 28
---

Replaces #22197.

Fixes RHBZ#2039854 (https://bugzilla.redhat.com/show_bug.cgi?id=2039854).

(cherry picked from commit 3b2ac14ac4)
2022-02-24 10:20:14 +01:00
Yu Watanabe
df08c12062 dns-domain: re-introduce dns_name_is_empty()
(cherry picked from commit 7bdf419830)
2022-02-24 10:20:14 +01:00
Frantisek Sumsal
477b85f438 packit: drop unnumbered patches as well
(cherry picked from commit 729c6b6af8)
2022-02-22 21:47:38 +00:00
Yu Watanabe
336711e062 sd-dhcp-server: do not offer server address
The server address may be in the pool.

(cherry picked from commit 9e0cb8b61f)
2022-02-22 21:47:38 +00:00
Yu Watanabe
995086918c sd-dhcp-server: do not assign address reserved for static leases to non-matching clients
This fix the root cause of the issue #22253.

(cherry picked from commit bd1a3eb65b)
2022-02-22 21:47:38 +00:00
Yu Watanabe
0478298bf9 sd-dhcp-server: explicitly refuse when conflicting address is requested
(cherry picked from commit 7e98fe05a0)
2022-02-22 21:47:38 +00:00
Yu Watanabe
71d05ec458 sd-dhcp-server: do not assign an address from pool when a static lease for the client ID exists
(cherry picked from commit e2ba408084)
2022-02-22 21:47:38 +00:00
Yu Watanabe
316f6bdb39 sd-dhcp-server: rename get_pool_offset() -> address_is_in_pool()
As, the value of pool_offset is not used.

(cherry picked from commit 5cc8be890d)
2022-02-22 21:47:38 +00:00