systemd/.git
3 years agotest-network: set xfrm interface ID
Yu Watanabe [Tue, 1 Feb 2022 04:26:40 +0000 (13:26 +0900)]
test-network: set xfrm interface ID

This also unifies two tests for xfrm, and checks the output of
'ip link' command.

Fixes #22329.

(cherry picked from commit 020483b248b45b15eb93d2ae322d7f211c61e44d)

3 years agonetwork: xfrm: refuse zero interface ID
Yu Watanabe [Tue, 1 Feb 2022 04:00:51 +0000 (13:00 +0900)]
network: xfrm: refuse zero interface ID

Since kernel 5.17-rc1, 5.16.3, and 5.15.17 (more specifically,
https://github.com/torvalds/linux/commit/8dce43919566f06e865f7e8949f5c10d8c2493f5)
the kernel refuses to create an xfrm interface with zero ID.

(cherry picked from commit fd11005951920a0cee96f0c56f36d9ff8bc66a41)

3 years agoexecute: document that the 'env' param is input *and* output
Lennart Poettering [Tue, 1 Feb 2022 12:50:28 +0000 (13:50 +0100)]
execute: document that the 'env' param is input *and* output

(cherry picked from commit 421bb42d1b366c00392ef5bbab6a67412295b6dc)

3 years agoexecute: line break comments a bit less aggressively
Lennart Poettering [Tue, 1 Feb 2022 12:50:13 +0000 (13:50 +0100)]
execute: line break comments a bit less aggressively

(cherry picked from commit cafc5ca147cb05b90bd731661d8594c299601f79)

3 years agoexecute: use _cleanup_ logic where appropriate
Lennart Poettering [Tue, 1 Feb 2022 12:49:56 +0000 (13:49 +0100)]
execute: use _cleanup_ logic where appropriate

(cherry picked from commit 46e5bbab5895b7137b03453dee08bd1c89c710e9)

3 years agopid1: pass PAM_DATA_SILENT to pam_end() in child
Lennart Poettering [Tue, 1 Feb 2022 11:37:51 +0000 (12:37 +0100)]
pid1: pass PAM_DATA_SILENT to pam_end() in child

Fixes: #22318
(cherry picked from commit 7feb2b5737ad110eb3985e8e9d8189f18d1c5147)

3 years agologin: use bus_error_message() at one more place
Yu Watanabe [Sat, 29 Jan 2022 20:38:35 +0000 (05:38 +0900)]
login: use bus_error_message() at one more place

(cherry picked from commit 80c8c786a314bceba180fac5506e72aa48c0764a)

3 years agocore/unit: use bus_error_message() at one more place
Yu Watanabe [Sat, 29 Jan 2022 20:38:01 +0000 (05:38 +0900)]
core/unit: use bus_error_message() at one more place

(cherry picked from commit 33322185554799b08e94aca036dd109aaee52408)

3 years agobus-util: retrieve bus error from message
Yu Watanabe [Sat, 29 Jan 2022 20:36:56 +0000 (05:36 +0900)]
bus-util: retrieve bus error from message

The error in argument is not input, but used for output.

(cherry picked from commit 853b94863cf26d084454edd63ce987cc7ab0505a)

3 years agoboot: Don't require a machine ID to be available
Daan De Meyer [Fri, 28 Jan 2022 15:40:09 +0000 (15:40 +0000)]
boot: Don't require a machine ID to be available

Regression introduced in https://github.com/systemd/systemd/pull/21807.

Fixes #22224

(cherry picked from commit 17e2e8073f3d387035595fcf6c3aa27acb24e2dc)

3 years agocore: don't fail on EEXIST when creating mount point
Luca Boccassi [Fri, 28 Jan 2022 22:56:10 +0000 (22:56 +0000)]
core: don't fail on EEXIST when creating mount point

systemd[1016]: Failed to mount /tmp/app1 (type n/a) on /run/systemd/unit-extensions/1 (MS_BIND ): No such file or directory
systemd[1016]: Failed to create destination mount point node '/run/systemd/unit-extensions/1': File exists

(cherry picked from commit 9d6d4c305ab8d65aab7f546450d7331f760b7259)

3 years agobasic: update CIFS magic
Frantisek Sumsal [Sun, 30 Jan 2022 22:40:05 +0000 (23:40 +0100)]
basic: update CIFS magic

Kernel commit dea2903719283c156b53741126228c4a1b40440f exposed (and
renamed) CIFS_MAGIC_NUMBER as CIFS_SUPER_MAGIC along with
SMB2_SUPER_MAGIC.

This fixes the following build fail on current Fedora Rawhide:
```
../src/basic/meson.build:389:8: ERROR: Problem encountered: found unknown filesystem(s) defined in kernel headers:

Filesystem found in kernel header but not in filesystems-gperf.gperf: CIFS_SUPER_MAGIC
Filesystem found in kernel header but not in filesystems-gperf.gperf: SMB2_SUPER_MAGIC
```

(cherry picked from commit bbe53713455be38c0a587626439fd171f28c77fc)

3 years agosd-dhcp-lease: fix a memory leak in dhcp_lease_parse_search_domains
Evgeny Vereshchagin [Sat, 29 Jan 2022 03:16:40 +0000 (03:16 +0000)]
sd-dhcp-lease: fix a memory leak in dhcp_lease_parse_search_domains

=================================================================
==81071==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x51245c in __interceptor_reallocarray (/home/vagrant/systemd/build/fuzz-dhcp-client+0x51245c)
    #1 0x7f01440c67e6 in strv_push /home/vagrant/systemd/build/../src/basic/strv.c:435:13
    #2 0x7f01440ca9e1 in strv_consume /home/vagrant/systemd/build/../src/basic/strv.c:506:13
    #3 0x7f01440ca9e1 in strv_extend /home/vagrant/systemd/build/../src/basic/strv.c:558:16
    #4 0x5806e3 in dhcp_lease_parse_search_domains /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-lease.c:900:21
    #5 0x57c1be in dhcp_lease_parse_options /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-lease.c:727:21
    #6 0x572450 in parse_options /home/vagrant/systemd/build/../src/libsystemd-network/dhcp-option.c:348:33
    #7 0x571c6a in dhcp_option_parse /home/vagrant/systemd/build/../src/libsystemd-network/dhcp-option.c:376:13
    #8 0x559a01 in client_handle_offer /home/vagrant/systemd/build/../src/libsystemd-network/sd-dhcp-client.c:1543:13
    #9 0x5592bd in LLVMFuzzerTestOneInput /home/vagrant/systemd/build/../src/libsystemd-network/fuzz-dhcp-client.c:74:16
    #10 0x44a379 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x44a379)
    #11 0x42ae1f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x42ae1f)
    #12 0x432ade in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/build/fuzz-dhcp-client+0x432ade)
    #13 0x421f86 in main (/home/vagrant/systemd/build/fuzz-dhcp-client+0x421f86)
    #14 0x7f0142fff55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)

(cherry picked from commit 9591c0a8b3496d0e5cbbfe7c75161ba80089c143)

3 years agotests: add a file triggering a memory leak in dhcp_lease_parse_search_domains
Evgeny Vereshchagin [Sat, 29 Jan 2022 03:18:31 +0000 (03:18 +0000)]
tests: add a file triggering a memory leak in dhcp_lease_parse_search_domains

(cherry picked from commit 998ec39b1d20a40453a3b47f7eb68feacefd65d9)

3 years agosd-dhcp-lease: fix an infinite loop found by the fuzzer
Evgeny Vereshchagin [Sat, 29 Jan 2022 02:08:39 +0000 (02:08 +0000)]
sd-dhcp-lease: fix an infinite loop found by the fuzzer

(cherry picked from commit 86b06c666be8b7afb45541d35aa4d0ecb38056d1)

3 years agobasic: mac_[selinux,smack]_apply_fd does not work when applying labels
Donald Chan [Fri, 28 Jan 2022 22:53:46 +0000 (22:53 +0000)]
basic: mac_[selinux,smack]_apply_fd does not work when applying labels

Commit a7fdc6c introduced a regression where file descriptors are opened
using O_PATH option. mac_smack_apply_fd() calls fsetxattr() and would fail
with a -EBADF (Bad file descriptor) error.

Use FORMAT_PROC_FD_PATH(fd) to convert the fd back into a full path and
call setxattr() or setfilecon() instead.

Signed-off-by: Donald Chan <hoiho@amazon.com>
(cherry picked from commit a718364e9d9242cc2111c9860f2ab5bb9bb26db9)

3 years agosd-dhcp-server: refuse too large packet to send
Yu Watanabe [Fri, 28 Jan 2022 02:53:49 +0000 (11:53 +0900)]
sd-dhcp-server: refuse too large packet to send

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44134.

(cherry picked from commit 71df50a9734f7006bc1ac8be59ca81c797b39c35)

3 years agologind.conf: Fix name of option: RuntimeDirectoryInodes -> RuntimeDirectoryInodesMax
Arfrever Frehtes Taifersar Arahesis [Thu, 27 Jan 2022 00:00:00 +0000 (00:00 +0000)]
logind.conf: Fix name of option: RuntimeDirectoryInodes -> RuntimeDirectoryInodesMax

(cherry picked from commit a42a93830fcc18da073a5ac06f93c386efc9109d)

3 years agocore/namespace: s/normalize_mounts()/drop_unused_mounts()
Christian Brauner [Mon, 24 Jan 2022 09:12:57 +0000 (10:12 +0100)]
core/namespace: s/normalize_mounts()/drop_unused_mounts()

Rename the normalize_mounts() helper to drop_unused_mounts. All the
helpers called in there get rid of mounts that are unused for a variety
of reasons. And whereas the helpers are aptly prefixed with "drop" the
overall helper isn't and instead uses "normalize".

Make it more obvious what the helper actually does by renaming it from
normalize_mounts() to drop_unused_mounts(). Readers of code calling this
helper will immediately see that it will get rid of unused mounts.

Link: https://github.com/systemd/systemd/issues/22206
(cherry picked from commit fbf90c0d5cadc5d1e95485f770f45a7d4cd39daa)

3 years agocore/namespace: allow using ProtectSubset=pid and ProtectHostname=true together
Christian Brauner [Fri, 21 Jan 2022 12:08:19 +0000 (13:08 +0100)]
core/namespace: allow using ProtectSubset=pid and ProtectHostname=true together

If a service requests both ProtectSubset=pid and ProtectHostname=true
then it will currently fail to start. The ProcSubset=pid option
instructs systemd to mount procfs for the service with subset=pid which
hides all entries other than /proc/<pid>. Consequently trying to
interact with the two files /proc/sys/kernel/{hostname,domainname}
covered by ProtectHostname=true will fail.

Fix this by only performing this check when ProtectSubset=pid is not
requested. Essentially ProtectSubset=pid implies/provides
ProtectHostname=true.

(cherry picked from commit 1361f015773e3b4d74e382edf1565f3315a3396b)

3 years agosd-event: workaround maybe-uninitalized warning in sd_event_add_inotify()
Thomas Haller [Sat, 22 Jan 2022 14:02:04 +0000 (15:02 +0100)]
sd-event: workaround maybe-uninitalized warning in sd_event_add_inotify()

With LTO, the compiler might think that the variable is uninitialized
(from NetworkManager's fork, with gcc-11.2.1-1.fc35):

    src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c: In function 'sd_event_add_inotify':
    src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c:2120: error: 's' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     2120 |                 *ret = s;
          |
    src/libnm-systemd-core/src/libsystemd/sd-event/sd-event.c:2102: note: 's' was declared here
     2102 |         sd_event_source *s;
          |
    lto1: all warnings being treated as errors

In particular, that would happen for codepaths where event_add_inotify_fd_internal()
returns `-errno`, and the compiler cannot be sure that the returned value will
be negative. Technically, the compiler is right, but we rely on libc functions
to set errno correctly, so this only happens in code paths, where something
bad already happend.

While LTO is prone to such false warnings, we are largely able to build systemd
without warnings. So it is feasible and we should make the effort of working
around warnings as they appear.

(cherry picked from commit 2091c779314133d8a4b68283b255d7388a5ec5ff)

3 years agoFix journald audit logging with fields > N_IOVEC_AUDIT_FIELDS.
YmrDtnJu [Fri, 21 Jan 2022 17:21:27 +0000 (18:21 +0100)]
Fix journald audit logging with fields > N_IOVEC_AUDIT_FIELDS.

ELEMENTSOF(iovec) is not the correct value for the newly introduced parameter m
to function map_all_fields because it is the maximum number of elements in the
iovec array, including those reserved for N_IOVEC_META_FIELDS. The correct
value is the current number of already used elements in the array plus the
maximum number to use for fields decoded from the kernel audit message.

(cherry picked from commit df4ec48f45f518b6926e02ef4d77c8ed1a8b4e2c)

3 years agoudevadm: cleanup-db: don't delete information for kept db entries
Martin Wilck [Thu, 20 Jan 2022 13:31:45 +0000 (14:31 +0100)]
udevadm: cleanup-db: don't delete information for kept db entries

devices with the db_persist property won't be deleted during database
cleanup. This applies to dm and md devices in particular.
For such devices, we should also keep the files under /run/udev/links,
/run/udev/tags, and /run/udev/watch, to make sure that after restart,
udevd has the same information about the devices as it did before
the cleanup.

If we don't do this, a lower-priority device that is discovered in
the coldplug phase may take over symlinks from a device that persisted.
Not removing the watches also enables udevd to resume watching a device
after restart.

Signed-off-by: Martin Wilck <mwilck@suse.com>
(cherry picked from commit 7ec624147a41d80f8e492c9fe19a24e2cda58c25)

3 years agoudevadm: cleanup_dir: use dot_or_dot_dot()
Martin Wilck [Fri, 21 Jan 2022 09:44:26 +0000 (10:44 +0100)]
udevadm: cleanup_dir: use dot_or_dot_dot()

which is safer than just checking dent[0].
Also, fix two style issues.

(cherry picked from commit 28d6e8545151d413f8614db9fa790f9f9edbb045)

3 years agooomd: handle situations when no cgroups are killed
Anita Zhang [Wed, 19 Jan 2022 21:26:01 +0000 (13:26 -0800)]
oomd: handle situations when no cgroups are killed

Currently if systemd-oomd doesn't kill anything in a selected cgroup, it
selects a new candidate immediately. But if a selected cgroup wasn't killed,
it is likely due to it disappearing or getting cleaned up between the time
it was selected as a candidate and getting sent SIGKILL(s). We should handle
it as though systemd-oomd did perform a kill so that it will check
swap/pressure again before it tries to select a new candidate.

(cherry picked from commit 914d4e99f43761f1ce77b520850cf096aa5196cd)

3 years agooomd: fix race with path unavailability when killing cgroups
Anita Zhang [Wed, 19 Jan 2022 18:40:46 +0000 (10:40 -0800)]
oomd: fix race with path unavailability when killing cgroups

There can be a situation where systemd-oomd would kill all of the processes
in a cgroup, pid1 would clean up that cgroup, and systemd-oomd would get
ENODEV trying to iterate the cgroup a final time to ensure it was empty.
systemd-oomd sees this as an error and immediately picks a new candidate even
though pressure may have recovered. To counter this, check and handle
path unavailability errnos specially.

Fixes: #22030
(cherry picked from commit 2ee209466bb51f39ae9df7fec4d5594ce8cfa3f0)

3 years agoresolve: fix assertion triggered when r == 0
Yu Watanabe [Wed, 19 Jan 2022 20:24:31 +0000 (05:24 +0900)]
resolve: fix assertion triggered when r == 0

Fixes #22178.

(cherry picked from commit 98b1eb711cfc70776fefd3d4ec437a6a4f9aeff2)

3 years agocore: refuse to mount ExtensionImages if the base layer doesn't at least have ID...
Luca Boccassi [Wed, 19 Jan 2022 00:08:57 +0000 (00:08 +0000)]
core: refuse to mount ExtensionImages if the base layer doesn't at least have ID in os-release

We can't match an extension if we don't at least have an ID,
so refuse to continue

(cherry picked from commit 78ab2b5064a0f87579ce5430f9cb83bba0db069a)

3 years agodissect-image: validate extension-release even if the host has only ID in os-release
Luca Boccassi [Wed, 19 Jan 2022 00:01:48 +0000 (00:01 +0000)]
dissect-image: validate extension-release even if the host has only ID in os-release

A rolling distro won't set VERSION_ID or SYSEXT_LEVEL in os-release,
which means we skip validation of ExtensionImages.
Validate even with just an ID, the lower level helper already
recognizes and accepts this use case.

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

(cherry picked from commit 37361f46d571ad0b71ef99dec6a9b76edbab38bb)

3 years agosysext: use LO_FLAGS_PARTSCAN when opening image
Luca Boccassi [Wed, 19 Jan 2022 00:27:45 +0000 (00:27 +0000)]
sysext: use LO_FLAGS_PARTSCAN when opening image

Jan 17 12:34:59 myguest1 (sd-sysext)[486]: Device '/var/lib/extensions/myext.raw' is loopback block device with partition scanning turned off, please turn it on.

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

(cherry picked from commit 70a5c6dce0872b3bb0a39be250adde86a0c8f35c)

3 years agonetwork: dhcp6: do not request address if UseAddress=no
Yu Watanabe [Tue, 11 Jan 2022 11:56:40 +0000 (20:56 +0900)]
network: dhcp6: do not request address if UseAddress=no

Fixes #22068.

(cherry picked from commit d5f8fd5b00e938710b5e80396f8b3fab59dd6d00)

3 years agoboot: Only build with debug symbols in developer mode
Jan Janssen [Fri, 21 Jan 2022 17:34:04 +0000 (18:34 +0100)]
boot: Only build with debug symbols in developer mode

The debug symbols are of very limited use in proper deployments
unlike with regular userspace. Unless someone goes through the pain
of setting up an EFI debugger (assuming their firmware even supports
this in the first place) any provided debug symbols will just be
useless.
Debugging under QEMU is possible, but even then it is non-trivial
to set up, so anyone willing to go that far can just build in
developer mode.

Meanwhile, at least x86 firmware tends to refuse binaries that contain
debug symbols. We do strip the files when converted to PE anyway, but
the elf file needs to stay around on other arches as objcopy does not
support PE as input there.

Also, the generated debug symbols seem to be not reproducible when
building with LTO. Whether this is an issue in tooling or our side
is unclear. This works around this issue.

Fixes: #22157
(cherry picked from commit 76fb85316e9c629b79762457d9515cb632112a6a)

3 years agoboot: Use -ffile-prefix-map when present
Jan Janssen [Wed, 19 Jan 2022 15:37:25 +0000 (16:37 +0100)]
boot: Use -ffile-prefix-map when present

This should make sure the stub elf binary is reproducible.

Fixes: #22157
(cherry picked from commit 1bc8417cfeeebb48b16039f26e0c75937784e75e)

3 years agomeson: Use files() for source lists for boot and fundamental
Jan Janssen [Fri, 7 Jan 2022 20:55:50 +0000 (21:55 +0100)]
meson: Use files() for source lists for boot and fundamental

This fixes build reproducibility as otherwise the full path
of the source files ends up in the output binary.

(cherry picked from commit b3c5a7074cd434bc02c4b560afe933d3df24759e)

3 years agoboot: Build BCD parser only on arches supported by Windows
Jan Janssen [Tue, 28 Dec 2021 12:10:39 +0000 (13:10 +0100)]
boot: Build BCD parser only on arches supported by Windows

(cherry picked from commit 77fcf28cb88b302453b4c991a6571cb37f10634d)

3 years agomeson: move efi file lists closer to where they are used
Zbigniew Jędrzejewski-Szmek [Thu, 23 Dec 2021 11:55:40 +0000 (12:55 +0100)]
meson: move efi file lists closer to where they are used

The goal is to have the detection of features and paths done first, and
then the build target constructions second.

(cherry picked from commit 65dcf9f9a0d877de0dc53558547462a7f1750c78)

3 years agopid1,cgroup-show: ignore -EOPNOTSUPP in cg_read_pid() v250.3
Yu Watanabe [Wed, 12 Jan 2022 15:09:38 +0000 (00:09 +0900)]
pid1,cgroup-show: ignore -EOPNOTSUPP in cg_read_pid()

The function is called in recursion, and cgroup.procs in some subcgroups
may not be read.

Fixes #22089.

(cherry picked from commit 1fb50408ce23e67e0be94ead69c891d26b4823e2)

3 years agostdio-bridge: make the error more straightforward
Zbigniew Jędrzejewski-Szmek [Mon, 17 Jan 2022 10:44:44 +0000 (11:44 +0100)]
stdio-bridge: make the error more straightforward

(cherry picked from commit a80f17844ef1d7c622d17cb4b41eb337d438fffb)

3 years agokernel-install: also remove modules.builtin.alias.bin
Yu Watanabe [Fri, 14 Jan 2022 18:37:40 +0000 (03:37 +0900)]
kernel-install: also remove modules.builtin.alias.bin

Fixes RHBZ#2016630.

(cherry picked from commit 06006691b5c56b6123044179d934b3ed81c237ca)

3 years agoman: enhance the description of systemd-stdio-bridge
Zbigniew Jędrzejewski-Szmek [Mon, 17 Jan 2022 10:43:48 +0000 (11:43 +0100)]
man: enhance the description of systemd-stdio-bridge

I hope that this fixes the comment
https://github.com/systemd/systemd/pull/22141#issuecomment-1013960371
> As someone who doesn't know what this prog does

The listing in the man page is sorted according to logical
use: all the options setting the address are now together.

(cherry picked from commit b7bb58ef70b0c876941a1c31ed4e2f5f1dc5ed0e)

3 years agosystemd-stdio-bridge: add manpage
Luca Boccassi [Sun, 16 Jan 2022 18:41:10 +0000 (18:41 +0000)]
systemd-stdio-bridge: add manpage

(cherry picked from commit cf18de1b265d06b8f72646a11a469e1191826030)

3 years agoman: change 'allow[s] to' -> 'allow[s] one to'
Luca Boccassi [Sun, 16 Jan 2022 12:44:52 +0000 (12:44 +0000)]
man: change 'allow[s] to' -> 'allow[s] one to'

Lintian is opinionated about this and we get nagged

(cherry picked from commit 6eed65d455e9e76b020acbd858c20eafa43cebf8)

3 years agocore: add missing dependency DBus properties
Yu Watanabe [Sun, 16 Jan 2022 06:32:27 +0000 (15:32 +0900)]
core: add missing dependency DBus properties

Follow-up for 0bc488c99ab2ed3464237607e381f4d72cd321d5.

Also sort dependency properties to make them match the definition of
`enum UnitDependency` in basic/unit-def.h.

Fixes #22133.

(cherry picked from commit adc1b76c30940da2f3fb11275f5b0e54ebbcd7f1)

3 years agocore: update log message
Yu Watanabe [Sun, 16 Jan 2022 11:19:19 +0000 (20:19 +0900)]
core: update log message

Fixes CID#1469009.

(cherry picked from commit cc8943b84ad5ffb6d327404ff577d9d185a5c316)

3 years agonetwork: wireguard: also accept negative boolean values to disable adding routes
Yu Watanabe [Sun, 16 Jan 2022 06:59:45 +0000 (15:59 +0900)]
network: wireguard: also accept negative boolean values to disable adding routes

RouteTable=off was introduced to provide consistency with wg-quick
command. This makes the RouteTable= settings accepts other negative
boolean values.

(cherry picked from commit e135559d805e749a0a1f8d1396cf71f6edd94831)

3 years agonetwork: wireguard: do not add routes to AllowedIPs= by default
Yu Watanabe [Sun, 16 Jan 2022 06:53:13 +0000 (15:53 +0900)]
network: wireguard: do not add routes to AllowedIPs= by default

As setting such routes may break existing setups.

Closes #21964.

(cherry picked from commit cfe1237f3859c0cb19b98a47870f49942d5537d9)

3 years agosd-device: silence gcc warning with newest gcc
Zbigniew Jędrzejewski-Szmek [Sat, 15 Jan 2022 12:38:30 +0000 (13:38 +0100)]
sd-device: silence gcc warning with newest gcc

(cherry picked from commit 376ee2c312b87951028a0adff96b1052f32475fa)

3 years agojournal: Fix entry array iteration corruption checks
Daan De Meyer [Wed, 12 Jan 2022 18:10:54 +0000 (18:10 +0000)]
journal: Fix entry array iteration corruption checks

Previously, we'd try to handle corruption by bumping the index even
if it was an entry array object that was corrupted (which we can't
deal with).

Now, we only try to deal with corrupted entry objects by moving the
corruption handling into generic_array_get().

On top, we also add an additional check for -EADDRNOTAVAIL which can
also be caused by corrupted journal data.

(cherry picked from commit 8d801e35cb155faa08235a5af8b4d6ad60715837)

3 years agojournal: Remove unused arguments from journal_file_next_entry_for_data()
Daan De Meyer [Wed, 12 Jan 2022 17:31:57 +0000 (17:31 +0000)]
journal: Remove unused arguments from journal_file_next_entry_for_data()

(cherry picked from commit f2eceb5268f0d26d53db5f9dad318dd45fd900bd)

3 years agoman: Add more details about desktop file processing
Benjamin Berg [Thu, 13 Jan 2022 17:47:08 +0000 (18:47 +0100)]
man: Add more details about desktop file processing

In particular, mention the contract the generator has with external
ExecCondition= binaries that may be provided by desktop environments.

But, also mention all the other relevant keys. In particular
X-systemd-skip= is important to be documented.

(cherry picked from commit 048d46999995847095e3b7a513ba0627e0179dec)

3 years agoboot: Don't try to free loaded_image
Jan Janssen [Thu, 13 Jan 2022 13:29:46 +0000 (14:29 +0100)]
boot: Don't try to free loaded_image

EFI_LOADED_IMAGE is a protocol pointer and thus, we shouldn't try
to free it.

(cherry picked from commit acd28f39126289dd0cb76efc79def673c27c4d04)

3 years agoboot: Fix invalid free
Jan Janssen [Thu, 13 Jan 2022 11:32:07 +0000 (12:32 +0100)]
boot: Fix invalid free

LocateDevicePath() advances the device path pointer, making it invalid
when freed.

(cherry picked from commit 41b74a18b2879e37b1e084f7ab6bd276ce30c6c9)

3 years agotest: add testcase for broken NTP server option
Yu Watanabe [Thu, 13 Jan 2022 11:19:46 +0000 (20:19 +0900)]
test: add testcase for broken NTP server option

For issue #22099.

(cherry picked from commit 95c514e9a50925e3c85f3c3e510fd31caffd5c57)

3 years agotest: voidify test functions
Yu Watanabe [Thu, 13 Jan 2022 09:55:51 +0000 (18:55 +0900)]
test: voidify test functions

This also drops unnecessary arguments, and unbreak several lines.

(cherry picked from commit 37408dd2644e5c337774ccb02f2fc9c31aabeefe)

3 years agosd-dhcp6-client: expose client_parse_message()
Yu Watanabe [Thu, 13 Jan 2022 11:19:01 +0000 (20:19 +0900)]
sd-dhcp6-client: expose client_parse_message()

To introduce tests for the function in later commits.

(cherry picked from commit 16de849fd866c9b75b269ed902c7d591df983174)

3 years agosd-dhcp6-client: ignore broken non-critical options
Yu Watanabe [Thu, 13 Jan 2022 11:13:03 +0000 (20:13 +0900)]
sd-dhcp6-client: ignore broken non-critical options

The commit b89a3758e92894162e3c2dcb594a55acff3274d5 made the validity
check of the received message stricter. E.g. if the client received a
message with broken NTP server option, then the entire message is
dropped.

This relaxes the check. If some non-critical options are broken, then
ignore the options, but the message itself is still accepted.

Fixes #22099.

(cherry picked from commit 0ac9daa4a169f627f5b3f85a4cdcdbd2c2b2e2ca)

3 years agojournal: Don't discard -b arg when followed by -e
Daan De Meyer [Thu, 13 Jan 2022 13:26:25 +0000 (13:26 +0000)]
journal: Don't discard -b arg when followed by -e

Allowing -e to be used to view the last logs of a previous boot seems
like a useful feature so let's not discard -b options anymore when
followed by -e.

Fixes #22107

(cherry picked from commit 4d6455c0754e31ddc9590c7b9c9a373d82ec0ed4)

3 years agojournal: Skip data objects with invalid offsets
Daan De Meyer [Wed, 12 Jan 2022 14:44:50 +0000 (14:44 +0000)]
journal: Skip data objects with invalid offsets

We already skip invalid objects, but don't yet skip invalid offsets.
Let's skip these as well to improve robustness when we're dealing with
corrupted journals.

Before:

```
➜  systemd git:(main) build/journalctl -r -n 5 --file ~/Downloads/system@0005d2b275abaaf8-f243a2818cb39b98.journal_
Failed to get journal fields: Cannot assign requested address
-- No entries --
```

After:

```
➜  systemd git:(main) ✗ build/journalctl -r -n 5 --file ~/Downloads/system@0005d2b275abaaf8-f243a2818cb39b98.journal_
Dec 09 08:32:38 snowball3 NetworkManager[911]: <info>  [1639038758.1464] device (wlp1s0): supplicant interface state: scanning -> authenticating
Dec 09 08:32:38 snowball3 kernel: wlp1s0: send auth to ec:a9:40:79:fb:ad (try 1/3)
Dec 09 08:32:38 snowball3 kernel: wlp1s0: authenticate with ec:a9:40:79:fb:ad
Dec 09 08:32:38 snowball3 wpa_supplicant[1003]: wlp1s0: SME: Trying to authenticate with ec:a9:40:79:fb:ad (SSID='UPC949397B' freq=5500 MHz)
```

(cherry picked from commit df207ccb7be02b1ca6bdd0a2066a898e5b24ee86)

3 years agoxdg-autostart-service: Ignore missing desktop-sepcific condition binary
Benjamin Berg [Mon, 10 Jan 2022 11:35:46 +0000 (12:35 +0100)]
xdg-autostart-service: Ignore missing desktop-sepcific condition binary

If a desktop specific ExecCondition= binary does not exist, this just
means that the desktop environment is not available. As such, it is not
an error condition that should prevent the service from being installed
in the .wants target.

Fix this by simply returning zero.

(cherry picked from commit 6d0aef1dd15088e7379681b3bd93c3cb450f3c55)

3 years agoman+docs: adjust links to the new page
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 10:32:53 +0000 (11:32 +0100)]
man+docs: adjust links to the new page

(cherry picked from commit 717e92ceb96471251f8242ad4f4c45cc2c68ecc9)

3 years agopolicy files: adjust landing page link
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:42:22 +0000 (10:42 +0100)]
policy files: adjust landing page link

