1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-14 16:58:22 +03:00

41769 Commits

Author SHA1 Message Date
Chitoku
cbd7a29604 timesync: stop re-sync on network configuration change when no link servers are configured (#26708)
This commit fixes an issue where systemd-timesyncd re-synchronizes the
system clock every time the network configuration is updated, no matter
whether link servers are actually changed.

Fixes a bug introduced by e05dd7718d0b32e039c9e0f7bf3875079d1a359d.

(cherry picked from commit 0f9c8d02918492e9369cf85479c2e540b9c1f698)
2023-03-28 18:12:32 +02:00
Joshua Goins
1a7b9945d2 udev: Don't mark as tablet if device has relative coordinates
Tablets don't typically have relative coordinates (they are separated on
the kernel device layer). However, some Logitech mice report similar
supported events, so use the existence of EV_REL to determiner whether or
not the device is really a tablet.

Fixes bug introduced by 0855ce67726f87a5a67b4fb536d58e0e4428a248.

Fixes: #26600
(cherry picked from commit ebc03f5d7abdb9f600ee02d0299f3d4fad0836dd)
2023-03-28 18:11:34 +02:00
Zbigniew Jędrzejewski-Szmek
8d1db69219 meson: adjust for removal of gnu-efi compat
gnu-efi-3.0.11-13.fc39 in Fedora dropped the old include paths.

/usr/include/efi/efi.h uses 'include "efibind.h"', so we cannot use -isystem.

(cherry picked from commit efcde781de4ebf7d15410b5d6cb7de3a8c67f6aa)
2023-03-05 19:15:14 +00:00
Frantisek Sumsal
fef2e88b92 systemctl: explicitly cast the constants to uint64_t
Otherwise under certain conditions `va_arg()` might get garbage instead
of the expected value, i.e.:

$ sudo build-o0/systemctl disable asdfasfaf
sd_bus_message_appendv: Got uint64_t: 0
Failed to disable unit: Unit file asdfasfaf.service does not exist.

$ sudo build-o1/systemctl disable asdfasfaf
sd_bus_message_appendv: Got uint64_t: 7954875719681572864
Failed to disable unit: Invalid argument

(reproduced on an armv7hl machine)

Resolves: #26568
Follow-up to: bf1bea43f15
Related issue: https://github.com/systemd/systemd/pull/14470#discussion_r362893735

(cherry picked from commit c63bfd0884cf20e48befbee49d41f667660a8802)
2023-03-03 20:08:22 +01:00
Samanta Navarro
465d48dfa2 bootctl: Fix debug messages
Remove duplicate KERNEL_INSTALL_MACHINE_ID from message and also
specify the correct origin of layout variable.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
(cherry picked from commit 2d5ccb0818a7c9fdc280eb84478a6b89cd46b6fe)
2023-03-03 19:57:25 +01:00
Daan De Meyer
0b81fcd16d chase-symlinks: Always open a dirfd to the root directory
Instead of special casing "/", let's just always open a dirfd to the
root directory.

(cherry picked from commit accc26a0e543c9f9e2e5adc1ad6c5a2b9d64670d)
2023-03-03 10:47:05 +01:00
Daan De Meyer
aa20a210a0 chase-symlinks: chase_symlinks_at() AT_FDCWD fixes
- Whether we should return an absolute path or not is irrelevant
to whether CHASE_AT_RESOLVE_IN_ROOT is set. We should only return
an absolute path if we are provided one and the directory file
descriptor is AT_FDCWD
- When the directory file descriptor is AT_FDCWD, we should always
resolve symlinks against "/". Currently, if the directory file
descriptor is AT_FDCWD and CHASE_AT_RESOLVE_IN_ROOT is set, we
resolve symlinks against the current working directory which is
almost always not going to be what the caller wants.
- Currently, if we provide an absolute path with a positive directory
file descriptor without CHASE_AT_RESOLVE_IN_ROOT SET, we interpret
the path relative to "/" instead of the given directory file descriptor.
Let's make sure that when we're given a positive directory file
descriptor, we always resolve the given path relative to it.

(cherry picked from commit c677e13c35ff2d475199bcc9432892396485b6b8)
2023-03-03 10:47:05 +01:00
msizanoen1
bb3e44323b escape: add missing non-NULL parameter assertions
(cherry picked from commit 0b82a6fa5d2ba94bbc1c3db4a04dfd052e1cd446)
2023-03-03 10:42:09 +01:00
msizanoen1
c4e7cf2bd7 test-escape: Add tests for escaping bogus UTF-8 sequences
(cherry picked from commit 582843ee37fb2de62321085dd3c2f4bfbdbad12e)
2023-03-03 10:42:08 +01:00
msizanoen1
e906fd2421 escape: Ensure that output is always valid UTF-8
This ensures that shell string escape operations will not produce output
with invalid UTF-8 from the input by escaping invalid UTF-8 data as if
they were single byte characters.

