1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-20 14:03:39 +03:00

55377 Commits

Author SHA1 Message Date
Yu Watanabe
0e29d6ef44 sd-boot: select newest kernel entry matching with the default glob pattern
This fixes a bug introduced by 0c674ce5f24a6e52561ec6520e43a1ca45d90f01.

Fixes #22004.

(cherry picked from commit e37d30f334830fab4decd52ef3c17fa09b7b0d92)
2022-01-07 15:51:51 +01:00
Yu Watanabe
7b2f8845cd resolve: add missing initialization of libgcrypt
Fixes #21951.

(cherry picked from commit e28df39269e03d49f540ebfe6b2e507d0f26c844)
2022-01-07 15:51:46 +01:00
Bastien Nocera
fe16ab6b39 hwdb: Allow end-users root-less access to TL866 EPROM readers
As is currently done in the upstream minipro tool:
https://gitlab.com/DavidGriffith/minipro/-/tree/master/udev

(cherry picked from commit f097f4ab896ea81e76b5764e218d7c644bfda199)
2022-01-07 15:37:08 +01:00
Zbigniew Jędrzejewski-Szmek
5c14fde3ba hwdb: make usb match patterns uppercase
Those patterns were always supposed to be uppercase.

(cherry picked from commit cc1746bbedb3c508cb39ce9c299f4f098bebb1a8)
2022-01-07 15:36:46 +01:00
Zbigniew Jędrzejewski-Szmek
697ec43fc5 hwdb: fix check for uppercasedness of match patterns
The check was added in 77547d5313ea916d2fb64ca5a8812734e9b50f92, but
it doesn't work as expected. Because the second part is wrapped in Optional(),
it would silently "succeed" when the lowercase digits were in the second part:

>>> from parse_hwdb import *
>>> g = 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4))
>>> g.parseString('v04D8pE11C*')
(['v', '04D8', 'p', 'E11C'], {})
>>> g.parseString('v04D8pe11c*')
(['v', '04D8'], {})

The following matches are OK:
usb:v0627p0001:*QEMU USB Keyboard*
usb:v0627p0001:*
usb:v0627p0001*
usb:v0627*

(cherry picked from commit 1a37237e2ffe6dfe142224a9d9e8b24135e93244)
2022-01-07 15:36:36 +01:00
Marco Scardovi
402280118f make HP 15s-eq0xxx changes specific to sku9MG38EA#ABZ
Signed-Off-By: Marco Scardovi <marco@scardovi.com>
(cherry picked from commit 7bd3d6e35a6de8b1bf93e2fae28a64f0c7ffd2ac)
v250.1
2022-01-04 17:11:10 +01:00
Zbigniew Jędrzejewski-Szmek
0776365d77 meson: generate better arch defines for clang bpf compilation
The code assume that meson's cpu_family can be mapped directly to
'-D__<cpu_family>__'. This works in a surprising number of cases, but not for a
few architectures. PPC uses "powerpc", and RISC-V omits the trailing underscores.
ARM and RISC-V require a second define too.

Fixes #21900.

(I don't think this matters too much: we need *something* so that gnu/stubs.h
can be successfully included. But we don't actually call syscalls or depend too
much on the host environment, so things should be fine as long as we don't get
a compilation error.)

(cherry picked from commit e897b07f97cf25e092a4cc8e1144e06564b45d53)
2022-01-04 16:28:31 +01:00
Zbigniew Jędrzejewski-Szmek
cd686fe4c7 basic/log: allow errno values higher than 255
When the support for "synthetic errno" was added, we started truncating
the errno value to just the least significant byte. This is generally OK,
because errno values are defined up to ~130.

The docs don't really say what the maximum value is. But at least in principle
higher values could be added in the future. So let's stop truncating
the values needlessly.