(cherry picked from commit d6e2c1ab7158d52425d3cb72459c5624db12368c)

3 years agodocs: use https:// for fd.o links
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:39:00 +0000 (10:39 +0100)]
docs: use https:// for fd.o links

(cherry picked from commit 931bc1957b13817fcb0ffe69958dd562202c8e4c)

3 years agoREADME: link to the new page
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:33:57 +0000 (10:33 +0100)]
README: link to the new page

Lennart's blog is now mostly of historical interest, and the wiki
landing page has been replaced by systemd.io.

(cherry picked from commit 2777a4a3bfe153cb675d3d66b383a26043c187b8)

3 years agoNEWS: adjust links to moved pages
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jan 2022 09:33:10 +0000 (10:33 +0100)]
NEWS: adjust links to moved pages

All those pages contain a redirect at the top of the page, so it doesn't
make much sense to tell people to take the detour. Linking directly will
also increase the search rankings of the new pages.

(cherry picked from commit a794a4d87219367e8b24469fcafce83a9f224080)

3 years agofix test-string-util failed when locale is not utf8
yangmingtai [Tue, 11 Jan 2022 12:22:11 +0000 (20:22 +0800)]
fix test-string-util failed when locale is not utf8

(cherry picked from commit 647082cf7f07a87c65601626e86c3ed9f78fb387)

