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

55653 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
e97a300148
Merge pull request #21941 from yuwata/hostname-handle-empty
hostname-setup: support kernel with empty CONFIG_DEFAULT_HOSTNAME
2022-01-03 19:56:57 +01:00
Jan Janssen
8fb16fee96 boot: Do not warn if an initializing driver returns EFI_ABORTED
Fixes: #21965
2022-01-03 19:42:36 +01:00
Zbigniew Jędrzejewski-Szmek
3c7af1af7d basic: adjust wording and wrapping of comments 2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek
606309d554 test-bpf-lsm: drop some parens 2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek
333cf6c6ae test-job-type: modernize code a bit 2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek
b7cba81553 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.
2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek
92698b0f9e core/bpf: avoid unnecessary initialization of variables, tighten scope
No funtional change.
2022-01-03 19:18:55 +01:00
Zbigniew Jędrzejewski-Szmek
7185af6234
Merge pull request #21970 from yuwata/seccomp-util-fix-build
seccomp-util: fix build failure
2022-01-03 16:44:10 +01:00
Frantisek Sumsal
3fd864aea7 ci: bump mkosi to v12 with libsolv workaround
Replaces: https://github.com/systemd/systemd/pull/21574
Related:
    * https://github.com/systemd/mkosi/issues/861
    * https://github.com/systemd/mkosi/pull/878
2022-01-03 15:56:22 +03:00
Jan Janssen
7ffc4f4748 boot: Prevent stub command line editing under secure boot 2022-01-03 11:29:49 +01:00
Jan Janssen
fb90100cf0 boot: Unify idx type handling
This replaces several inconsistent use of types and unsound
signed comparisons.
The added max entry count is just for paranoia. Anyone with that
many boot entries deserves a medal.
2022-01-03 10:41:45 +01:00
Jan Janssen
159636cf74 boot: Convert goto into loop 2022-01-03 10:20:23 +01:00
Jan Janssen
0b2281a209 boot: Rename cleanup functions 2022-01-03 10:15:24 +01:00
Evgeny Vereshchagin
951280ce99 tests: no longer load libnss_{files|dns}
Those libraries aren't provided by systemd so they shouldn't be
included here
2022-01-03 04:36:37 +00:00
Evgeny Vereshchagin
019c84938d
Merge pull request #21960 from medhefgo/boot-gap
boot: Use objcopy to align sections
2022-01-03 02:35:15 +03:00
Yu Watanabe
e83156c264 seccomp-util: include missing_syscall_def.h to make __SNR_foo mapped to __NR_foo
Fixes #21969.
2022-01-03 06:25:07 +09:00
Evgeny Vereshchagin
637ccd2fa4 tests: run nss-{users|hosts} by default
to prevent issues like https://github.com/systemd/systemd/issues/21935
by testing the code under ASan/UBSan
2022-01-02 20:37:59 +00:00
Yu Watanabe
63e10c0cd3
Merge pull request #21944 from yuwata/nss-systemd-fix-pointer
nss-systemd: fix pointer calculation
2022-01-03 05:32:05 +09:00
Jan Janssen
bbbf1c3d32 ci: Test efi binaries for section table gaps 2022-01-02 20:05:58 +01:00
Jan Janssen
75747c8a39 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
2022-01-02 19:58:56 +01:00
Yu Watanabe
d96ad9e8cb missing-syscall: add __NR_openat2 2022-01-03 03:48:37 +09:00
Yu Watanabe
0c718b1a67 syscalls: update syscall definitions 2022-01-03 03:48:37 +09:00
Yu Watanabe
3c80c7bacf
Merge pull request #21928 from medhefgo/boot-meson
meson: Boot
2022-01-02 23:40:46 +09:00
Jan Janssen
d9fd84fc5d boot: Add disabled secure boot mode without setup mode 2022-01-02 23:31:23 +09:00
Marco Scardovi
7bd3d6e35a make HP 15s-eq0xxx changes specific to sku9MG38EA#ABZ
Signed-Off-By: Marco Scardovi <marco@scardovi.com>
2022-01-02 12:22:07 +00:00
Frantisek Sumsal
3b5816ba33
Merge pull request #21915 from evverx/fuzz-bcd
tests: add fuzz-bcd
2022-01-02 10:05:13 +00:00
Jan Janssen
2f2b072267 meson: Get objcopy location from compiler 2022-01-02 10:18:26 +01:00
Jan Janssen
52adf0e91e meson: Remove efi-cc option
Changing the efi compiler this way doesn't really work. The gnu-efi
header checks as well as supported compiler flag checks use the
regular cc that meson detects. Changing the compiler this way will
end up with bad compiler flags. For the very same reason, this does
not work with a cross-compiler without going through proper meson
cross-compilation steps either.