(cherry picked from commit 00f57157f32f6ed5a68d68986b013c203cd78c37)
2023-03-03 10:42:07 +01:00
Frantisek Sumsal
1a22006574 virt: correctly detect QEMU emulated pSeries guests
Resolves: #26629
(cherry picked from commit 8c7a6c742afef9284d5c06fc285cf66306cbce31)
2023-03-03 10:40:40 +01:00
Lennart Poettering
5ee19fdfa0 psi-util: fix error handling
We checked ERRNO_IS_NOT_SUPPORTED on a possible positive non-error code,
which isn't right.

Fix that. Also add caching, since we are about to call this more often.

(cherry picked from commit 90ec8ebe33ec72ed6d9f451de9443d67dd351d72)
2023-03-03 10:37:51 +01:00
Lennart Poettering
9ffa0d439f journald: remove triplicate logging about failure to write log lines
Let's log exactly at one place about failed writing of log lines to
journal file: in shall_try_append_again().

Then, if we decide to suppress a retry-after-vacuum because we already
vacuumed anyway then say this explicitly as "supressed rotation",
because that's what we do here.

This removes triplicate logging about the same error, and logs exactly
once, plus optional one "suppressed rotation" message. (plus more debug
output). The triplicate logging was bad in particular because it had no
understanding of the actual error codes and just showed generic UNIX
error strings ("Not a XENIX named type file"). By relying on
shall_try_append_again() to do all logging we now get very clean error
strings for all conditions.

Fixes: #26496
(cherry picked from commit 0631aabdf567e5ce87166827e9645bc18083a7c9)
2023-03-03 10:36:24 +01:00
Lennart Poettering
4f7f93cc6a journald: downgrade various log messages from LOG_WARNING to LOG_INFO
None of these conditions are real issues, but they can simply happen
because we just swtched from /run to /var as backend for logging and
there are old files from different boots with different systemd versions
and so on.

Let's not make more noise than necessary: still log, but not consider it
a warning, but just some normal thing.

We are handling these issues safely after all: by rotating and starting
anew, i.e. there's no reason to be concerned.

(cherry picked from commit ab84a03fdaf3954918d66da5c5294f9fe9a59074)
2023-03-03 10:34:36 +01:00
Lennart Poettering
a2dc51cd8c journald: make sure shall_try_append_again() logs about all return codes passed in, not just some
(cherry picked from commit d6df3bfbb82330fc0e2f90c5455bfe2a89d67477)
2023-03-03 10:33:51 +01:00
David Tardon
144ac494ec systemctl: print better message if default target is masked
If the default target is masked, `systemctl get-default` prints

  Failed to get default target: Operation not possible due to RF-kill

That's a bit too cryptic, so let's make it clear what's actually
happening.

Fixes #26589.

(cherry picked from commit 7c78a19322962bb386f87bcaf37bf650cca1c400)
2023-03-03 10:32:57 +01:00
Lennart Poettering
791754f683 Revert "dissect-image: don't probe swap partitions needlessly"
This reverts commit df4524cb3796529b435af309f5e6a2d92bcdaaa0.

This commit is just wrong. The thing is that we *don't* know
automatically that the partition contains a swap image, because it could
be encrypted.

Hence revert.

Fixes: #26595
(cherry picked from commit 41aca66ba4f3a72ad709ef27e334392ef177450c)
2023-03-03 10:32:20 +01:00
Yu Watanabe
e093acd062 core/dbus-socket: check the socket path is absolute
In config_parse_socket_listen(), we have checked the path is absolute,
however we have not in the dbus method.

(cherry picked from commit 4de2b47bdec8bbb7df78678a152f18281b20e7b5)
2023-03-03 10:27:56 +01:00
Yu Watanabe
a719c2ec2f sd-event: fix error handling
Follow-up for 6d2326e036ceed30f9ccdb0266713c10a44dcf6c.

(cherry picked from commit 1912f790fee9e0182acd77b77496f500094a140d)
2023-03-03 10:26:04 +01:00
Yu Watanabe
58c821af60 sd-event: always initialize sd_event.perturb
If the boot ID cannot be obtained, let's first fallback to the machine
ID, and if still cannot, then let's use 0.
Otherwise, no timer event source cannot be triggered.

Fixes #26549.

(cherry picked from commit 6d2326e036ceed30f9ccdb0266713c10a44dcf6c)
2023-03-03 10:23:47 +01:00
Yu Watanabe
2bfb07b22f systemctl: show "Until:" field only for service and scope units
Only service and scope units have RuntimeMaxUSec bus property.
To suppress the "Until:" field for other unit types, the entry must be
initialized with USEC_INFINITY.

Fixes #26473.

