1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-21 09:33:57 +03:00
Commit Graph

56035 Commits

Author SHA1 Message Date
Nick Rosbrook
00cdc7b300 sd-netlink: restore altname on error in rtnl_set_link_name
If a current alternative name is to be used to rename a network
interface, the alternative name must be removed first. If interface
renaming fails, restore the alternative name that was deleted if
necessary.

(cherry picked from commit 4d600667f8)
(cherry picked from commit 42d8817bd6)
(cherry picked from commit a536073a62)
2023-02-13 21:10:07 +00:00
Nick Rosbrook
be8b55dfcf sd-netlink: do not swap old name and alternative name
Commit 434a348380 ("netlink: do not fail when new interface name is
already used as an alternative name") added logic to set the old
interface name as an alternative name, but only when the new name is
currently an alternative name. This is not the desired outcome in most
cases, and the important part of this commit was to delete the new name
from the list of alternative names if necessary.

(cherry picked from commit 080afbb57c)
(cherry picked from commit 3dc5b19f10)
(cherry picked from commit facb873e6f)
2023-02-13 21:10:07 +00:00
Nick Rosbrook
d57acef8ce udev/net: allow new link name as an altname before renaming happens
When configuring a link's alternative names, the link's new name to-be
is not allowed to be included because interface renaming will fail if
the new name is already present as an alternative name. However,
rtnl_set_link_name will delete the conflicting alternative name before
renaming the device, if necessary.

Allow the new link name to be set as an alternative name before the
device is renamed. This means that if the rename is later skipped (i.e.
because the link is already up), then the name can at least still be
present as an alternative name.

(cherry picked from commit d0b31efc1a)
(cherry picked from commit 7918496dcf)
(cherry picked from commit ba896a6de0)
2023-02-13 21:10:07 +00:00
msizanoen1
71f9e1fab8 unit: always return 1 in log_kill
This ensures that cg_kill_items returns the correct value to let the
manager know that a process was killed.

(cherry picked from commit 500cd2e83b)
(cherry picked from commit 86686e4292)
(cherry picked from commit 64d7289214)
2023-02-13 21:10:07 +00:00
Ilya Leoshkevich
d8d3106ea8 bpf: fix restrict_fs on s390x
Linux kernel's bpf-next contains BPF LSM support for s390x. systemd's
test-bpf-lsm currently fails with this kernel.

This is an endianness issue: in the restrict_fs bpf program,
magic_number has type unsigned long (64 bits on s390x), but magic_map
keys are uint32_t (32 bits). Accessing magic_map using 64-bit keys may
work by accident on little-endian systems, but fails hard on big-endian
ones.

Fix by casting magic_number to uint32_t.

(cherry picked from commit 907046282c)
(cherry picked from commit f62e7b4704)
(cherry picked from commit 25cb55890e)
2023-02-13 21:10:07 +00:00
Yu Watanabe
3dd120c2ea network: dhcp-server: do not create DHCPServer object when the DHCP server is running in relaying mode
Follow-up for c95df5879e.

Fixes #26196.

(cherry picked from commit 2cb1cabb41)
(cherry picked from commit 318b6f60b8)
(cherry picked from commit 0f967fba15)
2023-02-13 21:10:07 +00:00
Tuetuopay
1568716193 network/dhcp4: accept local subnet routes from DHCP
RFC3442 specifies option 121 (Classless Static Routes) that allow a DHCP
server to push arbitrary routes to a client. It has a Local Subnet
Routes section expliciting the behavior of routes with a null (0.0.0.0)
gateway.

Such routes are to be installed on the interface with a Link scope, to
mark them as directly available on the link without any gateway.

Networkd currently drops those routes, which is against the RFC, as
Linux has proper support for such routes.

Fixes: 7f20627 ("network: dhcp4: ignore gateway in static routes if destination is link-local or in the same network")
(cherry picked from commit 1d84a3c779)
(cherry picked from commit b0f514ba56)
(cherry picked from commit ee6475d318)
2023-02-13 21:10:07 +00:00
Lennart Poettering
18440f9b91 resolvectl: don't filter loopback DNS server from global DNS server list
"resolvectl status" shows per-link DNS servers separately from global
ones. When querying the global list, it will contain both per-link and
global servers however. Thus, to not show duplicate info we filter all
entries that actually have a non-zero ifindex set (under the assumption
that that's a per-link server).

This doesn't work if people configured 127.0.0.1 as global server
though, as we'll add ifindex 1 to it since
6e32414a66 unconditionally even for global
servers.

Let's address that by excluding entries with ifindex 1 from suppression.
This is safe as resolved ignores loopback ifaces, hence never will have
per-link servers on ifindex 1.

Note that this splits up the "with_ifindex" parameter into a second
parameter "only_global", since they semantically do two different
things. One controls whether we shall expect/parse an ifindex dbus
field. The other controls whether we shall filter all ifindex values set
!= 0. These are effectively always used in conjunction hence making them
the same actually worked. However this is utterly confusing I think,
which as I guess is resulting in the confusion around #25796 (which
removes the whole check)

Replaces: #25796
(cherry picked from commit 889a1b9f4e)
(cherry picked from commit b71ade8779)
(cherry picked from commit fa04709a3d)
2023-02-13 21:10:07 +00:00
Lennart Poettering
2e6d400fd8 resolvectl: fix type of ifindex D-Bus field, and make sure to initialize to zero in all code paths
(cherry picked from commit a5e6c8498c)
(cherry picked from commit ed26f98f2f)
(cherry picked from commit 87307bfdd1)
2023-02-13 21:10:07 +00:00
msizanoen1
1c36c0b5a1 udev: match device tags in rules using current device tags
This ensures that udev scripts using `TAG-="..."` and expecting later
udev rules to honor it will work properly. An use case is removing the
`uaccess` tag from a device without overriding the original file and
ensuring that `73-seat-uaccess.rules` won't run the uaccess builtin later.

(cherry picked from commit 3102499039)
(cherry picked from commit 7d4ea095d5)
(cherry picked from commit ca948c9601)
2023-02-13 21:10:07 +00:00
Lennart Poettering
0d315ca6e7 docs: remove /dev/tty* confusion
The text said /dev/tty* as a whole was the VT subsystem and that VT is
not supported in containers.

But that's not accurate as /dev/tty* will match /dev/tty too and that
one device node is special and is not related to VT: it always points to
the current process own controlling tty, regardless what that is.

hence, rewrite /dev/tty* as /dev/tty[0-9]*.

(cherry picked from commit 6ae5c39af1)
(cherry picked from commit f3d620f5d2)
(cherry picked from commit b4e56b13a9)
2023-02-13 21:10:07 +00:00
Lennart Poettering
230ade8bff units: pull in loop.ko and dm-mod.ko before repart
We want to make use of that when formatting file systems, hence let's
pull in these modules explicitly.

(This is necessary because we are an early boot service that might run
before systemd-tmpfiles-dev.service, which creates /dev/loop-control and
/dev/mapper/control.)

Alternatively we could just order ourselves after
systemd-tmpfiles-dev.service, but I think there's value in adding an
explicit minimal ordering here, since we know what we'll need.

Fixes: #25775
(cherry picked from commit ce7dcfd6b0)
(cherry picked from commit 3856b97f8b)
(cherry picked from commit 208153c32b)
2023-02-13 21:10:07 +00:00
Lennart Poettering
9a2d8e4620 units: change modprobe@dm-mod.service → modprobe@dm_mod.service
Follow-up for 8f1359bf85

(cherry picked from commit 143a1f1039)
(cherry picked from commit 67467efd58)
(cherry picked from commit 923264e034)
2023-02-13 21:10:07 +00:00
Nishal Kulkarni
54743fff8d shell-completion: Add completion for oomctl
Added bash and zsh completions for oomctl arguments and commands.

Related To: #22118

(cherry picked from commit de0988f9d2)
2023-01-28 00:50:04 +00:00
Lennart Poettering
e4fccaf370 mkosi: pull in libbpf1 instead of legacy libbpf0 on debian
(cherry picked from commit 0d9e6d76be)
(cherry picked from commit 31bb2ef7ea)
(cherry picked from commit 1ee30b0ea9)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
96be2340d6 semaphore: remove the Semaphore repositories recursively
The list of disabled repositories was recently converted from a single
file into a directory with separate repository files, so let's adjust
the setup script accordingly.

```
$ ls -lR /etc/apt/sources.list.d/
/etc/apt/sources.list.d/:
total 36
-rw-r--r-- 1 root root   76 Nov  3 10:28 azure-cli.list
-rw-r--r-- 1 root root   72 Nov  3 10:22 bazel.list
drwxr-xr-x 2 root root 4096 Nov  3 10:31 disabled
-rw-r--r-- 1 root root  113 Nov  3 10:13 docker-source.list
-rw-r--r-- 1 root root  367 Nov  3 10:28 github_git-lfs.list
-rw-r--r-- 1 root root  111 Nov  3 10:25 google-chrome-source.list
-rw-r--r-- 1 root root   64 Nov  3 10:14 google-cloud-sdk.list
-rw-r--r-- 1 root root   54 Nov  3 10:23 helm-stable-debian.list
-rw-r--r-- 1 root root   89 Nov  3 10:29 yarn-source.list

/etc/apt/sources.list.d/disabled:
total 20
-rw-r--r-- 1 root root 100 Nov  3 10:23 devel_kubic_libcontainers_stable.list
-rw-r--r-- 1 root root 103 Nov  3 10:27 git.list
-rw-r--r-- 1 root root 105 Nov  3 10:22 gradle.list
-rw-r--r-- 1 root root 118 Nov  3 10:13 pypy.list
-rw-r--r-- 1 root root 104 Nov  3 10:13 python.list
```

(cherry picked from commit 610eb3f826)
(cherry picked from commit 31cfa1cc96)
(cherry picked from commit 4fbf69fd1b)
2023-01-28 00:50:04 +00:00
Daan De Meyer
18b7b6a38a test-execute: Skip when /sys is read-only
The test depends on /sys being writable, so let's skip it when /sys
is read-only.

(cherry picked from commit 34b5977015)
(cherry picked from commit 4dc37994e2)
(cherry picked from commit 0acf4d71e0)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
077aeaf270 partition: fix build with newer linux/btrfs.h uapi header
linux/btrfs.h needs  to be included after sys/mount.h, as since [0]
linux/btrfs.h includes linux/fs.h causing build errors:

```
In file included from /usr/include/linux/fs.h:19,
                 from ../src/basic/linux/btrfs.h:29,
                 from ../src/partition/growfs.c:6:
/usr/include/sys/mount.h:35:3: error: expected identifier before numeric constant
   35 |   MS_RDONLY = 1,                /* Mount read-only.  */
      |   ^~~~~~~~~
[1222/2169] Compiling C object systemd-creds.p/src_creds_creds.c.o
ninja: build stopped: subcommand failed.
```

See: https://github.com/systemd/systemd/issues/8507

[0] a28135303a

(cherry picked from commit ed614f17fc)
(cherry picked from commit 8f84df0da3)
(cherry picked from commit 1fc632e151)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
442ee8c50d basic/linux: update linux uapi headers
IPPROTO_L2TP was moved from linux/l2tp.h to linux/in.h [0], so let's
reflect that change to fix build with newer kernels:

```
In file included from ../src/libsystemd/sd-netlink/netlink-types-genl.c:10:
../src/basic/linux/l2tp.h:16: error: "IPPROTO_L2TP" redefined [-Werror]
   16 | #define IPPROTO_L2TP            115
      |
In file included from ../src/libsystemd/sd-netlink/netlink-types-genl.c:3:
/usr/include/netinet/in.h:85: note: this is the location of the previous definition
   85 | #define IPPROTO_L2TP            IPPROTO_L2TP
      |
cc1: all warnings being treated as errors
```

When at it, update the rest of the headers we ship as well.

[0] 65b32f801b

(cherry picked from commit a95ff98ec4)
(cherry picked from commit 240513ceca)
(cherry picked from commit 4bc291c1d4)
2023-01-28 00:50:04 +00:00
Nick Rosbrook
24a8928a26 test: make sure mount point exists in testsuite-64.sh
(cherry picked from commit 84e5b9225d)
(cherry picked from commit 07e4787106)
(cherry picked from commit bd32bbebd5)
2023-01-28 00:50:04 +00:00
Luca Boccassi
02332752b3 core: ensure init.scope is realized after drop-ins have been loaded
If we add a drop-in for init.scope (e.g.: to set some memory limit),
it will be loaded long after the cgroup has already been realized.
Do it again when creating the special unit.

(cherry picked from commit 020b2e41ea)
(cherry picked from commit 786b7a7208)
(cherry picked from commit ffa329c45c)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
e014c02f57 test: bump the client-side timeout in sd-bus as well
Since c78d18215b D-Bus services now have 60s to start, but the client
side (sd-bus) still waits only for 25s before giving up:

```
[  226.196380] testsuite-71.sh[556]: + assert_in 'Static hostname: H' ''
[  226.332965] testsuite-71.sh[576]: + set +ex
[  226.332965] testsuite-71.sh[576]: FAIL: 'Static hostname: H' not found in:
[  228.910782] sh[577]: + systemctl poweroff --no-block
[  232.255584] hostnamectl[565]: Failed to query system properties: Connection timed out
[  236.827514] systemd[1]: end.service: Consumed 2.131s CPU time.
[  237.476969] dbus-daemon[566]: [system] Successfully activated service 'org.freedesktop.hostname1'
[  237.516308] systemd[1]: system-modprobe.slice: Consumed 1.533s CPU time.
[  237.794635] systemd[1]: testsuite-71.service: Main process exited, code=exited, status=1/FAILURE
[  237.818469] systemd[1]: testsuite-71.service: Failed with result 'exit-code'.
[  237.931415] systemd[1]: Failed to start testsuite-71.service.
[  238.000833] systemd[1]: testsuite-71.service: Consumed 5.651s CPU time.
[  238.181030] systemd[1]: Reached target testsuite.target.
```

Let's override the timeout in sd-bus as well to mitigate this.

Follow-up to c78d18215b.

(cherry picked from commit e0cbb73911)
(cherry picked from commit e4ed752f23)
(cherry picked from commit f69dc64d38)
2023-01-28 00:50:04 +00:00
Michal Koutný
ff542dcd1a core: mount namespaces: Remove auxiliary bind mounts directory after unit termination
Unit that requires its own mount namespace creates a temporary directory
to implement dynamic bind mounts (org.freedesktop.systemd1.Manager.BindMountUnit).
However, this directory is never removed and they will accumulate for
each unique unit (e.g. templated units of systemd-coredump@).

Attach the auxiliary runtime directory existence to lifetime of other
"runtime" only per-unit directories.

(cherry picked from commit b9f976fb45)
(cherry picked from commit 80e8340ec4)
(cherry picked from commit fd260cb37e)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
f7ed5eefdb test: bump D-Bus service start timeout if we run without accel
The default (25s) doesn't seem to be enough in some cases (especially
in VMs without acceleration), causing spurious timeouts:

[  174.297658] dbus-daemon[647]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.0' (uid=0 pid=645 comm="hostnamectl " label="kernel")
[  184.202313] systemd[1]: systemd-update-utmp-runlevel.service: Consumed 1.253s CPU time.
[  197.335422] systemd[1]: Started dbus.service.
[  199.211468] testsuite-71.sh[639]: + assert_in 'Static hostname: H' ''
[  199.347192] dbus-daemon[647]: [system] Failed to activate service 'org.freedesktop.hostname1': timed out (service_start_timeout=25000ms)
[  199.394879] testsuite-71.sh[657]: + set +ex
[  199.438918] testsuite-71.sh[657]: FAIL: 'Static hostname: H' not found in:
[  200.966006] systemd-logind[631]: Watching system buttons on /dev/input/event0 (Power Button)
[  201.008178] systemd-logind[631]: Watching system buttons on /dev/input/event1 (AT Translated Set 2 keyboard)
[  201.034106] systemd-logind[631]: New seat seat0.
[  201.238267] sh[658]: + systemctl poweroff --no-block
[  201.329890] systemd[1]: Starting systemd-hostnamed.service...
[  202.156622] systemd[1]: systemd-update-utmp-runlevel.service: Deactivated successfully.
[  204.818913] hostnamectl[645]: Failed to query system properties: Connection timed out
[  205.195583] systemd[1]: testsuite-71.service: Main process exited, code=exited, status=1/FAILURE
[  205.227237] systemd[1]: testsuite-71.service: Failed with result 'exit-code'.
[  205.712780] systemd[1]: Failed to start testsuite-71.service.