The kernel (or libbpf?) have an error where they return 524 as an errno
value (https://bugzilla.redhat.com/show_bug.cgi?id=2036145). We would
confusingly truncate this to 12 (ENOMEM). It seems much nicer to let
strerror() give us "Unknown error 524" rather than to print the bogus
message about ENOMEM.

(cherry picked from commit 5f74fcd41cb1a1b26c23e0f2ab405ae9cf6bcc93)
2022-01-04 16:27:57 +01:00
Zbigniew Jędrzejewski-Szmek
e4d4c5f9ee coredump: do not crash if we failed to acquire exe path
The COREDUMP_EXE attribute is "optional", i.e. we continue to process the
crash even if we didn't acquire it. The coredump generation code assumed
that it is always available:

 #5 endswith at ../src/fundamental/string-util-fundamental.c:41
 [ endswith() is called with NULL here, and an assertion fails. ]
 #6 submit_coredump at ../src/coredump/coredump.c:823
 #7 process_socket at ../src/coredump/coredump.c:1038
 #8 run at ../src/coredump/coredump.c:1413

We use the exe path for loop detection, and also (ultimately) pass it to
dwfl_core_file_report(). The latter seems to be fine will NULL, so let's just
change our code to look at COMM, which should be more reliable anyway.

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

(cherry picked from commit c790632cabf5691b0910fc6b7a5c6af31a7786aa)
2022-01-04 16:27:51 +01:00
Yu Watanabe
bdcc3b0713 elf-util: add missing assertion
(cherry picked from commit 80b241f2ec98509cbc89d2fb1626403167a832fb)
2022-01-04 16:27:41 +01:00
Yu Watanabe
72f95a1342 elf-util: executable argument for parse_elf() may be NULL
Fixes assertion triggered by parse_package_metadata() and json_build().

(cherry picked from commit d090049c01d9939b12989a74b1edc5fee75c1710)
2022-01-04 16:27:14 +01:00
Yu Watanabe
9f5372ce4c hostname-util: drop GET_HOSTNAME_ALLOW_NONE flag and always refuse "(none)"
The flag is now only used in test-sysctl-util.c, and it should be
replaced with uname(), because of the same reason as the previous
commit.

(cherry picked from commit 9383fa08bd263277d9a17a8999c3497458f273e3)
2022-01-04 16:25:46 +01:00
Yu Watanabe
7c78994860 hostname-setup: gracefully handle kernel with empty CONFIG_DEFAULT_HOSTNAME
Previously, sethostname_idempotent_full() calls gethostname_full() with
GET_HOSTNAME_ALLOW_NONE and GET_HOSTNAME_ALLOW_LOCALHOST flags. That
intended to get any values set by kernel. But, that does not work, as
the hostname may be empty.

Let's simplify the logic. The function sethostname_idempotent_full()
intends to set the requested hostname only when the current hostname
is different from the requested one. So, no check in getostname_full()
is required. Hence, simply use the result of uname() here.

Fixes #21896.

(cherry picked from commit d8d6b2275f7b7a5b58c6b0d89b78c927333c6af9)
2022-01-04 16:25:42 +01:00
Jan Janssen
1c4c566d86 boot: Do not warn if an initializing driver returns EFI_ABORTED
Fixes: #21965
(cherry picked from commit 8fb16fee96a1563738e7fa784fc45d152b8c2694)
2022-01-04 16:25:33 +01:00
Yu Watanabe
c563e3ef77 seccomp-util: include missing_syscall_def.h to make __SNR_foo mapped to __NR_foo
Fixes #21969.

(cherry picked from commit e83156c264d149e8f92f05b4d777317824a430f1)
2022-01-04 16:24:48 +01:00
Yu Watanabe
cd88d010e8 missing-syscall: add __NR_openat2
(cherry picked from commit d96ad9e8cb9fc8a9adfeebf69a645b809705daa0)
2022-01-04 16:24:47 +01:00
Yu Watanabe
7e33887657 syscalls: update syscall definitions
(cherry picked from commit 0c718b1a67cd0d3512eafeb4659458694bf3865b)
2022-01-04 16:24:46 +01:00
Jan Janssen
1598b41054 ci: Test efi binaries for section table gaps
(cherry picked from commit bbbf1c3d3229d328f1bcbf039db8e15e221a1d85)
2022-01-04 16:24:21 +01:00
Jan Janssen
2c99c39936 boot: Use objcopy to align sections
Not aligning these can create gaps in the section table. Some
firmware does not handle this nicely resulting in secure boot
signature fails.
Using objcopy ensures that any new sections in the future will be
properly aligned.

Fixes: #21956
(cherry picked from commit 75747c8a399967fa5d815a8f70f724436d035652)
2022-01-04 16:24:16 +01:00
Yu Watanabe
a473bfb433 nss-myhostname: do not apply non-zero offset to null pointer
Fixes https://github.com/systemd/systemd/issues/21935#issuecomment-1003216503.

(cherry picked from commit 92e9df9ca031b9b04487a46afd986ab3122183fd)
2022-01-04 16:23:35 +01:00
Yu Watanabe
9c8bc0451a nss-systemd: fix alignment of gr_mem
Follow-up for 1e65eb8f9b7d567462030b2e625998d77677e636.

Fixes #21935.

(cherry picked from commit 420a35c1fadfb4d67be6316436233d98b5688de5)
2022-01-04 16:23:29 +01:00
Yu Watanabe
cd76e5956a udev: fix ID_NET_NAME_MAC= udev property
This fixes a bug introduced by eaba9bb3e69635d2c490c5e1b0d262b763753e1d.

The commit mistakenly drops 'x' in ID_NET_NAME_MAC, and adds colons.
The colons were dropped by the commit dfa4876c417e2a9935d58100d44d94bb41cd5bfb,
but the missing 'x' was not added at that time.

Follow-up for dfa4876c417e2a9935d58100d44d94bb41cd5bfb.

(cherry picked from commit 60e930fc3e6eb8a36fbc184773119eb8d2f30364)
2022-01-04 16:22:41 +01:00
Zbigniew Jędrzejewski-Szmek
dedf981ff4 meson: fix detection of libcryptsetup functions
Meson would generate the following compile test:

  #define crypt_set_metadata_size meson_disable_define_of_crypt_set_metadata_size

  #include <limits.h>
  #undef crypt_set_metadata_size

  #ifdef __cplusplus
  extern "C"
  #endif
  char crypt_set_metadata_size (void);

  #if defined __stub_crypt_set_metadata_size || defined __stub___crypt_set_metadata_size
  fail fail fail this function is not going to work
  #endif

  int main(void) {
    return crypt_set_metadata_size ();
  }

This works fine when the identifier being queried is an actual function. But
crypt_token_max() is an inline function, so getting the address would fail,
leading to a false negative result. Complation would fail because the function
would be defined twice.

With this patch, the check is changed to include the header:

  #include <libcryptsetup.h>
  #include <limits.h>

  #if defined __stub_crypt_set_metadata_size || defined __stub___crypt_set_metadata_size
  fail fail fail this function is not going to work
  #endif

  int main(void) {
    void *a = (void*) &crypt_set_metadata_size;
    long long b = (long long) a;
    return (int) b;
  }

which seems to work correctly.

(cherry picked from commit aac8071730bd0bca3c2289bda628b1ef7a2591d2)
2022-01-04 16:22:32 +01:00
Yu Watanabe
d83bdf711e test-network: add testcase for invalid AllowedIPs=
(cherry picked from commit 14b451f20aaffa25f7091a7f1240aa711459b13e)
2022-01-04 16:22:24 +01:00
Yu Watanabe
c4165dac88 network: wireguard: warn about invalid allowed IP addresses
But handle them gracefully. Otherwise, when the route to the address is
being configured, kernel refuse the route.

Note that kernel's wireguard module handle e.g. 192.168.10.3/24 as
192.168.10.0/24.

Fixes #21929.

(cherry picked from commit af670fc635d1b7cd987fdb1acaf35d74c370e73f)
2022-01-04 16:22:19 +01:00
Yu Watanabe
17227e81ab nss-systemd: fix required buffer size calculation
This also fixes the pointer assigned to the gr_mem element of struct group.

Fixes a bug introduced by 47fd7fa6c650d7a0ac41bc89747e3b866ffb9534.

Fixes #21935.

(cherry picked from commit 1e65eb8f9b7d567462030b2e625998d77677e636)
2022-01-04 16:22:08 +01:00
Yu Watanabe
747b4f1ff8 sysusers: use filename if /proc is not mounted
During system install, /proc may not be mounted yet.

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

(cherry picked from commit b78d7f246899687a1697cdcebe93d8512c5e7c4b)
2022-01-04 16:22:02 +01:00
Noel Kuntze
19bb2b8443 network: complete example for xfrm setup
(cherry picked from commit 0d03e672a97c6ee85f563648e1ff40c88ce81d85)
2022-01-04 16:21:56 +01:00
Luca Boccassi
b59615dc76 systemd-run: ensure error logs suggest to use '--user' when appropriate
Before:

$ systemd-run --service-type=notify --user false
Job for run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service failed because the control process exited with error code.
See "systemctl status run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service" and "journalctl -xeu run-rc3fe52ee6ddd4a6eaaf1a20e0a949cdf.service" for details.

After:

$ systemd-run --service-type=notify --user false
Job for run-r7791e380a7b6400ea01d6a0e5a458b23.service failed because the control process exited with error code.
See "systemctl --user status run-r7791e380a7b6400ea01d6a0e5a458b23.service" and "journalctl --user -xeu run-r7791e380a7b6400ea01d6a0e5a458b23.service" for details.

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

(cherry picked from commit 466f2351bbb5c0fdc9f153e35506570e59b14c5f)
2022-01-04 16:21:55 +01:00
Luca Boccassi
0c4fe2e3dc dbus-wait-for-jobs: add extra_args to bus_wait_for_jobs_one()
And pass it through to bus_wait_for_jobs()

(cherry picked from commit 86980de64bf8c03505eec729808f52f3b3042998)
2022-01-04 16:21:54 +01:00
Jan Janssen
c926189767 boot: Introduce helper macros for offset checking
This fixes a subtle sizeof overflow on 32bit machines.

(cherry picked from commit aa1d0f25873f737fb9306a12f9283872012f2d9a)
2022-01-04 16:21:14 +01:00
Jan Janssen
d6d97abd78 boot: Reject unaligned data
The data seems to be properly aligned in real BCD stores, so it
should be fine to just reject bad ones.

Fixes: #21917
(cherry picked from commit 1cadb35fd68f0255e50627dffd25c83e7e2081e5)
2022-01-04 16:21:10 +01:00
Yu Watanabe
f85856c00d manager: always close idle pipe when sending ready notification
This fixes a bug introduced by 6d9326595592f98e8126eacb4176acd8c3516d5c.

The commit makes several functions skipped if the manager is already
in finished state, as
> In manager_check_finished(), more steps are skipped if MANAGER_IS_FINISHED().
> Those steps are idempotent, but no need to waste cycles trying to do them
> more than once.

However, the idle pipe may be re-opened after manager is finished:
manager_dispatch_run_queue() -> manager_watch_idle_pipe().
So, the closing the pipe is not idempotent here.

Fixes #21889.

(cherry picked from commit 9c1b17c3dc1541df02118ee3aaf6dd5dd540cdc2)
2022-01-04 16:18:55 +01:00
ksa678491784
202b1448aa stub: Do not assume having DeviceHandle
(cherry picked from commit 5204355861643a658a6d8e009b67e422cdb9194b)
2022-01-04 16:18:09 +01:00
Yu Watanabe
1690672140 network: ndisc: ignore route prefix to ::/0
Fixes #21912.

(cherry picked from commit 80bfc3b901317ca7c1aaede0cd69150789a6e9be)
2022-01-04 16:18:07 +01:00
Yu Watanabe
2a9efd8513 test: add testcases of symlinked drop-in directories
(cherry picked from commit cf6562e4565c3055e1f387adadf2ff7fb0ce1688)
2022-01-04 16:17:30 +01:00
Yu Watanabe
f47d962bb1 unti-file: fix symlinked drop-in directory handling
This fixes a bug introduced by 95ef0eaf0d5cd43fcc8e9eb541f2c342f25f8f2f.

Fixes #21920.

(cherry picked from commit 7f304b856164a70b240d66d279fe66e7c8e8887d)
2022-01-04 16:17:26 +01:00
Luca Boccassi
8b29809c11 core: do not touch /run/systemd/systemd-units-load from user session instances
Follow-up for: 15b9243c0d
Fixes: https://github.com/systemd/systemd/issues/21911

(cherry picked from commit 4b3ad81bfafcd97acb06db463495e348d159d8e6)
2022-01-04 16:15:31 +01:00
Jan Janssen
630da18817 boot: Fix name length comparison
(cherry picked from commit 2198a773916f0e4ecca01725118f1f5a6bbe27b1)
2022-01-04 16:14:18 +01:00
Jan Janssen
a4e4c3377d boot: Fix off-by-one offset sanity checks
(cherry picked from commit c3c5b93a0c04c4940724b7babca92f4e75f49b98)
2022-01-04 16:14:18 +01:00
Jan Janssen
0c7ef2c166 boot: Fix off-by-one NUL-termination
(cherry picked from commit fab82756462fd0ce82836e3d95721954d7ab2527)
2022-01-04 16:14:18 +01:00
Luca Boccassi
93ddabc26a chrattr-util: return EOPNOTSUPP from chrattr_full if no other failure was observed
When chattr_full tries to apply flags one-by-one, and one fails,
record which errno was returned. But record EOPNOTSUPP(&friends)
only if no other error is observed, and return it only in that case
(otherwise keep returning ENOANO), so that callers can respond
appropriately to EOPNOTSUPP vs more relevant errors.
For example, this lets tmpfiles.d log at debug level when a filesystem
flag cannot be applied because the filesystem does not support it,
but at warning level if something else went wrong when applying it.
Restores logging behaviour of tmpfiles.d to pre-250.

Follow-up for: c1631ee124

Fixes: https://github.com/systemd/systemd/issues/21901
(cherry picked from commit 7c3b51c469140cdbc1b7e9a232af3f250fea3884)
2022-01-04 16:13:27 +01:00
Mike Gilbert
4d889024ef random-util: use ssize_t for getrandom return value
This matches the prototype provided by glibc.

(cherry picked from commit 289b41aae7356b7a6c72ff4a3476193a084ff33f)
2022-01-04 16:10:10 +01:00
James Hilliard
109c67c46d meson: don't try to guess versioned clang/llvm-strip bins for cross compile
This should simplify overriding the program locations as the binary
names should now not change if cross compiling.

It's likely any attempts at autodetecting these in cross environments will
be brittle at best so lets just disable it.

(cherry picked from commit 4b7b73c7140b3c923064c6bf27a30b0e88a72f7a)
2022-01-04 16:09:34 +01:00
Yu Watanabe
9bcf483b11 meson: fix build with -Dcryptolib=openssl -Ddns-over-tls=false
Previously, when -Ddns-over-tls=false, libopenssl was missing in the
dependency of resolved.
Also, this drops libgpg_error when it is not necessary.

Replaces #21878.
2021-12-24 15:23:39 +00:00
Yu Watanabe
34b5684846 man: also add anotations for methods
Fixes #21882.
2021-12-24 10:18:11 +00:00
Yu Watanabe
0764e3a327 missing-syscall: define all MOUNT_ATTR_* if missing
Fixes #21876.
2021-12-24 10:12:25 +00:00
Zbigniew Jędrzejewski-Szmek
a420d71793 NEWS: finalize release v250 2021-12-23 21:09:35 +01:00
Yu Watanabe
558ad6bd38
analyze: fix segfault when malloc() fails (#21874)
Fixes #21872.

log_syntax_callback sets 's', a.k.a. '*userdata', to POINTER_MAX to signal allocation failure.
If the error does not cause immediate failure of the program, and log_syntax_callback is called
again, it would try to use 's' as a pointer to a set and fail badly.
2021-12-23 21:03:16 +01:00
Zbigniew Jędrzejewski-Szmek
10c8c32f13
Merge pull request #21869 from yuwata/sd-journal-fix-segfault
sd-journal: fix segfault
2021-12-23 20:07:41 +01:00