(cherry picked from commit b59052be261523721a86caf4ef820e63f03e26a4)
2023-03-03 10:20:13 +01:00
Aidan Dang
0f4dbe6367 Enable TPM by default with SetCredentialEncrypted
(cherry picked from commit d59025698f6261aa65ac074a3b46e8babed0d05d)
2023-03-03 10:13:38 +01:00
Jan Janssen
8d8240bdf6 stub: Fix unaligned read
(cherry picked from commit 024951fb2263935cc8d7b3932915c8dee927a14f)
2023-03-03 10:10:33 +01:00
Zbigniew Jędrzejewski-Szmek
44c2ff5b1e efi: drop executable-stack bit from .elf file
An rpminspect test in Fedora/RHEL is flagging our stub files as having an
executable stack. The check is correct:

$ readelf --wide --program-headers build/src/boot/efi/linuxx64.elf.stub | rg -i stack
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RWE 0x10

It seems to be just an omission in the linker script… None of the objects that
are linked into the stub are marked as requiring an executable stack:

$ readelf --wide --sections build/src/boot/efi/*.c.o \
  /usr/lib/gnuefi/x64/libgnuefi.a \
  /usr/lib/gnuefi/x64/libefi.a \
  /usr/lib/gcc/x86_64-redhat-linux/12/libgcc.a \
  | rg '.note.GNU-stack.*X'
(nothing)

On aarch64 we end up with a nonexecutable stack, but on ia32 and x64 we get one,
so this might be just a matter of defaults in the linker. It doesn't matter
greatly, but let's mark the stack as non-executable to avoid the warning.

Note: '-Wl,-z' is not needed, things work with just '-z'.
(cherry picked from commit 1eca770933e49a1be16e40bfbaefc0f75af81781)
2023-03-03 10:10:12 +01:00
David Tardon
f2460b78b9 logind-session: make stopping of idle session visible to admins
(cherry picked from commit 6269ffe7ee8a659df7336a2582054ecd9eecf4b1)
2023-03-03 10:09:48 +01:00
Mike Yuan
1947b9939c sleep: check if we're on AC power before checking battery capacity
Before this commit, battery_is_low() returns
true if there's no battery on the system.
It's now modified to check if the system is
on AC power first, and returns false early
if that's the case.

Fixes #26492

(cherry picked from commit e0b3a70fabb871bf55678e9e177445b1df2aee88)
2023-03-03 10:09:43 +01:00
David Tardon
452cad62c8 install: fail early if specifier expansion failed
Before:

systemd[1]: Assertion 'path' failed at src/shared/install.c:288, function install_changes_add(). Aborting.
systemd[1]: Caught <ABRT> from our own process.
systemd[1]: Caught <ABRT>, dumped core as pid 2525.
systemd[1]: Freezing execution

After:

Failed to enable unit: Invalid specifier in user-%J.service

Fixes #26467.

Follow-up for: f5a0162

(cherry picked from commit f8979e869812988835f6951fb73a68e30a4c608c)
2023-03-03 10:09:29 +01:00
Lennart Poettering
eae11e3f06 homectl: add missing break
(cherry picked from commit 464ec1dec741e31d7bf08a4b7bb5a64a6adbb81d)
2023-03-03 10:07:54 +01:00
Yu Watanabe
9024afb994 core/manager: falling back to execute generators without sandboxing
When running in a container, like podman, docker or so, creating new mount
namespace may be disabled.

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

(cherry picked from commit a2275dcb9d48925f8192f44ec371710ce812bfce)
2023-03-03 10:07:00 +01:00
Daan De Meyer
755431b233 ukify: Set fast_load option when parsing PE files
Let's skip parsing of some irrelevant information that we don't use
to speed up building UKIs with large initrds from +-15s to less than
1s.

(cherry picked from commit c87ff622101b82bae7f4c96b59218c7380927375)
2023-03-03 10:01:53 +01:00
Ronan Pigott
343e90462f core: permit sending augmented enable/disable methods
systemctl disable some.service fails to acquire interactive permission
because the DisableUnitFilesWithFlagsAndInstallInto method isn't permitted

(cherry picked from commit d668ba131c72e85e50abdb05f189b3e07e1d378f)
2023-03-03 09:59:58 +01:00
Yu Watanabe
ba1cb4156b process-util: show requested process name in the log
This is useful for debugging issues like #26474.

(cherry picked from commit b9fadf2e2cb83d342342341b0edba4f519890634)
2023-03-03 09:58:43 +01:00
Ronan Pigott
5140da8937 systemctl: edit: fix double free of instanced name
There is a double free of unit_name when an instance is used, causing
systemctl --user edit service@instance to abort.

(cherry picked from commit fe5cb7a7aec49cdc77d02e109dde81293e4566a0)
2023-03-03 09:57:46 +01:00
Mike Yuan
c4cdbb978f journalctl: fix output when --lines is used with --grep
Previously, we skip the entries before arg_lines
unconditionally, which doesn't behave correctly
when used with --grep. After this commit, when
a pattern is specified, we don't skip the entries
early, but rely on the count of the lines shown
to tell us when to stop. To achieve that we would
have to search backwards instead.

Fixes #25147

(cherry picked from commit db4691961ca52759fe6645d0fddb659ee4299ac2)
2023-03-03 09:57:28 +01:00
Yu Watanabe
6dafcad55c loop-util: fix error condition and return value
Fixes a bug introduced by da4fd28871227d23d4719e30da03af5a71f47e5a.

(cherry picked from commit 2421dd72674d55bd8ed026bdf47939cbda26152f)
2023-03-03 09:57:08 +01:00
Winterhuman
ec6c1fbf7d Correct journal misspell
(cherry picked from commit 1ec9b722586379fb468de5717d6bde77c492a5a7)
2023-03-03 09:56:49 +01:00
Yu Watanabe
6b6df9a845 cryptsetup: check the existence of salt by salt_size > 0
Follow-up for 504d0acf61c8472bc93c2a927e858074873b2eaf.

The function may be called with non-NULL salt and salt_size == 0.

(cherry picked from commit 8c2264abb9c16bc2933f95be299f15ee66c21181)
2023-03-03 09:52:23 +01:00
Jan Janssen
cd5de2811a boot: Fix assertion failure
The TPM code expects a description unless the PCR index indicates that
no measurements have to take place. The assert was preempting this
check from happening.

Fixes: #26428
(cherry picked from commit f92428eae53685f372775e8cb0f0f4c249f02724)
2023-03-03 09:50:12 +01:00
Lennart Poettering
01b90e1588 pid1: generate compat warning for SystemCallArchitectures= if seccomp is off
(cherry picked from commit 6aa2c55522d7cac62ecfd5d5687a86a84f158d18)
2023-03-03 09:48:30 +01:00
Yu Watanabe
a3177cbe54 core/mount: fix default target for /sysusr/usr and its child
Follow-up for 29a24ab28e9790680348b1ffab653a321fa49a67.

(cherry picked from commit dbfc096095cb741f5345be0dc6508628008c46d7)
2023-03-03 09:48:11 +01:00
Dan Streetman
51b7acfcef tpm2: fix build failure without openssl
(cherry picked from commit 0d7009d35df2fef494b1df67f5caa55e85dd8970)
2023-03-03 09:41:39 +01:00
Joan Bruguera
a88e35bf95 resolved: Fall back to TCP if UDP is blocked
If UDP is blocked on the system (e.g. by iptables or BPF), the kernel will
return EPERM on some or all of the system calls (connect, sendmsg, etc.).
In this case, try to fall back to TCP, which hopefully will not be blocked.

(cherry picked from commit 3dd6336ad0cb40e928745404ed72c41e4ac9c39e)
2023-03-03 09:35:50 +01:00
Luca Boccassi
504d0acf61 cryptsetup: do not assert when unsealing token without salt
Salt was added in v253. We are not checking whether it was actually found
(non-zero size), so when an old tpm+pin enrollment is opened things go boom.
For good measure, check both the buffer and the size in both places.

Assertion 'saltlen > 0' failed at src/shared/tpm2-util.c:2490, function tpm2_util_pbkdf2_hmac_sha256(). Aborting.
2023-02-15 18:01:28 +00:00
Yu Watanabe
c126c8ac81 ukify: fix padding length 2023-02-15 18:01:02 +00:00
Dmitry V. Levin
30fd9a2dab treewide: fix a few typos in NEWS, docs and comments 2023-02-15 10:41:03 +00:00
Dmitry V. Levin
8d3473f01d src: fix several typos in log messages 2023-02-15 10:41:03 +00:00
Mike Gilbert
7cd137e647 bootctl: avoid using __WORDSIZE macro
__WORDSIZE does not seem to be documented anywhere, and is probably
meant to be used internally by glibc headers.

In systemd, it was only being used in warning messages. We can avoid
using it by rewording the messages slightly.

Fixes a build error with musl libc.

Bug: https://bugs.gentoo.org/894430
2023-02-15 10:24:25 +09:00
Yu Watanabe
f0353cf2e9 core/execute: fix comment 2023-02-15 10:10:13 +09:00
Yu Watanabe
0b75493da0 tree-wide: fix typo and comment style update 2023-02-15 10:08:16 +09:00
Daan De Meyer
0da4cc97b4 test-boot-timestamp: Handle ERANGE error
Timestampfs from sysfs files can be zero in which case ERANGE will
be returned so let's make sure we catch that.
2023-02-13 22:00:33 +01:00