1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00
Commit Graph

53866 Commits

Author SHA1 Message Date
Frantisek Sumsal
035af7adfe test: disable ProtectHome= when collecting coverage as well
Depending on the location of the original build dir, either ProtectHome=
or ProtectSystem= may get in the way when creating the gcov metadata
files.

Follow-up to:
    * 02d7e73013
    * 6c9efba677
2021-10-23 21:27:20 +02:00
Yu Watanabe
096a154acc
Merge pull request #21082 from yuwata/network-dhcp6-pd-trivial-cleanups
network: DHCPv6 PD: several trivial cleanups
2021-10-23 23:58:22 +09:00
Anssi Hannula
37e4637a9e efivars: skip writing if variable is already in wanted state
In order to minimize EFI variable NVRAM wear, do not rewrite variables
if they are already in the wanted state (i.e. same data and attributes).

This allows e.g. performing repeat calls of "bootctl install" (which
always rewrites the EFI boot entry) without consuming EFI NVRAM write
cycles.
2021-10-23 23:57:56 +09:00
Lennart Poettering
aa0379f16f homed: don't drop caches on activation
We should drop caches if we are configured to do so in all cases where
we are done with home dir operations: except if that operation is
activation, because in that case we are not destroying anything, but
leaving it on.

Hence, turn off the flag that reminds us that we should drop caches
before exiting, once activation completed fully,

Follow-up for 86019efa44
2021-10-23 17:26:26 +09:00
Yu Watanabe
20e458ae3c nspawn: ignore --suppress-sync=yes when seccomp is disabled
Follow-up for 4a4654e024.

Fixes #21090.
2021-10-22 23:43:20 +02:00
Lennart Poettering
dbf1aca619 nspawn: bump RLIMIT_NOFILE for nspawn payload similar to how host PID 1 does it for its payload
We try to pass containers roughly the same rlimits as the host gets from
the kernel. However, this means we'd set the RLIMIT_NOFILE to 4K. Which
is quite limiting though, and is something we actually departed from in
PID1: since 52d6207578 we raise the limit
substantially for all userspace.

