]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
4 years agohomework: support uidmapping in the "directory" backend 21136/head
Lennart Poettering [Wed, 20 Oct 2021 20:18:12 +0000 (22:18 +0200)] 
homework: support uidmapping in the "directory" backend

4 years agohomework: add new helper call that can shift home dir UID/GID ranges
Lennart Poettering [Wed, 20 Oct 2021 20:12:16 +0000 (22:12 +0200)] 
homework: add new helper call that can shift home dir UID/GID ranges

This new helper is not used yet, but it's useful for apply UID/GID
shifts so that the underlying home dir can use an arbitrary UID (for
example "nobody") and we'll still make it appear as owned by the target
UID.

This operates roughly like this:

1. The relevant underlying UID is mapped to the target UID
2. Everything in the homed UID range except for the target UID is left
   unmapped (and thus will appear as "nobody")
3. Everything in the 16bit UID range outside of the homed UID
   range/target UID/nobody user is mapped to itself
4. Everything else is left unmapped (in particular everything outside of
   the 16 bit range).

Why do it like this?

The 2nd rule done to ensure that any files from homed's managed UID
range that do not match the user's own UID will be shown as "unmapped"
basically. Of course, IRL this should never happen, except if people
managed to manipulate the underlying fs directly.

The 3rd rule is to allow that if devs untar an OS image it more or
less just works as before: 16bit UIDs outside of the homed range will
be mapped onto themselves: you can untar things and tar it back up and
things will just work.

4 years agohomework: rework directory backend to set up mounts in /run/systemd/user-home-mount...
Lennart Poettering [Wed, 20 Oct 2021 20:07:57 +0000 (22:07 +0200)] 
homework: rework directory backend to set up mounts in /run/systemd/user-home-mount before moving them to /home

This does what we already do for the LUKS backend: instead of mounting
the source directory directly to the final home dir, we instead bind
mount it to /run/systemd/user-home-mount (where /run/ is unshared and
specific to our own mount namespace), then adjust its mount flags and
then bind mount it in a single atomic operation into the final
destination, fully set up.

This doesn't improve much on its own, but it makes things a tiny bit
more correct: this way MS_NODEV/MS_NOEXEC/MS_NOSUID will already be
applied when the bind mount appears in the host mount namespace, instead
of being adjusted after the fact.

Doing things this way also makes things work more like the LUKS backend,
reducing surprises. Most importantly it's preparation for doing
uidmapping for directory homes, added in a later commit.

4 years agohomework: when activating a directory, include info about it in resulting record
Lennart Poettering [Wed, 20 Oct 2021 20:03:30 +0000 (22:03 +0200)] 
homework: when activating a directory, include info about it in resulting record

For the other backends we synthesize a "binding" section in the json
record of the user that stores meta info how a user record is "bound" to
the local host. It declares storage info and such. Let's do the same for
the directory/subvolume backends.

4 years agohomework: port home_create_directory_or_subvolume() to use HomeSetup
Lennart Poettering [Wed, 20 Oct 2021 19:45:51 +0000 (21:45 +0200)] 
homework: port home_create_directory_or_subvolume() to use HomeSetup

Let's migrate home_create_directory_or_subvolume() to also use HomeSetup
for storing its runtime objects we'd like to destroy in case of failure.

In the beginning this is just the root_fd, but later on we can add more.

No change in behaviour, just shifting things around.

4 years agohomed: move HOME_UID_{MIN,MAX} into a header we can reuse in homework.c
Lennart Poettering [Wed, 20 Oct 2021 14:14:27 +0000 (16:14 +0200)] 
homed: move HOME_UID_{MIN,MAX} into a header we can reuse in homework.c

4 years agoMerge pull request #21143 from yuwata/sd-radv-router-lifetime 21112/head
Yu Watanabe [Wed, 27 Oct 2021 13:14:35 +0000 (22:14 +0900)] 
Merge pull request #21143 from yuwata/sd-radv-router-lifetime

sd-radv: several cleanups for router lifetime

4 years agobootctl: refuse parsing unknown special '@' entry ids
Lennart Poettering [Wed, 27 Oct 2021 08:30:29 +0000 (10:30 +0200)] 
bootctl: refuse parsing unknown special '@' entry ids

Let's make sure '@' is never written as entry ID into any EFI variable,
as we want the ability to add new ids like this later on, with them
resulting in a clear error on older implementations.