The proper way to build systemd-boot with a different compiler is to
use a different build folder and then just use the proper ninja build
target to only build the bootloader/stub.
2022-01-02 10:18:26 +01:00
dependabot[bot]
b774de1883 build(deps): bump meson from 0.60.2 to 0.60.3 in /.github/workflows
Bumps [meson](https://github.com/mesonbuild/meson) from 0.60.2 to 0.60.3.
- [Release notes](https://github.com/mesonbuild/meson/releases)
- [Commits](https://github.com/mesonbuild/meson/compare/0.60.2...0.60.3)

---
updated-dependencies:
- dependency-name: meson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-01 17:40:39 +03:00
Yu Watanabe
60e930fc3e 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.
2021-12-31 13:21:12 +00:00
Yu Watanabe
92e9df9ca0 nss-myhostname: do not apply non-zero offset to null pointer
Fixes https://github.com/systemd/systemd/issues/21935#issuecomment-1003216503.
2021-12-31 09:13:03 +09:00
Yu Watanabe
420a35c1fa nss-systemd: fix alignment of gr_mem
Follow-up for 1e65eb8f9b7d567462030b2e625998d77677e636.

Fixes #21935.
2021-12-31 09:05:16 +09:00
Zbigniew Jędrzejewski-Szmek
aac8071730 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.
2021-12-31 07:02:29 +09:00
Luca Boccassi
af73d8bd83
Merge pull request #21940 from yuwata/network-wireguard-mask-allowed-ips
network: wireguard: handle invalid AllowedIPs= gracefully
2021-12-30 21:18:05 +00:00
Yu Watanabe
9383fa08bd 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.
2021-12-31 04:05:38 +09:00
Yu Watanabe
d8d6b2275f 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.
2021-12-31 03:58:06 +09:00
Yu Watanabe
1e65eb8f9b 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.
2021-12-31 03:12:09 +09:00
Yu Watanabe
b78d7f2468 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).
2021-12-31 03:11:43 +09:00
Yu Watanabe
14b451f20a test-network: add testcase for invalid AllowedIPs= 2021-12-31 02:31:12 +09:00
Yu Watanabe
af670fc635 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.
2021-12-31 02:31:09 +09:00
Noel Kuntze
0d03e672a9 network: complete example for xfrm setup 2021-12-30 23:52:28 +09:00
Luca Boccassi
466f2351bb 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
2021-12-30 23:50:45 +09:00
Luca Boccassi
86980de64b dbus-wait-for-jobs: add extra_args to bus_wait_for_jobs_one()
And pass it through to bus_wait_for_jobs()
2021-12-30 23:50:45 +09:00
Luca Boccassi
b3bfe6b9e1
Merge pull request #21922 from medhefgo/boot-fix
boot: More BCD parser fixes
2021-12-29 19:35:42 +00:00
Ludwig Nussel
b13a8b5b37 test: mark partition bootable
Make test suite partition bootable so nspawn can use the image directly.
Useful for local testing.

https://systemd.io/DISCOVERABLE_PARTITIONS/
2021-12-29 19:23:26 +00:00
Jan Janssen
aa1d0f2587 boot: Introduce helper macros for offset checking
This fixes a subtle sizeof overflow on 32bit machines.
2021-12-29 14:39:54 +01:00
Jan Janssen
1cadb35fd6 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
2021-12-29 14:39:54 +01:00
Jan Janssen
77fcf28cb8 boot: Build BCD parser only on arches supported by Windows 2021-12-29 14:39:54 +01:00
Luca Boccassi
d39d3696c0
Merge pull request #21898 from yuwata/meson-dbus-interfaces-dir
meson: obtain dbus related directories from pkg-config
2021-12-29 12:39:50 +00:00
Yu Watanabe
9c1b17c3dc 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.
2021-12-29 12:35:48 +00:00