(cherry picked from commit c78d18215b)
(cherry picked from commit 1710948120)
(cherry picked from commit 539358c2c7)
2023-01-28 00:50:04 +00:00
Yu Watanabe
fb16404da3 sd-dhcp-client: gracefully handle invalid ether type client ID
Currently, sd-dhcp-server accepts spurious client IDs, then the leases
exposed by networkd may be invalid. Let's make networkctl gracefully
show such leases.

Fixes #25984.

(cherry picked from commit 841dfd3dc0)
(cherry picked from commit a674a398e7)
(cherry picked from commit 088d6c8521)
2023-01-28 00:50:04 +00:00
David Tardon
a6aa2a282a mount: handle bind mount of file with non-existing target
When the target (Where=) of a mount does not exist, systemd tries to
create it. But previously, it'd always been created as a directory. That
doesn't work if one wants to bind-mount a file to a target that doesn't
exist.

Fixes: #17184
(cherry picked from commit 218cfe2335)
(cherry picked from commit 25e30725d7)
(cherry picked from commit 48251e428f)
2023-01-28 00:50:04 +00:00
Alberto Planas
f960fa45c1 creds-util: check for CAP_DAC_READ_SEARCH
In make_credential_host_secret, the credential.secret file is generated
first as a temporary anonymous file that is later instantiated with
linkat(2).  This system call requires CAP_DAC_READ_SEARCH capability
when the flag AT_EMPTY_PATH is used.