4 years agoMerge pull request #21147 from DaanDeMeyer/hacking-docs
Zbigniew Jędrzejewski-Szmek [Wed, 27 Oct 2021 12:09:46 +0000 (14:09 +0200)] 
Merge pull request #21147 from DaanDeMeyer/hacking-docs

docs: Clean up HACKING.md

4 years agodocs: Specify code block language for mkosi boot instructions 21147/head
Daan De Meyer [Wed, 27 Oct 2021 11:21:57 +0000 (12:21 +0100)] 
docs: Specify code block language for mkosi boot instructions

4 years agodocs: Make mkosi install instructions generic
Daan De Meyer [Wed, 27 Oct 2021 11:08:59 +0000 (12:08 +0100)] 
docs: Make mkosi install instructions generic

4 years agodocs: Extend builddep instructions to include more distros
Daan De Meyer [Wed, 27 Oct 2021 10:30:47 +0000 (11:30 +0100)] 
docs: Extend builddep instructions to include more distros

4 years agoMerge pull request #21144 from yuwata/sd-radv-trivial-cleanups
Yu Watanabe [Wed, 27 Oct 2021 10:52:57 +0000 (19:52 +0900)] 
Merge pull request #21144 from yuwata/sd-radv-trivial-cleanups

sd-radv: trivial cleanups

4 years agoconf-parse: make config_parse_many() optionally save 'struct stat' for each file
Yu Watanabe [Mon, 25 Oct 2021 02:13:27 +0000 (11:13 +0900)] 
conf-parse: make config_parse_many() optionally save 'struct stat' for each file

Fixes #21113.

4 years agodocs/COREDUMP_PACKAGE_METADATA: ELF section should be allocated and 0-padded
Luca Boccassi [Wed, 27 Oct 2021 10:27:50 +0000 (11:27 +0100)] 
docs/COREDUMP_PACKAGE_METADATA: ELF section should be allocated and 0-padded

4 years agonetwork: radv: refuse invalid router lifetime in conf parser 21143/head
Yu Watanabe [Wed, 27 Oct 2021 04:22:49 +0000 (13:22 +0900)] 
network: radv: refuse invalid router lifetime in conf parser

4 years agosd-radv: update how to calculate interval of sending advertisements
Yu Watanabe [Wed, 27 Oct 2021 07:08:22 +0000 (16:08 +0900)] 
sd-radv: update how to calculate interval of sending advertisements

4 years agosd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds
Yu Watanabe [Sun, 24 Oct 2021 16:21:22 +0000 (01:21 +0900)] 
sd-radv: router lifetime must be 0 or between 4 seconds and 9000 seconds

See RFC 4861 section 6.2.1.

4 years agodocs: Remove mkosi symlink instruction from HACKING
Daan De Meyer [Wed, 27 Oct 2021 09:54:53 +0000 (10:54 +0100)] 
docs: Remove mkosi symlink instruction from HACKING

mkosi automatically builds for the host distro which seems a much
better default to encourage since dnf won't be installed on any host
system that's not Fedora anyway.

4 years agodocs: Simplify git instructions in HACKING slightly
Daan De Meyer [Wed, 27 Oct 2021 09:54:24 +0000 (10:54 +0100)] 
docs: Simplify git instructions in HACKING slightly

4 years agodocs: Clean up links in HACKING.md
Daan De Meyer [Wed, 27 Oct 2021 09:50:19 +0000 (10:50 +0100)] 
docs: Clean up links in HACKING.md

4 years agosd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC
Yu Watanabe [Sun, 24 Oct 2021 16:03:30 +0000 (01:03 +0900)] 
sd-radv: introduce RADV_DEFAULT_ROUTER_LIFETIME_USEC

4 years agosd-radv: add several notes about constants
Yu Watanabe [Sun, 24 Oct 2021 15:48:43 +0000 (00:48 +0900)] 
sd-radv: add several notes about constants

4 years agosd-radv: make several constants not exposed
Yu Watanabe [Sun, 24 Oct 2021 15:37:45 +0000 (00:37 +0900)] 
sd-radv: make several constants not exposed

4 years agosd-radv: drop SD_ prefix for unexposed constants
Yu Watanabe [Wed, 27 Oct 2021 09:54:33 +0000 (18:54 +0900)] 
sd-radv: drop SD_ prefix for unexposed constants

4 years agoMerge pull request #21130 from systemd/wip/hadess/webcams
Lennart Poettering [Wed, 27 Oct 2021 10:03:30 +0000 (12:03 +0200)] 
Merge pull request #21130 from systemd/wip/hadess/webcams