3 years agonss: only read logging config from environment variables
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 12:36:39 +0000 (13:36 +0100)]
nss: only read logging config from environment variables

log_parse_environment() uses should_parse_proc_cmdline() to determine whether
it should parse settings from the kernel command line. But the checks that
should_parse_proc_cmdline() apply to the whole process, and we could get a positive
answer also when log_parse_environment() was called from one of the nss modules.
In case of nss-modules, we don't want to look at the kernel command line.

log_parse_environment_variables() that only looks at the environment variables
is split out and used in the nss modules.

Fixes #22020.

(cherry picked from commit a7d15a24659770b0fa9f4cd26fc7bbb17765cbb7)

3 years agonss: drop dummy setup_logging() helpers
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 12:23:27 +0000 (13:23 +0100)]
nss: drop dummy setup_logging() helpers

log_parse_environment() stopped being a macro in 9fdee66f2d9.
As reported by @bauen1 in https://github.com/systemd/systemd/issues/22020,
the comment was out of date.

(cherry picked from commit 56a5f4969b96529c82ec8cc08db4fa8e9c61e7b9)

3 years agobootctl: do not update sd-boot if it wasn't installed in the first place
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 09:56:50 +0000 (10:56 +0100)]
bootctl: do not update sd-boot if it wasn't installed in the first place

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