Given that nspawn is quite often invoked without proper PID1, let's raise the
limits for container payloads the same way as we do from the real PID1
to its service payloads.
2021-10-22 23:42:55 +02:00
Lennart Poettering
a07ab1dd8c update TODO 2021-10-22 19:20:13 +02:00
Jan Janssen
e6cab77eca sd-boot: Add keys to reboot into firmware interface
This is useful if the auto-firmware setting has been disabled. The
keys used here are based on what the majority of firmware employ in
the wild.
This also ensures there's a chance for the user to discover this in
case they were too slow during POST or simply used the wrong ones.
2021-10-22 19:12:55 +02:00
Lennart Poettering
784c249f41
Merge pull request #21094 from poettering/userns-split
util-lib: split out userns allocation into new helper function
2021-10-22 19:12:21 +02:00
Lennart Poettering
7afef7ed14
Merge pull request #21093 from poettering/homework-trivial-tweaks
homed trivial refactoring
2021-10-22 19:12:01 +02:00
Lennart Poettering
a5bf435ed7 update TODO 2021-10-22 17:57:13 +02:00
Lennart Poettering
a972ab0f25
Merge pull request #21079 from poettering/fd-reopen-directory-tweak
fd-util: when re-opening a directory with fd_reopen() go via openat(……
2021-10-22 17:41:17 +02:00
Lennart Poettering
43cac49092 process-util: move sync() out of freeze()
We are using this for creating userns namespaces, and we really
shouldn't try to sync there. Moreover the use of free() in shutdown code
doesn't need it anyway, since it just sync()ed right before anyway. Only
the third user of freeze() we have actually needs the syc(), hence do it
there and nowhere else.
2021-10-22 16:37:10 +02:00
Lennart Poettering
979b0ff2c4 namespace-util: introduce userns_acquire() as helper for allocating new unbound userns
This returns a namespace fd, and takes a uidmap/gidmap as string. This
is split out out mount-util.c's remount_idmap() logic, so that we can
allocate a userns independently.
2021-10-22 16:34:30 +02:00
Lennart Poettering
8ddefb8eef basic: move freeze() from shared/exec-util.h to basic/process-util.h
That way we can use it in other code from basic/. It fits into both
headers equally well or badly, hence let's just move this one function.
2021-10-22 16:34:30 +02:00
Lennart Poettering
7cb791bcac homework: split home_unshare_and_mount() in two
Previously the call did two things, and the second thing was optional
(depending on first arg being NULL). Let's simplify this and just make
it two distinct functions, where one calls the other.

This should make things a bit more readable, given that we called a
function called "…and_mount()" which didn't actually mount...

No actual code changes, just some refactoring.
2021-10-22 16:09:50 +02:00
Lennart Poettering
baa41cee77 homework: use bit fields where we deal with lots of separate boolean flags
No actual code changes, just making a structure a bit shorter.
2021-10-22 16:03:23 +02:00
Lennart Poettering
498abadb8c homework: add macro for "/run/systemd/user-home-mount"
We use this work dir a various places, and it's easy to mistype, hence
let the compiler detect this for us, and introduce a macro for it.

No code changes, just some search/replace.
2021-10-22 16:01:42 +02:00
Yu Watanabe
197aec7e79 network: dhcp6pd: fix the default value of subnet ID
The type of dhcp6_pd_subnet_id is int64_t.
2021-10-22 21:38:29 +09:00
Lennart Poettering
7c26a631ad varlink: disconnect varlink link in one more case
Previously we'd possibly see POLLHUP on a varlink link, and continue to
run epoll on it even though we have nothing to read nor write anymore.

Let's fix that, and once we know that there's nothing to write anymore
(or we saw a write error already) we'll disconnect after POLLHUP.

Fixes: #20062
2021-10-22 21:37:31 +09:00
Lennart Poettering
61fb966ccc test-fd-util: add test case for fd_reopen() 2021-10-22 14:06:08 +02:00
Lennart Poettering
d6274e6b8f fd-util: tweak error handling in fd_reopen()
If we know that /proc/ works, then ENOENT when reopening an fd means the
fd didn't exist. Let's return the correct error code for that, i.e.
EBADF.
2021-10-22 14:06:08 +02:00
Lennart Poettering
b4f73d1e17 fd-util: when re-opening a directory with fd_reopen() go via openat(…, ".", …)
This adds a tiny shortcut to fd_reopen(): if we are about to reopen the
fd via O_DIRECTORY then we know it#s a directory and we might as well
reopen it via opening "." using the fd as "at fd" in openat().

This has the benefit that we don't need /proc/self/fd/ around for this
special case: fewer sources of errors.
2021-10-22 14:05:12 +02:00
Lennart Poettering
e0e914eaf8 test-networkd-address: fix clock type
The clock to use internally is clock_boottime_or_monotonic(), but the
test used CLOCK_MONOTONIC. After one system suspend the test thus likely
starts to fail.
2021-10-22 13:29:12 +02:00
Jan Janssen
c496451216 sd-boot: Be more precise about secure boot modes
Fixes: #11559
2021-10-22 10:08:38 +02:00
Yu Watanabe
b7f7c78793 network: dhcp6pd: check link state earlier before assigning prefixes to downstream
Also, narrow the acceptable range of the states.
2021-10-22 15:58:42 +09:00
Yu Watanabe
a3ad6acf7b network: dhcp6pd: also call dhcp6_pd_prepare() and dhcp6_pd_finalize() for upstream interface
As now the subnet prefix may be assigned to the upstream interface.
2021-10-22 15:58:38 +09:00
Yu Watanabe
aee21f7f8f
Merge pull request #21081 from mrc0mmand/even-more-coverage-tweaks
test: collect even more coverage
2021-10-22 04:48:40 +09:00
Jonas Dreßler
afa31f8c0f hwdb: Allow USB autosuspend for MS Surface Pro (2017) Type Cover
The Surface Type Covers are known to support USB autosuspend just fine
(and it's also enabled by default on Windows), so enable it in hwdb.
2021-10-21 18:59:06 +01:00
Yu Watanabe
796273775c network: dhcp6pd: not necessary to drop routes when Assign=yes 2021-10-22 02:00:46 +09:00
Yu Watanabe
f45fb83996
Merge pull request #21072 from yuwata/network-address-lifetime
network: address: use usec_t for handling lifetime
2021-10-22 01:46:55 +09:00
Yu Watanabe
a3e33adfb5
Merge pull request #21050 from yuwata/network-bpf-cleanups
libsystemd-network: cleanup BPF code
2021-10-22 01:46:15 +09:00
Frantisek Sumsal
7a6c5b6ab5 test: make the coverage check safer for non-compiled builds 2021-10-21 18:34:21 +02:00
Frantisek Sumsal
9bc10d3109 test: collect the coverage _before_ unmounting the rootfs
d'oh!
2021-10-21 18:12:06 +02:00
Frantisek Sumsal
02d7e73013 test: loosen sandbox restrictions for integration tests as well
Otherwise we miss quite a lot of coverage (mainly from logind,
hostnamed, networkd, and possibly others), since they can't write their
reports with `ProtectSystem=strict`.
2021-10-21 18:06:36 +02:00
Frantisek Sumsal
6c9efba677 test: loosen certain sandbox restrictions when collecting coverage
With `ProtectSystem=strict` gcov is unable to write the *.gcda files
with collected coverage. Let's add a yet another switch to make such
restriction less strict to make gcov happy.

This addresses following errors:
```
...
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/binfmt-util.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/base-filesystem.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/barrier.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/ask-password-api.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/apparmor-util.c.gcda:Cannot open
systemd-networkd[272469]: profiling:/systemd-meson-build/src/shared/libsystemd-shared-249.a.p/acpi-fpdt.c.gcda:Cannot open
...
```
2021-10-21 17:36:45 +02:00
Frantisek Sumsal
dded88acb9 test: wait a bit for the given PID to die if it's still alive
When playing around with the coverage-enabled build I kept hitting
an issue where dnsmasq failed to start because the previous instance was
still shutting down. This should, hopefully, help to mitigate that.
2021-10-21 15:59:57 +02:00
Yu Watanabe
113e124f9b icmp6: shorten code a bit 2021-10-21 22:40:03 +09:00
Yu Watanabe
ea51deb188 dhcp: shorten BPF code a bit
- replace `A = k` and `X = A` with `X = k`,
- replace `A ^= X` and `A == 0` with `A == X`.
- use UINT32_MAX when accept a packet
2021-10-21 22:39:53 +09:00
Yu Watanabe
155943b259 dhcp: rebreak function arguments 2021-10-21 22:39:43 +09:00
Yu Watanabe
b8319d748f dhcp: fix assertions 2021-10-21 22:39:43 +09:00
Yu Watanabe
d70c78131d dhcp: shorten code a bit 2021-10-21 22:39:43 +09:00
Yu Watanabe
36f1955da8 lldp: shorten code a bit 2021-10-21 22:39:43 +09:00
Yu Watanabe
e2c7c38b74 arp-util: shorten BPF code a bit
- replace `A = k` and `X = A` with `X = k`,
- replace `A ^= X` and `A == 0` with `A == X`.
- use UINT32_MAX when accept a packet
2021-10-21 22:39:25 +09:00
Yu Watanabe
16bc8635d5 network: address: use usec_t for handling lifetime
This drops stuct ifa_cacheinfo from Address, and store lifetime with
usec_t.

Why? Now, all requests of address configurations are once stored in
the request queue, and will be processed when it is ready. So, the
timestamp value passed to the kernel must be evaluated on configure.

This also fixes the following two issues.
- Time values in struct ifa_cacheinfo are stored in uint32_t.
  So, the validity check of the address configured by NDisc may fail on
  long running systems.
- If a system uses DHCPv6PD, when an interface may appear or be
  reconfigured later, then the lifetime value may be inappropriate.
  We need to adjust the lifetime with the current time and the timestamp
  of the lease.
2021-10-21 20:58:15 +09:00
Yu Watanabe
03ccc4b423 network: ndisc: rename valid_until -> lifetime_usec 2021-10-21 20:58:15 +09:00
Yu Watanabe
09845af54b network: ndisc: add missing lifetime check 2021-10-21 20:58:15 +09:00
Yu Watanabe
91fc5135e6 network: route: rename lifetime -> lifetime_usec 2021-10-21 20:58:15 +09:00
Zbigniew Jędrzejewski-Szmek
97c373c7de
Merge pull request #21065 from keszybz/efi-warnings
Clean up unused variables in efi code
2021-10-21 08:33:08 +02:00
Yu Watanabe
1c15c3653e network: drop unnecessary header inclusion 2021-10-21 08:32:04 +02:00