This patch check if the capability is effective, and if not uses the
alternative codepath for creating named temporary files.

Non-root users can now create per-user credentials with:

  export SYSTEMD_CREDENTIAL_SECRET=$HOME/.config/systemd/credential.secret
  systemd-creds setup

Signed-off-by: Alberto Planas <aplanas@suse.com>
(cherry picked from commit 1615578f27)
(cherry picked from commit 432ec5a654)
(cherry picked from commit d7c8b1b709)
2023-01-28 00:50:04 +00:00
Mike Yuan
af18fc2767 gpt-auto: harden ESP/XBOOTLDR mounts with "noexec,nosuid,nodev"
When these partitions are probed by gpt-auto,
they will always be hardened with such options.

See also: https://github.com/systemd/systemd/issues/25776#issuecomment-1364115711

Closes #25776

(cherry picked from commit d708293d43)
(cherry picked from commit 49804cfb71)
(cherry picked from commit ebe67b6e88)
2023-01-28 00:50:04 +00:00
Yu Watanabe
4a0aec68da busctl: fix introspecting DBus properties
Follow-up for f2f7785d7a.

Fixes #26033.

(cherry picked from commit 2cbb171d20)
(cherry picked from commit 89e86ad8df)
(cherry picked from commit abcd25b66e)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
46d1581426 import: use CURLOPT_PROTOCOLS_STR with libcurl >= 7.85.0
CURLOPT_PROTOCOLS [0] was deprecated in libcurl 7.85.0 with
CURLOPT_PROTOCOLS_STR [1] as a replacement, causing build warnings/errors:

../build/src/import/curl-util.c: In function ‘curl_glue_make’:
../build/src/import/curl-util.c:255:9: error: ‘CURLOPT_PROTOCOLS’ is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [-Werror=deprecated-declarations]
  255 |         if (curl_easy_setopt(c, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS|CURLPROTO_FILE) != CURLE_OK)
      |         ^~
In file included from ../build/src/import/curl-util.h:4,
                 from ../build/src/import/curl-util.c:6:
/usr/include/curl/curl.h:1749:3: note: declared here
 1749 |   CURLOPTDEPRECATED(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181,
      |   ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Since there's no grace period between the two symbols, let's resort
to a light if-def-ery to resolve this.

[0] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS.html
[1] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS_STR.html

(cherry picked from commit e61a4c0b7c)
(cherry picked from commit 14f573175a)
(cherry picked from commit 4768110a2e)
2023-01-28 00:50:04 +00:00
Frantisek Sumsal
f38e2295fa import: use CURLINFO_SCHEME instead of CURLINFO_PROTOCOL
CURLINFO_PROTOCOL has been deprecated in curl 7.85.0 causing compilation
warnings/errors:

../build/src/import/pull-job.c: In function ‘pull_job_curl_on_finished’:
../build/src/import/pull-job.c:142:9: error: ‘CURLINFO_PROTOCOL’ is deprecated: since 7.85.0. Use CURLINFO_SCHEME [-Werror=deprecated-declarations]
  142 |         code = curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
      |         ^~~~
In file included from ../build/src/import/curl-util.h:4,
                 from ../build/src/import/pull-job.h:6,
                 from ../build/src/import/pull-common.h:7,
                 from ../build/src/import/pull-job.c:16:
/usr/include/curl/curl.h:2896:3: note: declared here
 2896 |   CURLINFO_PROTOCOL    CURL_DEPRECATED(7.85.0, "Use CURLINFO_SCHEME")
      |   ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Since both CURLINFO_SCHEME and CURLINFO_PROTOCOL were introduced in
the same curl version (7.52.0 [0][1]) we don't have to worry about
backwards compatibility.

[0] https://curl.se/libcurl/c/CURLINFO_SCHEME.html
[1] https://curl.se/libcurl/c/CURLINFO_PROTOCOL.html

(cherry picked from commit 2285c462eb)
(cherry picked from commit 4ab37502b3)
(cherry picked from commit c2be553868)
2023-01-28 00:50:04 +00:00
Lennart Poettering
3a9fe8e768 nspawn: guard acl_free() with a NULL check
Inspired by #25957 there's one other place where we don't guard
acl_free() calls with a NULL check.

Fix that.

(cherry picked from commit 34680637e8)
(cherry picked from commit 4dabf90526)
(cherry picked from commit d8b4ac7a17)
2023-01-28 00:50:04 +00:00
Sam James
0e711b7c06 tmpfiles: avoid null free() for acl attributes
When built with ACL support, we might be processing a tmpfiles
entry where there's no cause for us to call parse_acls_from_arg,
then we get to the end of parse_line without having ever populated
i.{acl_access, acl_default}.

Then we pass a null pointer into acl_free().

From UBSAN w/ GCC 13.0.0_pre20230101:
```
$ systemd-tmpfiles --clean
/var/tmp/portage/sys-apps/acl-2.3.1-r1/work/acl-2.3.1/libacl/acl_free.c:44:14: runtime error: applying non-zero offset 18446744073709551608 to null pointer
    #0 0x7f65d868b482 in acl_free /var/tmp/portage/sys-apps/acl-2.3.1-r1/work/acl-2.3.1/libacl/acl_free.c:44
    #1 0x55fe7e592249 in item_free_contents ../systemd-9999/src/tmpfiles/tmpfiles.c:2855
    #2 0x55fe7e5a347a in parse_line ../systemd-9999/src/tmpfiles/tmpfiles.c:3158
    #3 0x55fe7e5a347a in read_config_file ../systemd-9999/src/tmpfiles/tmpfiles.c:3897
    #4 0x55fe7e590c61 in read_config_files ../systemd-9999/src/tmpfiles/tmpfiles.c:3985
    #5 0x55fe7e590c61 in run ../systemd-9999/src/tmpfiles/tmpfiles.c:4157
    #6 0x55fe7e590c61 in main ../systemd-9999/src/tmpfiles/tmpfiles.c:4218
    #7 0x7f65d7ebe289  (/usr/lib64/libc.so.6+0x23289)
    #8 0x7f65d7ebe344 in __libc_start_main (/usr/lib64/libc.so.6+0x23344)
    #9 0x55fe7e591900 in _start (/usr/bin/systemd-tmpfiles+0x11900)
```

(cherry picked from commit 9f804ab04d)
(cherry picked from commit a11a949c43)
(cherry picked from commit 455193605d)
2023-01-28 00:50:04 +00:00
Lennart Poettering
33036c4032 sd-event: don't mistake USEC_INFINITY passed in for overflow
Let's pass USEC_INFINITY from sd_event_source_set_time_relative() to
sd_event_source_set_time() instead of raising EOVERFLOW.

We should raise EOVERFLOW only if your addition fails, but not if the
input already is USEC_INFINITY, since it's an entirely valid operation
to have an infinite time-out, and we should support that.

(cherry picked from commit ef8591951a)
(cherry picked from commit 9769d84fe5)
(cherry picked from commit 5fe49d0fb8)
2023-01-28 00:50:04 +00:00
Lennart Poettering
079bfa7d76 resolved: disable SO_BINDTOIFINDEX hack for localhost IP addresses
Fixes: #23010
(cherry picked from commit 5f9041afec)
(cherry picked from commit a0532ffd2f)
(cherry picked from commit 640acfb459)
2023-01-28 00:50:04 +00:00
Ludwig Nussel
652c6054f1 kernel-install: run depmod only if writeable
(cherry picked from commit dd003f1621)
(cherry picked from commit 8ec0142c13)
(cherry picked from commit 04d29e1c90)
2023-01-28 00:50:04 +00:00
Lennart Poettering
486f3f52f4 resolvectl: remove duplicate ':' from output
The second argument to dump_list() actually ends up in a TABLE_FIELD
cell now, where we implicitly append a ":". Hence drop it from the
strings.

Follow-up for: 37a50123fa

(cherry picked from commit ef503f1cec)
(cherry picked from commit c01cdcfb8a)
(cherry picked from commit 2ac8824885)
2023-01-28 00:50:04 +00:00
Lennart Poettering
582e5b764a resolved: downgrade inability to send varlink reply error message
Previously, if a client disconnected after sending a lookup request but
before waiting for the reply we'd log at LOG_ERR level. That's
confusing, since it's entirely OK for the client to lose interest.

Hence, let's downgrade to debug level.

Fixes: #25892
(cherry picked from commit 40557509be)
(cherry picked from commit a3ceaf0f1d)
(cherry picked from commit 51d6ffb854)
2023-01-28 00:50:04 +00:00
Cristian Rodríguez
e4ebc60774 libsystemd-network: FTBS in c2x mode
cannot pass false as argument because function wants a pointer to bool
instead, use NULL instead

(cherry picked from commit 2cc697d740)
(cherry picked from commit e78a1489a8)
(cherry picked from commit d857665a54)
2023-01-28 00:50:04 +00:00
Cristian Rodríguez
1825219d59 basic: Fix incompatible type for arguments errors in C2X
GCC-13 -std=gnu2x FTBS with:

error: incompatible type for argument 3 of ‘_hashmap_free’
(cherry picked from commit a4a1569ff1)
(cherry picked from commit 921bff2f85)
(cherry picked from commit db147b6d2b)
2023-01-28 00:50:04 +00:00
Cristian Rodríguez
560f05d95c basic: fix hosed return value in skip_session()
../src/basic/cgroup-util.c: In function ‘skip_session’:
../src/basic/cgroup-util.c:1241:32: error: incompatible types when returning type ‘_Bool’ but ‘const char *’ was expected
 1241 |                         return false;

(cherry picked from commit db8e720984)
(cherry picked from commit ad647734c7)
(cherry picked from commit 9ca9f95122)
2023-01-28 00:50:04 +00:00
Will Fancher
4dc2810d54 sysroot: Order systemd-fsck-root after systemd-makefs
(cherry picked from commit 0941ccae3c)
(cherry picked from commit addeb46993)
(cherry picked from commit 3fe7a6534c)
2023-01-28 00:50:04 +00:00
Jacek Migacz
f5edfc783b resolve: fix enumerator name for DNS search domain
(cherry picked from commit 8b23242989)
(cherry picked from commit ec82fdc645)
(cherry picked from commit 688bc823e2)
2023-01-28 00:50:04 +00:00
Michal Sekletar
d9960ebfdf units: allow systemd-userdbd to change process name
rename_process() requires CAP_SYS_RESOURCE so let's make sure it is in
our permitted set after execve() by adding in to the bounding set.

Previously,
systemd-userdbd.service - User Database Manager
     Loaded: loaded (/usr/lib/systemd/system/systemd-userdbd.service; indirect; preset: disabled)
     Active: active (running) since Mon 2022-12-19 17:07:21 CET; 17min ago
TriggeredBy: ● systemd-userdbd.socket
       Docs: man:systemd-userdbd.service(8)
   Main PID: 1880 (systemd-userdbd)
     Status: "Processing requests..."
      Tasks: 4 (limit: 2272)
     Memory: 5.2M
        CPU: 244ms
     CGroup: /system.slice/systemd-userdbd.service
             ├─1880 /usr/lib/systemd/systemd-userdbd
             ├─2270 systemd-userwork
             ├─2271 systemd-userwork
             └─2272 systemd-userwork

Now,
    Loaded: loaded (/usr/lib/systemd/system/systemd-userdbd.service; indirect; preset: disabled)
     Active: active (running) since Mon 2022-12-19 17:27:02 CET; 15s ago
TriggeredBy: ● systemd-userdbd.socket
       Docs: man:systemd-userdbd.service(8)
   Main PID: 2404 (systemd-userdbd)
     Status: "Processing requests..."
      Tasks: 4 (limit: 2272)
     Memory: 5.5M
        CPU: 89ms
     CGroup: /system.slice/systemd-userdbd.service
             ├─2404 /usr/lib/systemd/systemd-userdbd
             ├─2407 "systemd-userwork: waiting..."
             ├─2408 "systemd-userwork: waiting..."
             └─2409 "systemd-userwork: waiting..."

(cherry picked from commit d5e5bc2fe9)
(cherry picked from commit 9357d23429)
(cherry picked from commit 34f78e7e14)
2023-01-28 00:50:04 +00:00
Zbigniew Jędrzejewski-Szmek
0accce1b1c sd-event: never pass negative errnos as signalfd to signalfd
We treat any negative value as "invalid fd", but signalfd only
accepts -1.

(cherry picked from commit cbff793ffb)
(cherry picked from commit 54c840ea58)
(cherry picked from commit 4178457f0e)
2023-01-28 00:50:04 +00:00
David Tardon
f8201271fd swap: tell swapon to reinitialize swap if needed
If the page size of a swap space doesn't match the page size of the
currently running kernel, swapon will fail. Let's instruct it to
reinitialize the swap space instead.

(cherry picked from commit cc137d53e3)
(cherry picked from commit a0ac79bce9)
(cherry picked from commit 8be5a12c71)
2023-01-28 00:50:04 +00:00
jcg
0e96d07e8c mount-setup: don't need to mount /sys/fs/pstore if there is no ENABLE_PSTORE
(cherry picked from commit 5e5fce3e91)
(cherry picked from commit 613994c10b)
(cherry picked from commit 46a7e30cb9)
2023-01-28 00:50:04 +00:00
msizanoen1
a62fc7d66c core/slice: skip member units without realized cgroup during freeze or thaw
This ensures that services with `RemainAfterExit` but without any
process running won't cause failure during freeze.

(cherry picked from commit fcb0878f75)
(cherry picked from commit 2eb040f36f)
(cherry picked from commit 9a0bd2ff70)
2023-01-28 00:50:04 +00:00
Siddhesh Poyarekar
050a356d04 alloc-util: Disallow inlining of expand_to_usable
Explicitly set __attribute__ ((noinline)) so that the compiler does not
attempt to inline expand_to_usable, even with LTO.

(cherry picked from commit 4f79f545b3)
(cherry picked from commit e998c9d7c1)
(cherry picked from commit 4014688458)
2023-01-28 00:50:04 +00:00
Siddhesh Poyarekar
08cf315a04 Use dummy allocator to make accesses defined as per standard
systemd uses malloc_usable_size() everywhere to use memory blocks
obtained through malloc, but that is abuse since the
malloc_usable_size() interface isn't meant for this kind of use, it is
for diagnostics only.  This is also why systemd behaviour is flaky when
built with _FORTIFY_SOURCE.

One way to make this more standard (and hence safer) is to, at every
malloc_usable_size() call, also 'reallocate' the block so that the
compiler can see the larger size.  This is done through a dummy
reallocator whose only purpose is to tell the compiler about the larger
usable size, it doesn't do any actual reallocation.

Florian Weimer pointed out that this doesn't solve the problem of an
allocator potentially growing usable size at will, which will break the
implicit assumption in systemd use that the value returned remains
constant as long as the object is valid.  The safest way to fix that is
for systemd to step away from using malloc_usable_size() like this.

Resolves #22801.

(cherry picked from commit 7929e180aa)
(cherry picked from commit 34b9eddfc1)
(cherry picked from commit 70653ebeb6)
2023-01-28 00:50:04 +00:00