(cherry picked from commit 49927ad81313b77eab09749520d20a8f4ba7cc96)

3 years agobootctl: split out the check whether sd-boot is installed
Zbigniew Jędrzejewski-Szmek [Tue, 11 Jan 2022 09:49:37 +0000 (10:49 +0100)]
bootctl: split out the check whether sd-boot is installed

(cherry picked from commit d9f048b5d113b85b65093f582a8153f79110c49e)

3 years agosd-bus/man: document EBUSY error in bus_message_read (#21954)
lincoln auster [Tue, 11 Jan 2022 10:47:31 +0000 (03:47 -0700)]
sd-bus/man: document EBUSY error in bus_message_read (#21954)

* sd-bus/man: document EBUSY error in bus_message_read

The EBUSY error can be returned from sd_bus_exit_container(), and, if
that happens, it will be propogated upwards towards bus_message_read. In
terms of documentation, this means that bus_message_read's man page
can't just include the error text for sd_bus_message_read_basic, as
reading basic types exclusively doesn't have the potential for this
error.

sd_bus_message_read_basic's error documentation isn't incorrect when
applied to sd_bus_message_read, it's just incomplete.  While EBUSY is
documented in sd_bus_message_open_container.xml,
it's explanation is unique to the sd_bus_message_exit_container function
and makes for poor documentation of the general read API.

(cherry picked from commit a1a03fa54bfb45315eefaa49ceb38a21aceafde8)

3 years agoboot: Fix readdir_harder() on VirtualBox
Jan Janssen [Mon, 10 Jan 2022 10:16:26 +0000 (11:16 +0100)]
boot: Fix readdir_harder() on VirtualBox

Fixes: #22073
(cherry picked from commit ed3abbfbde674bd163cb1c64d9e31dd24e352f85)

3 years agobpf: fix bpf_can_link_lsm_program condition v250.2
Julia Kartseva [Mon, 10 Jan 2022 05:35:35 +0000 (21:35 -0800)]
bpf: fix bpf_can_link_lsm_program condition

Since bpf_can_link_lsm_program return value is boolean, the expression
`r < 0` is always false.

(cherry picked from commit ccfc534deed2f3873c967851497af10d8a1ee01c)

3 years agobpf: check if lsm link ptr is libbpf error
Julia Kartseva [Fri, 7 Jan 2022 23:02:57 +0000 (15:02 -0800)]
bpf: check if lsm link ptr is libbpf error

BPF_RAW_TRACEPOINT_OPEN is expected to work only on x86 and x86_64,
since BPF trampoline is implemented only on these architectures.

Attach probing by bpf_program__attach_lsm already happens in
`bpf_lsm_supported`. The resulting pointer can store libbpf error and
that is the case for unsupported architectures.
Add libbpf error check to `bpf_lsm_supported` so execution does not
reach the point where unit startup fails.

(cherry picked from commit f409aa5c6363144c9711226319614f3b248d9828)

3 years agoshared/rm-rf: loop over nested directories instead of instead of recursing
Zbigniew Jędrzejewski-Szmek [Tue, 30 Nov 2021 21:29:05 +0000 (22:29 +0100)]
shared/rm-rf: loop over nested directories instead of instead of recursing

To remove directory structures, we need to remove the innermost items first,
and then recursively remove higher-level directories. We would recursively
descend into directories and invoke rm_rf_children and rm_rm_children_inner.
This is problematic when too many directories are nested.

Instead, let's create a "TODO" queue. In the the queue, for each level we
hold the DIR* object we were working on, and the name of the directory. This
allows us to leave a partially-processed directory, and restart the removal
loop one level down. When done with the inner directory, we use the name to
unlinkat() it from the parent, and proceed with the removal of other items.

Because the nesting is increased by one level, it is best to view this patch
with -b/--ignore-space-change.

This fixes CVE-2021-3997, https://bugzilla.redhat.com/show_bug.cgi?id=2024639.
The issue was reported and patches reviewed by Qualys Team.
Mauro Matteo Cascella and Riccardo Schirone from Red Hat handled the disclosure.

(cherry picked from commit 5b1cf7a9be37e20133c0208005274ce4a5b5c6a1)

3 years agoshared/rm_rf: refactor rm_rf() to shorten code a bit
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 15:56:42 +0000 (16:56 +0100)]
shared/rm_rf: refactor rm_rf() to shorten code a bit

(cherry picked from commit 84ced330020c0bae57bd4628f1f44eec91304e69)

3 years agoshared/rm_rf: refactor rm_rf_children_inner() to shorten code a bit
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 14:55:45 +0000 (15:55 +0100)]
shared/rm_rf: refactor rm_rf_children_inner() to shorten code a bit