Tag IR cameras and allow media* access

4 years agosd-radv: use IPv6 specific functions 21144/head
Yu Watanabe [Sun, 24 Oct 2021 19:39:10 +0000 (04:39 +0900)] 
sd-radv: use IPv6 specific functions

4 years agosd-radv: use assert_return()
Yu Watanabe [Sun, 24 Oct 2021 19:37:11 +0000 (04:37 +0900)] 
sd-radv: use assert_return()

4 years agosd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)
Yu Watanabe [Sun, 24 Oct 2021 15:15:06 +0000 (00:15 +0900)] 
sd-radv: make sd_radv_set_router_lifetime() take usec_t (uint64_t)

4 years agochange indicator used for later versions of VirtualBox (#21127)
Greg Zuro [Wed, 27 Oct 2021 04:02:37 +0000 (21:02 -0700)] 
change indicator used for later versions of VirtualBox (#21127)

Detection of VirtualBox is accomplished in the existing code by *either* `innotek GmbH`
or `Oracle Corporation` existing in any of:

- /sys/class/dmi/id/product_name
- /sys/class/dmi/id/sys_vendor
- /sys/class/dmi/id/board_vendor
- /sys/class/dmi/id/bios_vendor

With Oracle's physical servers, both `/sys/class/dmi/id/sys_vendor` and
`/sys/class/dmi/id/board_vendor` contain `Oracle Corporation`, so those
servers are detected as `oracle` (VirtualBox).

VirtualBox has the following values in the latest versions:

- /sys/class/dmi/id/product_name: `VirtualBox`
- /sys/class/dmi/id/sys_vendor: `innotek GmbH`
- /sys/class/dmi/id/board_vendor: `Oracle Corporation`
- /sys/class/dmi/id/bios_vendor: `innotek GmbH`

Presumably the existing check for `innotek GmbH` is meant to detect
older versions of VirtualBox, while changing the second checked value
from `Oracle Corporation` to `VirtualBox` will reliably detect later and future
versions.

4 years agoMerge pull request #21129 from yuwata/network-dhcp6-pd-vs-ndisc
Yu Watanabe [Wed, 27 Oct 2021 03:15:18 +0000 (12:15 +0900)] 
Merge pull request #21129 from yuwata/network-dhcp6-pd-vs-ndisc

network: several follow-ups for DHCPv6-PD

4 years agohwdb: Tag IR cameras as such 21130/head
Bastien Nocera [Tue, 26 Oct 2021 10:17:27 +0000 (12:17 +0200)] 
hwdb: Tag IR cameras as such

So that front-ends can ignore them if they wish to.

See https://gitlab.gnome.org/GNOME/cheese/-/merge_requests/4

4 years agojson: do something remotely reasonable when we see NaN/infinity
Lennart Poettering [Tue, 26 Oct 2021 13:45:49 +0000 (15:45 +0200)] 
json: do something remotely reasonable when we see NaN/infinity

JSON doesn't have NaN/infinity/-infinity concepts in the spec.
Implementations vary what they do with it. JSON5 + Python simply
generate special words "NAN" and "Inifinity" from it. Others generate
"null" for it.

At this point we never actually want to output this, so let's be
conservative and generate RFC compliant JSON, i.e. convert to null.

One day should JSON5 actually become a thing we can revisit this, but in
that case we should implement things via a flag, and only optinally
process nan/infinity/-infinity.

This patch is extremely simple: whenever accepting a
nan/infinity/-infinity from outside it converts it to NULL. I.e. we
convert on input, not output.

4 years agotest: add a missing `udevadm settle` to the multipath test case
Frantisek Sumsal [Tue, 26 Oct 2021 12:39:02 +0000 (14:39 +0200)] 
test: add a missing `udevadm settle` to the multipath test case

8a088877ab92d3777d7f487393e3daef6edf43ff uncovered a missing `udevadm
settle` in the multipath test case, causing the test to occasionally
fail with:

```
[   41.718617] testsuite-64.sh[806]: + for i in {0..63}
[   41.727917] systemd-udevd[1120]: sdhf: /usr/lib/udev/rules.d/60-persistent-storage.rules:66 Importing properties from results of 'scsi_id --export --whitelisted -d /dev/sdhf'
[   41.728668] testsuite-64.sh[2341]: ++ printf %.4d 1
[   41.733851] systemd-udevd[1415]: sdhc: Adding watch on '/dev/sdhc'
[   41.734477] testsuite-64.sh[806]: + wwid=deaddeadbeef0001
[   41.734477] testsuite-64.sh[806]: + path=/dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.746174] systemd-udevd[1409]: sdhb: 'scsi_id --export --whitelisted -d /dev/sdhb'(out) 'ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20'
[   41.747058] testsuite-64.sh[2342]: ++ readlink -f /dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.755512] testsuite-64.sh[806]: + dmpath=/dev/sdi
[   41.755512] testsuite-64.sh[806]: + lsblk /dev/disk/by-id/wwn-0xdeaddeadbeef0001
[   41.766884] systemd-udevd[1402]: sdhd: 'scsi_id --export --whitelisted -d /dev/sdhd'(out) 'ID_VENDOR=QEMU'
[   41.767532] testsuite-64.sh[2343]: NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
[   41.767532] testsuite-64.sh[2343]: sdi    8:128  0  512B  0 disk
[   41.779219] systemd-udevd[1400]: dm-33: 'kpartx_id 254 33 mpath-3deaddeadbeef0051'(out) 'DM_WWN=0xdeaddeadbeef0051'
[   41.779902] testsuite-64.sh[806]: + multipath -C /dev/sdi
[   41.785296] systemd-udevd[1414]: dm-31: Device processed (SEQNUM=4839, ACTION=change)
[   41.785925] testsuite-64.sh[2344]: 37.658168 | /dev/sdi is not a dm device
```

4 years agoman: adjust the explanations related to the DHCPv6 client starting mode 21129/head
Yu Watanabe [Thu, 14 Oct 2021 10:27:08 +0000 (19:27 +0900)] 
man: adjust the explanations related to the DHCPv6 client starting mode

4 years agonetwork: dhcp6: make UplinkInterface=:self imply WithoutRA=solicit
Yu Watanabe [Thu, 14 Oct 2021 10:10:49 +0000 (19:10 +0900)] 
network: dhcp6: make UplinkInterface=:self imply WithoutRA=solicit

4 years agonetwork: do not restart DHCPv6 client when WithoutRA= is set
Yu Watanabe [Thu, 14 Oct 2021 07:35:29 +0000 (16:35 +0900)] 
network: do not restart DHCPv6 client when WithoutRA= is set

Previously, even if WithoutRA= is specified, the DHCPv6 client may be
restarted in undesired mode when a RA is received.

4 years agonetwork: deprecate ForceDHCPv6PDOtherInformation= setting
Yu Watanabe [Thu, 14 Oct 2021 06:42:33 +0000 (15:42 +0900)] 
network: deprecate ForceDHCPv6PDOtherInformation= setting

The setting is completely meaningless, as WithoutRA= and UseDelegatedPrefix=
in [DHCPv6] section, and DHCPv6Client= in [IPv6AcceptRA] section control
the behavior.

4 years agoMerge pull request #21000 from yuwata/network-dhcp6-pd-introduce-uplink
Yu Watanabe [Tue, 26 Oct 2021 15:32:50 +0000 (00:32 +0900)] 
Merge pull request #21000 from yuwata/network-dhcp6-pd-introduce-uplink

network: dhcp6: introduce UplinkInterface= for prefix delegation

4 years agoMerge pull request #21126 from bluca/meta_arch
Zbigniew Jędrzejewski-Szmek [Tue, 26 Oct 2021 14:24:22 +0000 (16:24 +0200)] 
Merge pull request #21126 from bluca/meta_arch

docs/COREDUMP_PACKAGE_METADATA: add architecture field

4 years agoupdate TODO
Lennart Poettering [Tue, 26 Oct 2021 13:40:25 +0000 (15:40 +0200)] 
update TODO

4 years agodocs/COREDUMP_PACKAGE_METADATA: ELF section should be read-only and 4-bytes-aligned 21126/head
Luca Boccassi [Tue, 26 Oct 2021 11:49:39 +0000 (12:49 +0100)] 
docs/COREDUMP_PACKAGE_METADATA: ELF section should be read-only and 4-bytes-aligned

4 years agotest-network: add test cases for DHCPv6 prefix delegation 21000/head
Yu Watanabe [Thu, 14 Oct 2021 17:51:18 +0000 (02:51 +0900)] 
test-network: add test cases for DHCPv6 prefix delegation

4 years agonetwork: dhcp6: introduce UplinkInterface= for DHCP6 prefix delegation
Yu Watanabe [Wed, 13 Oct 2021 09:00:52 +0000 (18:00 +0900)] 
network: dhcp6: introduce UplinkInterface= for DHCP6 prefix delegation

4 years agonetwork: move config_parse_uplink() to networkd-dhcp-common.[ch]
Yu Watanabe [Wed, 13 Oct 2021 08:15:10 +0000 (17:15 +0900)] 
network: move config_parse_uplink() to networkd-dhcp-common.[ch]

4 years agonetwork: dhcp6pd: do not trigger prefix reassignment for all downstreams when a new...
Yu Watanabe [Thu, 21 Oct 2021 08:49:08 +0000 (17:49 +0900)] 
network: dhcp6pd: do not trigger prefix reassignment for all downstreams when a new downstream appears

It is not necessary to reconfigure other interfaces.

4 years agonetwork: dhcp6: do not reconfigure/restart DHCPv6 clients when a new downstream appears
Yu Watanabe [Wed, 13 Oct 2021 07:52:24 +0000 (16:52 +0900)] 
network: dhcp6: do not reconfigure/restart DHCPv6 clients when a new downstream appears

Previously, when a downstream appears which requests delegated prefix to
be assigned, then possibly restart all DHCPv6 clients for another
interfaces.

This makes networkd always honor the UseDelegatedPrefix= setting, and
not restart DHCPv6 clients.

4 years agonetwork: dhcp6: introduce UseDelegatedPrefix= setting and enable by default
Yu Watanabe [Wed, 13 Oct 2021 07:26:09 +0000 (16:26 +0900)] 
network: dhcp6: introduce UseDelegatedPrefix= setting and enable by default

Previously, the prefix delegation is enabled when at least one
downstream interfaces request it. But, when the DHCPv6 client on the
upstream interface is configured, some downstream interfaces may not
exist yet, nor have .network file assigned.

Also, if a system has thousands of interfaces, then the previous logic
introduce O(n^2) search.

This makes the prefix delegation is always enabled, except when it is
explicitly disabled. Hopefully, that should not break anything, as the
DHCPv6 server should ignore the prefix delegation request if the server
do not have any prefix to delegate.

4 years agohwdb: Allow console users access to media* nodes
Bastien Nocera [Tue, 26 Oct 2021 09:57:30 +0000 (11:57 +0200)] 
hwdb: Allow console users access to media* nodes

Newer webcams and video devices have controls only available through
/dev/media* nodes. Make sure they're accessible in the same way as
/dev/video* nodes.

Closes: #21054
4 years agochange req meson version
gregzuro [Mon, 25 Oct 2021 23:51:40 +0000 (16:51 -0700)] 
change req meson version

since `meson compile` first appears in 0.54.0

4 years agoMerge pull request #21122 from yuwata/network-optimize-reload
Yu Watanabe [Tue, 26 Oct 2021 06:55:01 +0000 (15:55 +0900)] 
Merge pull request #21122 from yuwata/network-optimize-reload

network: slightly optimize "networkctl reload"

4 years agotest-network: reconfigure interface instead of restarting networkd 21122/head
Yu Watanabe [Mon, 25 Oct 2021 17:47:30 +0000 (02:47 +0900)] 
test-network: reconfigure interface instead of restarting networkd

4 years agonetwork: delay dropping addresses or so on reloading .network files
Yu Watanabe [Mon, 25 Oct 2021 17:29:09 +0000 (02:29 +0900)] 
network: delay dropping addresses or so on reloading .network files

When a .network file is updated but its change is not so big, it is not
necessary to first drop all configs and then reassign later again.
This slightly optimize such situation. First foreignize all configs, and
then drop later when it is not requested by the updated .network file.

4 years agohomework: replace homegrown "dir-is-empty" check with dir_is_empty_at()
Lennart Poettering [Thu, 21 Oct 2021 16:07:50 +0000 (18:07 +0200)] 
homework: replace homegrown "dir-is-empty" check with dir_is_empty_at()

4 years agoMerge pull request #21097 from poettering/dir-is-empty-fix
Yu Watanabe [Mon, 25 Oct 2021 23:12:50 +0000 (08:12 +0900)] 
Merge pull request #21097 from poettering/dir-is-empty-fix

dir_is_empty_at() tweaks

4 years agotest: enable debug logging of systemd-udevd
Yu Watanabe [Mon, 25 Oct 2021 20:06:49 +0000 (05:06 +0900)] 
test: enable debug logging of systemd-udevd

Otherwise, it is hard to debug when the test fails.

4 years agonetwork: dhcp6pd: do not assign downstream prefix when RADV is requested but not...
Yu Watanabe [Thu, 21 Oct 2021 14:36:04 +0000 (23:36 +0900)] 
network: dhcp6pd: do not assign downstream prefix when RADV is requested but not configured yet

4 years agonetwork: ndisc: fix behavior when DHCPv6Client=always
Yu Watanabe [Thu, 14 Oct 2021 07:16:07 +0000 (16:16 +0900)] 
network: ndisc: fix behavior when DHCPv6Client=always

The man page says that when 'always' is set, the DHCPv6 client always
starts in managed mode, and that means we need to ignore the RA flags.

4 years agoMerge pull request #21119 from yuwata/network-dhcp6-pd-cleanups
Yu Watanabe [Mon, 25 Oct 2021 23:10:56 +0000 (08:10 +0900)] 
Merge pull request #21119 from yuwata/network-dhcp6-pd-cleanups

network: dhcp6pd: several cleanups

4 years agolibsystemd-network: do not warn when log_dhcp_client() or friends with NULL
Yu Watanabe [Sun, 24 Oct 2021 19:48:39 +0000 (04:48 +0900)] 
libsystemd-network: do not warn when log_dhcp_client() or friends with NULL

4 years agodocs/COREDUMP_PACKAGE_METADATA: add architecture field
Luca Boccassi [Mon, 25 Oct 2021 22:09:43 +0000 (23:09 +0100)] 
docs/COREDUMP_PACKAGE_METADATA: add architecture field

4 years agotree-wide: explicitly unpoison getdents64() memory 21097/head
Lennart Poettering [Mon, 25 Oct 2021 08:59:56 +0000 (10:59 +0200)] 
tree-wide: explicitly unpoison getdents64() memory

Apparently memory sanitizer doesn't grok getdents64() properly. Let's
address that by explicitly marken memory initialized by getdents64() as
unpoisoned.

4 years agotest: add test for dir_is_empty_at()
Lennart Poettering [Fri, 22 Oct 2021 22:32:59 +0000 (00:32 +0200)] 
test: add test for dir_is_empty_at()

4 years agostat-util: make sure dir_is_empty_at() does something useful in all cases
Lennart Poettering [Fri, 22 Oct 2021 22:31:33 +0000 (00:31 +0200)] 
stat-util: make sure dir_is_empty_at() does something useful in all cases

4 years agostat-util: optimize dir_is_empty_at() a bit, by using getdents64()
Lennart Poettering [Fri, 22 Oct 2021 22:30:14 +0000 (00:30 +0200)] 
stat-util: optimize dir_is_empty_at() a bit, by using getdents64()

That way we have a single syscall only for it, instead of the multiple
readdir() and friends do. And we can operate entirely on the stack, no
malloc() implicit.

4 years agodirent-util: add FOREACH macro for iterating through getdents64() buffers
Lennart Poettering [Fri, 22 Oct 2021 22:28:24 +0000 (00:28 +0200)] 
dirent-util: add FOREACH macro for iterating through getdents64() buffers

We already have a similar loop twice, let's make it easier to read via
an iteration macro.

(The new macro is a bit more careful even, as it verifies the full
dirent fits into the remaining buffer when returning it)

4 years agodirent-util: move getdents64() related definitions to common header
Lennart Poettering [Fri, 22 Oct 2021 22:21:20 +0000 (00:21 +0200)] 
dirent-util: move getdents64() related definitions to common header

We want to reuse getdents64() wherever necessary, let's hence move
definitions useful for that into public code.

4 years agostat-util: specify O_DIRECTORY when reopening dir in dir_is_empty_at()
Lennart Poettering [Thu, 21 Oct 2021 16:07:06 +0000 (18:07 +0200)] 
stat-util: specify O_DIRECTORY when reopening dir in dir_is_empty_at()

That way we can fail earlier if the specified fd is not actually a
directory.

(Also, it's not exactly according to standards to open things without
either O_RDONLY/O_RDWR...)

4 years agoudev: do not try to rename interface if it is already up
Yu Watanabe [Sun, 24 Oct 2021 11:43:34 +0000 (20:43 +0900)] 
udev: do not try to rename interface if it is already up

See dev_change_name() in kernel's net/core/dev.c.

Fixes #21105.

4 years agonetwork: rename function
Yu Watanabe [Mon, 25 Oct 2021 17:27:26 +0000 (02:27 +0900)] 
network: rename function

4 years agonetwork: dhcp6: rename variables 21119/head
Yu Watanabe [Wed, 13 Oct 2021 07:12:51 +0000 (16:12 +0900)] 
network: dhcp6: rename variables

4 years agonetwork: dhcp6pd: move logic of acquiring subnet prefix into dhcp6_pd_assign_prefix()
Yu Watanabe [Thu, 21 Oct 2021 07:42:31 +0000 (16:42 +0900)] 
network: dhcp6pd: move logic of acquiring subnet prefix into dhcp6_pd_assign_prefix()

Preparation for later commits.

4 years agonetwork: dhcp6pd: introduce a simplified and unified method to calculate subnet prefix
Yu Watanabe [Wed, 20 Oct 2021 20:16:52 +0000 (05:16 +0900)] 
network: dhcp6pd: introduce a simplified and unified method to calculate subnet prefix

4 years agoMerge pull request #21116 from poettering/test-cleaner
Yu Watanabe [Mon, 25 Oct 2021 14:16:14 +0000 (23:16 +0900)] 
Merge pull request #21116 from poettering/test-cleaner

make tests a bit cleaner in regards to oomd handling

4 years agoMerge pull request #21117 from mrc0mmand/last-coverage-related-tweaks
Yu Watanabe [Mon, 25 Oct 2021 14:15:47 +0000 (23:15 +0900)] 
Merge pull request #21117 from mrc0mmand/last-coverage-related-tweaks

Last batch of coverage-related tweaks

4 years agoMerge pull request #21077 from poettering/mount-setattr
Yu Watanabe [Mon, 25 Oct 2021 14:15:10 +0000 (23:15 +0900)] 
Merge pull request #21077 from poettering/mount-setattr

optimize remounting with mount_setattr() syscall

4 years agonspawn: fix build when SECCOMP is disabled
Yu Watanabe [Mon, 25 Oct 2021 07:42:19 +0000 (16:42 +0900)] 
nspawn: fix build when SECCOMP is disabled

Follow-up for 20e458ae3c3b386e2b720bbd3c37d95781e69ae7.

4 years agotest: merge coverage reports from previous test runs 21117/head
Frantisek Sumsal [Mon, 25 Oct 2021 09:35:47 +0000 (11:35 +0200)] 
test: merge coverage reports from previous test runs

Relevant mainly for tests which utilize both QEMU and nspawn.

4 years agotest: tweak TriggerLimitIntervalSec= when built with coverage
Frantisek Sumsal [Mon, 25 Oct 2021 09:02:22 +0000 (11:02 +0200)] 
test: tweak TriggerLimitIntervalSec= when built with coverage

Collecting coverage causes a significant slowdown in general, but since
this test requires certain timing, we need to tweak the defaults to make
it reliably pass.

4 years agovarlink: don't try to talk to oomd from unit tests 21116/head
Lennart Poettering [Mon, 25 Oct 2021 08:39:32 +0000 (10:39 +0200)] 
varlink: don't try to talk to oomd from unit tests

Talking to external daemons we ourselves maintain is a job for the
integration tests, not the unit tests. This communication is likely to
fail hence don#t even bother.

This makes our tests a bit cleaner.

4 years agocgroup: handle gracefully if we can't read oom_kill cgroup attribute
Lennart Poettering [Mon, 25 Oct 2021 08:39:12 +0000 (10:39 +0200)] 
cgroup: handle gracefully if we can't read oom_kill cgroup attribute

4 years agomount-util: move opening of /proc/self/mountinfo into bind_remount_one_with_mountinfo() 21077/head
Lennart Poettering [Wed, 20 Oct 2021 21:27:04 +0000 (23:27 +0200)] 
mount-util: move opening of /proc/self/mountinfo into bind_remount_one_with_mountinfo()

Let's move things around a bit, and open /proc/self/mountinfo if needed
inside of bind_remount_one_with_mountinfo(). That way bind_remount_one()
can become a superthin inline wrapper around
bind_remount_one_with_mountinfo(). Main benefit is that we don't even
have to open /p/s/mi in case mount_setattr() actually worked for us.

4 years agomount-util: port over bind_remount_recursive_with_mountinfo() to mount_setattr()
Lennart Poettering [Wed, 20 Oct 2021 21:12:53 +0000 (23:12 +0200)] 
mount-util: port over bind_remount_recursive_with_mountinfo() to mount_setattr()

4 years agomount-util: use modern mount_setattr() syscall for bind_remount_one_with_mountinfo()
Lennart Poettering [Wed, 20 Oct 2021 20:57:22 +0000 (22:57 +0200)] 
mount-util: use modern mount_setattr() syscall for bind_remount_one_with_mountinfo()

New kernels have a nice syscall for changing bind mount flags. Let's use
it. This makes the complex libmount based iteration logic unnecessary.

4 years agoTODO: add note about chase_symlink flag
Luca Boccassi [Sun, 24 Oct 2021 16:00:49 +0000 (17:00 +0100)] 
TODO: add note about chase_symlink flag

4 years agoMerge pull request #21108 from mrc0mmand/here-comes-the-coverage
Yu Watanabe [Sun, 24 Oct 2021 13:54:23 +0000 (22:54 +0900)] 
Merge pull request #21108 from mrc0mmand/here-comes-the-coverage

A couple more coverage-related tweaks

4 years agotest: rename the global service override file for coverage runs 21108/head
Frantisek Sumsal [Sat, 23 Oct 2021 20:10:24 +0000 (22:10 +0200)] 
test: rename the global service override file for coverage runs

Otherwise we break TEST-15-DROPIN, since it uses
/usr/lib/systemd/system/service.d/override.conf in some of its
sub-tests.

4 years agoREADME: fix CentOS CI badge
Frantisek Sumsal [Sat, 23 Oct 2021 19:46:53 +0000 (21:46 +0200)] 
README: fix CentOS CI badge

4 years agotest: disable ProtectHome= when collecting coverage as well
Frantisek Sumsal [Sat, 23 Oct 2021 19:20:37 +0000 (21:20 +0200)] 
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:
    * 02d7e73013a92c5580023e4e548d19adbc254dbe
    * 6c9efba67715cd1ced170ac46c04d47934ad276a

4 years agoMerge pull request #21082 from yuwata/network-dhcp6-pd-trivial-cleanups
Yu Watanabe [Sat, 23 Oct 2021 14:58:22 +0000 (23:58 +0900)] 
Merge pull request #21082 from yuwata/network-dhcp6-pd-trivial-cleanups

network: DHCPv6 PD: several trivial cleanups

4 years agoefivars: skip writing if variable is already in wanted state
Anssi Hannula [Mon, 18 Oct 2021 13:31:30 +0000 (16:31 +0300)] 
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.

4 years agohomed: don't drop caches on activation
Lennart Poettering [Fri, 22 Oct 2021 22:42:54 +0000 (00:42 +0200)] 
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 86019efa4416d7b548cab321c15bc22a65463786

4 years agonspawn: ignore --suppress-sync=yes when seccomp is disabled
Yu Watanabe [Fri, 22 Oct 2021 13:32:45 +0000 (22:32 +0900)] 
nspawn: ignore --suppress-sync=yes when seccomp is disabled

Follow-up for 4a4654e0241fbeabecb8587fd3520b6b39264b9c.

Fixes #21090.

4 years agonspawn: bump RLIMIT_NOFILE for nspawn payload similar to how host PID 1 does it for...
Lennart Poettering [Fri, 22 Oct 2021 15:34:46 +0000 (17:34 +0200)] 
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 52d620757817bc0fa7de3ddbe43024544ced7ea0 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.

4 years agoupdate TODO
Lennart Poettering [Fri, 22 Oct 2021 17:19:56 +0000 (19:19 +0200)] 
update TODO

4 years agosd-boot: Add keys to reboot into firmware interface
Jan Janssen [Wed, 20 Oct 2021 10:15:03 +0000 (12:15 +0200)] 
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.

4 years agoMerge pull request #21094 from poettering/userns-split
Lennart Poettering [Fri, 22 Oct 2021 17:12:21 +0000 (19:12 +0200)] 
Merge pull request #21094 from poettering/userns-split

util-lib: split out userns allocation into new helper function

4 years agoMerge pull request #21093 from poettering/homework-trivial-tweaks
Lennart Poettering [Fri, 22 Oct 2021 17:12:01 +0000 (19:12 +0200)] 
Merge pull request #21093 from poettering/homework-trivial-tweaks

homed trivial refactoring

4 years agoupdate TODO
Lennart Poettering [Fri, 22 Oct 2021 15:57:13 +0000 (17:57 +0200)] 
update TODO

4 years agoMerge pull request #21079 from poettering/fd-reopen-directory-tweak
Lennart Poettering [Fri, 22 Oct 2021 15:41:17 +0000 (17:41 +0200)] 
Merge pull request #21079 from poettering/fd-reopen-directory-tweak

fd-util: when re-opening a directory with fd_reopen() go via openat(……