(cherry picked from commit 3bac86abfa1b1720180840ffb9d06b3d54841c11)

3 years agosystemctl: Fix --show timestamp
Ludwig Nussel [Tue, 4 Jan 2022 09:03:49 +0000 (10:03 +0100)]
systemctl: Fix --show timestamp

(cherry picked from commit 2dbb54788ee8d4c3d84e1af309335ad3c3885f1a)

3 years agoboot-timestamps: Discard firmware init time when running in a VM
Jan Janssen [Sun, 9 Jan 2022 13:22:15 +0000 (14:22 +0100)]
boot-timestamps: Discard firmware init time when running in a VM

Fixes: #22060
(cherry picked from commit f699bd81e8e18da2d2fc11e7fb7dce95f8bb3f9e)

3 years agobpf: actually skip RestrictFileSystems= when not supported
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 18:24:49 +0000 (19:24 +0100)]
bpf: actually skip RestrictFileSystems= when not supported

Units would fail to start, incl. systemd-journald.service and systemd-udevd.service.
Since unit->manager->restrict_fs will be set if and only if we can use it,
we can just check for that and remove the other checks.
Follow-up for 299d9417238e0727a48ebaabb5a9de0c908ec5c8.

(cherry picked from commit 46004616a12dcdaf11020b8d58f956a006c9d9cf)

3 years agotest: store empty files rather than symlinks for test-fstab-generator
Luca Boccassi [Sun, 9 Jan 2022 14:00:25 +0000 (14:00 +0000)]
test: store empty files rather than symlinks for test-fstab-generator

Dangling symlinks get pruned when packaging up the installation
directory. Just store empty files instead, and compare the names
rather than the content for .requires/.wants - the filename is
what is important anyway, the content is ignored.

Fixes #22059

(cherry picked from commit e683878c0f03a4ffa123e37b27933fbf7e144901)

3 years agoman: add missing example title in systemd.network(5)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 08:52:19 +0000 (09:52 +0100)]
man: add missing example title in systemd.network(5)

Also rename the file to match the example being extended.

(cherry picked from commit 55ac274ef4c1661f3053ae3a709202c918365f3b)

3 years agoseccomp: move arch_prctl to @default
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jan 2022 14:23:55 +0000 (15:23 +0100)]
seccomp: move arch_prctl to @default

It was reported as used by the linker:

> [It is] called in the setup of ld-linux-x86-64.so.2 from _dl_sysdep_start.
> My local call stack (with LTO):
>
> #0 init_cpu_features.constprop.0 (/usr/lib64/ld-linux-x86-64.so.2)
> #1 _dl_sysdep_start (/usr/lib64/ld-linux-x86-64.so.2)
> #2 _dl_start (/usr/lib64/ld-linux-x86-64.so.2)
> #3 _start (/usr/lib64/ld-linux-x86-64.so.2)
>
> Looking through the source, I think it's this (links for glibc 2.34):
> - First dl_platform_init calls _dl_x86_init_cpu_features, a wrapper for init_cpu_features.
> - Then init_cpu_features calls get_cet_status.
> - At last, get_cet_status invokes arch_prctl.

Fixes #22033.

(cherry picked from commit 5f02870a74aa3a758115cc9bd6d68f239caf8453)

3 years agotest: add test cases for fstab-generator
Yu Watanabe [Thu, 6 Jan 2022 11:12:27 +0000 (20:12 +0900)]
test: add test cases for fstab-generator

(cherry picked from commit 8cc8a073a834f3882b17115cd3e9a81f6a105898)

3 years agomeson: install test-network-generator-conversion.sh even if networkd is not enabled
Yu Watanabe [Thu, 6 Jan 2022 10:04:54 +0000 (19:04 +0900)]
meson: install test-network-generator-conversion.sh even if networkd is not enabled

Follow-up for 987dd89c775815831ae21736fe60aef59cb7a6fa.

(cherry picked from commit b322e683acf3ca3c86ea38be8a8b20a29459ec5f)

3 years agofstab-generator: also skip other network filesystems and live image
Yu Watanabe [Wed, 5 Jan 2022 13:06:03 +0000 (22:06 +0900)]
fstab-generator: also skip other network filesystems and live image

(cherry picked from commit 155e1bb4e7cf87191007488cf6a68a558a16eca1)

3 years agofstab-generator: skip root directory handling when nfsroot is requested
Yu Watanabe [Wed, 5 Jan 2022 10:24:46 +0000 (19:24 +0900)]
fstab-generator: skip root directory handling when nfsroot is requested

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

(cherry picked from commit 77b8e92de8264c0b656a7d2fb437dd8d598ab597)

3 years agokernel-install: prefer /boot over /boot/efi for $BOOT_ROOT
Adam Williamson [Wed, 5 Jan 2022 22:07:14 +0000 (14:07 -0800)]
kernel-install: prefer /boot over /boot/efi for $BOOT_ROOT

This restores the preference order from before 9e82a74. The code
previous to that change 'preferred' /boot over /boot/efi; that
commit changed it to check /boot/efi before checking /boot.
Changing this precedence could (and did, for me) have unexpected
effects - it seems safer to leave it how it was.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
(cherry picked from commit a5307e173bf86d695fe85b8e15e91126e8618a14)

3 years agohomed: stop before stopping dbus
Markus Weippert [Tue, 4 Jan 2022 12:56:11 +0000 (13:56 +0100)]
homed: stop before stopping dbus

Otherwise, systemd-homed-active.service will fail to deactivate all
homes because homectl can no longer talk to homed if dbus stops first.
As a result, /home cannot be umounted.

Doing this on systemd-homed-active.service instead works as well, but
systemd-homed will exit 1 if dbus is already shut down.

(cherry picked from commit e00a25a7b41bd45ab73b47cbd94b3af909b8f8a1)

3 years agoudev-util: ignore USB-C ports in power source mode when detecting system is running...
Yu Watanabe [Wed, 5 Jan 2022 00:10:35 +0000 (09:10 +0900)]
udev-util: ignore USB-C ports in power source mode when detecting system is running on AC power

Fixes #21988.

(cherry picked from commit 795e86b4f1e8a1fd440f8c817621779c6aedbdb5)

3 years agoudev-util: re-implement on_ac_power() with sd-device
Yu Watanabe [Tue, 4 Jan 2022 23:29:00 +0000 (08:29 +0900)]
udev-util: re-implement on_ac_power() with sd-device

(cherry picked from commit 01d4ad3bde9efbbc5856846fea328ee9bbcef87e)

3 years agoutil: move on_ac_power() from util.c -> udev-util.c
Yu Watanabe [Tue, 4 Jan 2022 23:05:26 +0000 (08:05 +0900)]
util: move on_ac_power() from util.c -> udev-util.c

(cherry picked from commit 06795b02e386763ca919bb4cd03990b9036e2e0a)

3 years agobpf: do not freeze if bpf lsm fails to set up
Julia Kartseva [Thu, 6 Jan 2022 00:34:56 +0000 (16:34 -0800)]
bpf: do not freeze if bpf lsm fails to set up

BPF LSM is cgroup unaware and it's set up is happening in core manager.
It occures that the current implementation is too restrictive and causes
pid 1 to freeze.
Instead:
* in bpf_lsm_setup set manager->restrict_fs pointer last,
so it is an indicator that the set up was successful
* check for manager->restrict_fs before applying unit options

(cherry picked from commit 299d9417238e0727a48ebaabb5a9de0c908ec5c8)

3 years agocore/bpf: tighten handling of return values, improve messages
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 10:14:18 +0000 (11:14 +0100)]
core/bpf: tighten handling of return values, improve messages

The code was written unidiomatically, using r as a boolean value, and
confusing errno and r in some places. AFAICS, there wasn't any actual
problem: even in the one place where errno was used instead of r, it would
almost certainly be initialized.

It seems that some libbpf functions set errno, while others return the
error, possibly encoded. Since there are almost no docs, the only way to
know is to read the code of the function. To make matters worse, there is
a global libbpf_mode which can be set to change the convention. With
LIBBPF_STRICT_DIRECT_ERRS in libbpf_mode, some functions set errno while others
return a negative error, and the only way to know is to read the code, except
that the split is now different. We currently don't set
LIBBPF_STRICT_DIRECT_ERRS, but even the possibility makes everything harder
to grok.

This is all very error-prone. Let's at least add some asserts to make sure that
the returned values are as expected.

(cherry picked from commit b7cba81553d0d958f23182ba9ab1739842ff9f5a)

3 years agocore/bpf: avoid unnecessary initialization of variables, tighten scope
Zbigniew Jędrzejewski-Szmek [Mon, 3 Jan 2022 09:29:13 +0000 (10:29 +0100)]
core/bpf: avoid unnecessary initialization of variables, tighten scope

No funtional change.

(cherry picked from commit 92698b0f9e34d69bc97e9ed8830eafaa06f41a46)

3 years agouserdbctl: fix "Password OK" shown even when password is empty or locked (#21308)
Pigmy-penguin [Thu, 6 Jan 2022 16:01:38 +0000 (17:01 +0100)]
userdbctl: fix "Password OK" shown even when password is empty or locked (#21308)

userdbctl: fix "Password OK" shown even when password is empty or locked
(cherry picked from commit cd933f14bd70d8311799972ca71280a733eb1d6a)

3 years agotest-watchdog: mark as unsafe
Mike Gilbert [Wed, 5 Jan 2022 04:43:10 +0000 (23:43 -0500)]
test-watchdog: mark as unsafe

If something goes wrong with this test it may result in an unsafe
system restart. Let's avoid running it automatically.

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

(cherry picked from commit 70652c2a6fa9c06c7faac62f41c72e2e4eaa9340)

3 years agologind: do not propagate error in delayed action
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jan 2022 14:10:33 +0000 (15:10 +0100)]
logind: do not propagate error in delayed action

If the action failed, we should log about the issue, and continue.
Exiting would bring the graphical session down, which of course is not
appreciated by users.

As documented in previous commits, a non-negative return from the callback
doesn't matter, so the callback is simplified a bit.

Fixes #21991.

(cherry picked from commit 8207b8321bbbcbd19a345deb77d455d98e6ffb84)

3 years agotest: use full date & time when checking for coredumps
Frantisek Sumsal [Wed, 5 Jan 2022 11:06:52 +0000 (12:06 +0100)]
test: use full date & time when checking for coredumps

Otherwise we might hit a window where the coredump happens before
midnight, but we check for it after midnight, which yields no results.

E.g.:

```
$ coredumpctl --no-legend --no-pager --file system.journal
Wed 2022-01-05 01:00:06 CET 359 0 0 SIGABRT journal /usr/bin/udevadm n/a
$ coredumpctl --since 23:59:55 --no-legend --no-pager --file system.journal
No coredumps found.
$ coredumpctl --since "2022-01-04 23:59:59" --no-legend --no-pager --file system.journal
Wed 2022-01-05 01:00:06 CET 359 0 0 SIGABRT journal /usr/bin/udevadm n/a
```

(cherry picked from commit 1b51599f29d245f2214349498bf2c1f0aa36873f)

3 years agojournal: Log filename when we fail to write an entry
Daan De Meyer [Wed, 5 Jan 2022 10:46:39 +0000 (10:46 +0000)]
journal: Log filename when we fail to write an entry

(cherry picked from commit 5b4a634a03c54a4d18b01686ac86b1133b54a939)

3 years agojournal: Log a better message when we're rotating because a file is full
Daan De Meyer [Wed, 5 Jan 2022 10:24:20 +0000 (10:24 +0000)]
journal: Log a better message when we're rotating because a file is full

The previous message was confusing errors. When we're rotating because
we've reached the file size limit, let's log a better message.

Fixes #22007.

(cherry picked from commit eff79e4e22e7c745fea259c4414f685363d9f16a)