]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
2 years agoMerge pull request #20983 from mxre/feature/aarch64
Lennart Poettering [Fri, 15 Oct 2021 08:26:10 +0000 (10:26 +0200)] 
Merge pull request #20983 from mxre/feature/aarch64

[sd-stub] Add support for aarch64 booting via pe-entry point

2 years agoMerge pull request #20980 from bluca/compat_readme
Zbigniew Jędrzejewski-Szmek [Fri, 15 Oct 2021 07:49:29 +0000 (09:49 +0200)] 
Merge pull request #20980 from bluca/compat_readme

docs: add guidelines w.r.t. compatibility to docs/CONTRIBUTING.md

2 years agoMerge pull request #20996 from yuwata/udevadm-trigger-debug
Zbigniew Jędrzejewski-Szmek [Fri, 15 Oct 2021 07:44:59 +0000 (09:44 +0200)] 
Merge pull request #20996 from yuwata/udevadm-trigger-debug

test: show debug and verbose message

2 years agounit: networkd does not require AF_ALG anymore
Yu Watanabe [Thu, 14 Oct 2021 21:31:21 +0000 (06:31 +0900)] 
unit: networkd does not require AF_ALG anymore

As khash is retired.

2 years agoMerge pull request #21001 from poettering/alloca-safe
Yu Watanabe [Thu, 14 Oct 2021 15:57:27 +0000 (00:57 +0900)] 
Merge pull request #21001 from poettering/alloca-safe

honour ALLOCA_MAX limit on all alloca() allocations, not just some

2 years agohomework: fix incorrect error variable use
Lennart Poettering [Thu, 14 Oct 2021 13:40:59 +0000 (15:40 +0200)] 
homework: fix incorrect error variable use

2 years agoMerge pull request #21006 from DaanDeMeyer/mkosi-ordering
Yu Watanabe [Thu, 14 Oct 2021 15:07:21 +0000 (00:07 +0900)] 
Merge pull request #21006 from DaanDeMeyer/mkosi-ordering

mkosi: Add number prefixes to per-distro files for easier overriding

2 years agodoc: document that alloca_safe() and friends are the APIs to use 21001/head
Lennart Poettering [Wed, 13 Oct 2021 12:19:40 +0000 (14:19 +0200)] 
doc: document that alloca_safe() and friends are the APIs to use

2 years agoalloc-util: add strdupa_safe() + strndupa_safe() and use it everywhere
Lennart Poettering [Wed, 13 Oct 2021 10:38:37 +0000 (12:38 +0200)] 
alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhere

Let's define two helpers strdupa_safe() + strndupa_safe() which do the
same as their non-safe counterparts, except that they abort if called
with allocations larger than ALLOCA_MAX.

This should ensure that all our alloca() based allocations are subject
to this limit.

afaics glibc offers three alloca() based APIs: alloca() itself,
strndupa() + strdupa(). With this we have now replacements for all of
them, that take the limit into account.

2 years agojournal: drop unnecessary +1 in newa() expression
Lennart Poettering [Wed, 13 Oct 2021 10:08:20 +0000 (12:08 +0200)] 
journal: drop unnecessary +1 in newa() expression

newa() does this internally anyway, no need to do this explicitly.

2 years agotree-wide: port all calls to alloca() to alloca_safe()
Lennart Poettering [Wed, 13 Oct 2021 10:07:52 +0000 (12:07 +0200)] 
tree-wide: port all calls to alloca() to alloca_safe()

2 years agoalloca-util: drop two unnecessary casts
Lennart Poettering [Wed, 13 Oct 2021 10:07:20 +0000 (12:07 +0200)] 
alloca-util: drop two unnecessary casts

memset() already returns void*, no need to cast it to that.

2 years agoalloc-util: introduce new helper alloca_safe()
Lennart Poettering [Wed, 13 Oct 2021 10:05:54 +0000 (12:05 +0200)] 
alloc-util: introduce new helper alloca_safe()

This is like alloca(), but does two things:

1. Verifies the allocation is smaller than ALLOCA_MAX
2. Ensures we allocate at least one byte

This was previously done manually in all invocations. This adds a handy
helper that does that implicitly.

2 years agocgroup: when checking for legacy controllers, ignore any we don't care about
Dan Streetman [Wed, 13 Oct 2021 11:43:14 +0000 (07:43 -0400)] 
cgroup: when checking for legacy controllers, ignore any we don't care about

2 years agoIgnore local files in subdirectories of mkosi.default.d/ as well 21006/head
Daan De Meyer [Thu, 14 Oct 2021 12:07:16 +0000 (14:07 +0200)] 
Ignore local files in subdirectories of mkosi.default.d/ as well

2 years agomkosi: Add number prefixes to per-distro files for easier overriding
Daan De Meyer [Thu, 14 Oct 2021 12:06:53 +0000 (14:06 +0200)] 
mkosi: Add number prefixes to per-distro files for easier overriding

This allows developers to add override files to override per-distro settings.

2 years agovirt: Support detection for ARM64 Hyper-V guests
Boqun Feng [Wed, 13 Oct 2021 03:32:09 +0000 (11:32 +0800)] 
virt: Support detection for ARM64 Hyper-V guests

The detection of Microsoft Hyper-V VMs is done by cpuid currently,
however there is no cpuid on ARM64. And since ARM64 is now a supported
architecture for Microsoft Hyper-V guests[1], then use DMI tables to
detect a Hyper-V guest, which is more generic and works for ARM64.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7aff79e297ee1aa0126924921fd87a4ae59d2467

2 years agoMerge pull request #21002 from poettering/watchdog-off
Luca Boccassi [Wed, 13 Oct 2021 19:03:06 +0000 (20:03 +0100)] 
Merge pull request #21002 from poettering/watchdog-off

minor tweaks to watchdog configuration logic

2 years ago[sd-stub] Add support for aarch64 booting via pe-entry point 20983/head
Max Resch [Mon, 11 Oct 2021 13:15:30 +0000 (15:15 +0200)] 
[sd-stub] Add support for aarch64 booting via pe-entry point

2 years agoman: document new systemd.watchdog_sec= kernel cmdline option 21002/head
Lennart Poettering [Wed, 13 Oct 2021 11:07:50 +0000 (13:07 +0200)] 
man: document new systemd.watchdog_sec= kernel cmdline option

Follow-up for: b3aa73e4de614c06c4a27e5635967a0392654fbc

2 years agoman: document new "off" setting for systemd-system.conf watchdog settings
Lennart Poettering [Wed, 13 Oct 2021 11:07:27 +0000 (13:07 +0200)] 
man: document new "off" setting for systemd-system.conf watchdog settings

2 years agocore: allow "off" as special watchdog time to be specified
Lennart Poettering [Wed, 13 Oct 2021 11:06:03 +0000 (13:06 +0200)] 
core: allow "off" as special watchdog time to be specified

Right now we already understand "default" as special string for enabling
the watchdog but not reconfiguring its timeout (it is internally mapped
to USEC_MAX). To be systematic this adds "off" as special string for
disabling the watchdog logic (it is internally mapped to 0, which is how
this behaviour was previously requested).

2 years agoMerge pull request #20787 from fbuihuu/watchdog-more-rework
Lennart Poettering [Wed, 13 Oct 2021 10:56:44 +0000 (12:56 +0200)] 
Merge pull request #20787 from fbuihuu/watchdog-more-rework

Watchdog more rework

2 years agocore/bpf-firewall: add missing oom check
Yu Watanabe [Wed, 13 Oct 2021 04:05:17 +0000 (13:05 +0900)] 
core/bpf-firewall: add missing oom check

Fixes CID#1464627.

2 years agowatchdog: rename special string "infinity" taken by the watchdog timeout options... 20787/head
Franck Bui [Fri, 1 Oct 2021 08:42:11 +0000 (10:42 +0200)] 
watchdog: rename special string "infinity" taken by the watchdog timeout options to "default"

2 years agowatchdog: handle timeout programming errors more safely
Franck Bui [Mon, 27 Sep 2021 08:51:28 +0000 (10:51 +0200)] 
watchdog: handle timeout programming errors more safely

If an error happened while the timeout value was being programmed, the error
was ignored and the watchdog module used the new timeout value whereas the
watchdog device was left with the previous one.

Now in cases of error, the device is now disabled and closed if it wasn't
opened already otherwise the previous timeout value is kept so the device is
still pinged at correct intervals.

2 years agocore: introduce systemd.watchdog_sec=<sec> option
Franck Bui [Fri, 17 Sep 2021 09:11:14 +0000 (11:11 +0200)] 
core: introduce systemd.watchdog_sec=<sec> option

2 years agowatchdog: update the documentation
Franck Bui [Mon, 27 Sep 2021 08:16:09 +0000 (10:16 +0200)] 
watchdog: update the documentation

While at it, split the watchdog section into a few paragraphs to make it easier
to read as it becomes lengthy.

2 years agowatchdog: passing 0 to watchdog_setup now closes the watchdog
Franck Bui [Fri, 17 Sep 2021 13:16:38 +0000 (15:16 +0200)] 
watchdog: passing 0 to watchdog_setup now closes the watchdog

Passing 0 meant "disable the watchdog although still kept it opened". However
this case didn't seem to be useful especially since PID1 closes the device if
it is passed the nul timeout.

Hence let's change the meaning of watchdog_setup(0) to match PID1's behavior
which allows to simplify the code a bit.

Hence this patch also drops enable_watchdog().

2 years agowatchdog: pass USEC_INFINITY to watchdog_setup() to reuse the programmed timeout...
Franck Bui [Fri, 17 Sep 2021 08:34:35 +0000 (10:34 +0200)] 
watchdog: pass USEC_INFINITY to watchdog_setup() to reuse the programmed timeout value

This patch changes the meaning of USEC_INFINITY value for the watchdog
module.

Previously passing this value was a NOP. It now has a special meaning: it
requests the watchdog module to read the programmed timeout value and reuse it
for pinging the device.

This is mostly useful when the watchdog is started by the firmware and there's
no way to reconfigure the timeout with a different value
afterwards. "RuntimeWatchdogSec=infinity" in system.conf can now be used rather
than putting an arbitrary value that PID1 will fail to set (even if it still
felt back to the programmed timeout).

Please note that "infinity" is not supposed to restore the default value of the
firmware. If the value is changed after booting then "infinity" would simply
reuse the current programmed value. IOW it's a NOP unless the watchdog was
previously closed and in that case it will be reopened and the last programmed
value reused.

2 years agowatchdog: configuring a timeout value might not be supported by the HW
Franck Bui [Thu, 16 Sep 2021 16:46:04 +0000 (18:46 +0200)] 
watchdog: configuring a timeout value might not be supported by the HW

In that case we should hanlde this case more gracefully by reusing the
programmed value.

Fixes: #20683
2 years agowatchdog: minor optimization in watchdog_setup()
Franck Bui [Fri, 17 Sep 2021 07:21:18 +0000 (09:21 +0200)] 
watchdog: minor optimization in watchdog_setup()

2 years agowatchdog: cleanup: create an helper for each ioctl
Franck Bui [Thu, 16 Sep 2021 14:19:05 +0000 (16:19 +0200)] 
watchdog: cleanup: create an helper for each ioctl

No functional changes.

2 years agoMerge pull request #20987 from yuwata/sd-dhcp6-enum-cleanups
Zbigniew Jędrzejewski-Szmek [Wed, 13 Oct 2021 06:25:37 +0000 (08:25 +0200)] 
Merge pull request #20987 from yuwata/sd-dhcp6-enum-cleanups

sd-dhcp6-client: enum cleanups

2 years agotest: show debug and verbose message 20996/head
Yu Watanabe [Wed, 13 Oct 2021 03:58:24 +0000 (12:58 +0900)] 
test: show debug and verbose message

2 years agosd-device-monitor: update log message to clarify the error will be ignored
Yu Watanabe [Wed, 13 Oct 2021 03:57:40 +0000 (12:57 +0900)] 
sd-device-monitor: update log message to clarify the error will be ignored

2 years agocgroup: check if any controller is in use as v1
Dan Streetman [Tue, 5 Oct 2021 12:49:21 +0000 (08:49 -0400)] 
cgroup: check if any controller is in use as v1

Check if any cgroup controller is currently being used as v1, and if so don't
use cgroup unified mode. This is only checked when there is no cgroup already
mounted, and is most useful when running in a container where the host is using
a legacy or hybrid cgroup, since we can't (fully) use unified cgroup, as the
host kernel has the cgroup controllers in use by v1.

This shouldn't be needed if the container manager has pre-mounted cgroups
appropriately based on the host system cgroup setup, but we can't rely
on that always being the case.

2 years agocore: serialize device cgroup bpf progs across daemon-reload/reexec
Anita Zhang [Mon, 11 Oct 2021 07:25:20 +0000 (00:25 -0700)] 
core: serialize device cgroup bpf progs across daemon-reload/reexec

Follows what was done in b57d75232615f98aefcf41cb145ec2ea3262857d and
adds a test that verifies the device BPF program is not detached during
reload/reexec.

2 years agoMerge pull request #20992 from keszybz/fix-two-outputs
Yu Watanabe [Wed, 13 Oct 2021 02:12:26 +0000 (11:12 +0900)] 
Merge pull request #20992 from keszybz/fix-two-outputs

Fix two outputs

2 years agosd-dhcp6-client: max_retransmit_time must be positive 20987/head
Yu Watanabe [Tue, 12 Oct 2021 09:50:34 +0000 (18:50 +0900)] 
sd-dhcp6-client: max_retransmit_time must be positive

Found by LGTM.com analysis.

2 years agosd-dhcp6-client: introduce dhcp6_option_can_request()
Yu Watanabe [Tue, 12 Oct 2021 06:51:09 +0000 (15:51 +0900)] 
sd-dhcp6-client: introduce dhcp6_option_can_request()

2 years agocoredumpctl: stop truncating information about coredump 20992/head
Zbigniew Jędrzejewski-Szmek [Tue, 12 Oct 2021 17:46:25 +0000 (19:46 +0200)] 
coredumpctl: stop truncating information about coredump

With the changes to limit that print 'Found module …' over and over, we were
hitting the journal field message limit, effectively truncating the info output.

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

2 years agonetwork: do not request RAPID_COMMIT option
Yu Watanabe [Tue, 12 Oct 2021 11:46:18 +0000 (20:46 +0900)] 
network: do not request RAPID_COMMIT option

The option must not be included in OPTION_REQUEST option.
See the "Client ORO" field in
https://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#dhcpv6-parameters-2

This deprecates RapidCommit= setting. Note that sd-dhcp6-client always
sets the RAPID_COMMIT option in the solicit message.

2 years agosystemd-machine-id-setup(1): "machine[d] ID" typo
наб [Tue, 12 Oct 2021 16:52:33 +0000 (18:52 +0200)] 
systemd-machine-id-setup(1): "machine[d] ID" typo

2 years agomove mfree to macro-fundamentals.h
Max Resch [Mon, 11 Oct 2021 23:26:00 +0000 (01:26 +0200)] 
move mfree to macro-fundamentals.h

2 years agoshared/dissect-image: reword debug message
Zbigniew Jędrzejewski-Szmek [Tue, 5 Oct 2021 17:56:46 +0000 (19:56 +0200)] 
shared/dissect-image: reword debug message

I read the message and initially thought that there's some bug in time
subtraction. Let's make it clear that the message is about what we'll
do in the future, and not a report on how we waited up until now.

2 years agosd-dhcp6-client: add missing options
Yu Watanabe [Mon, 11 Oct 2021 21:56:04 +0000 (06:56 +0900)] 
sd-dhcp6-client: add missing options

2 years agosd-dhcp6-client: add missing parenthesis
Yu Watanabe [Mon, 11 Oct 2021 21:07:47 +0000 (06:07 +0900)] 
sd-dhcp6-client: add missing parenthesis

2 years agosd-dhcp6-client: add missing message types
Yu Watanabe [Mon, 11 Oct 2021 20:20:59 +0000 (05:20 +0900)] 
sd-dhcp6-client: add missing message types

This also changes the prefix: DHCP6_ -> DHCP6_MESSAGE_.

2 years agosd-dhcp6-client: name one more enum
Yu Watanabe [Mon, 11 Oct 2021 20:45:23 +0000 (05:45 +0900)] 
sd-dhcp6-client: name one more enum

2 years agosd-dhcp6-client: typedef several enums
Yu Watanabe [Mon, 11 Oct 2021 20:43:04 +0000 (05:43 +0900)] 
sd-dhcp6-client: typedef several enums

Also introduces _MAX and _INVALID for several enums.

2 years agocore: remove refcount for bpf program
alexlzhu [Wed, 18 Aug 2021 23:01:05 +0000 (16:01 -0700)] 
core: remove refcount for bpf program

Currently ref count of bpf-program is kept in user space. However, the
kernel already implements its own ref count. Thus the ref count we keep for
bpf-program is redundant.

This PR removes ref count for bpf program as part of a task to simplify
bpf-program and remove redundancies, which will make the switch to
code-compiled BPF programs easier.

Part of #19270

2 years agonetwork: dhcp6-pd: also assign addresses in IA_PD prefixes on uplink interface
Yu Watanabe [Sun, 10 Oct 2021 14:16:09 +0000 (23:16 +0900)] 
network: dhcp6-pd: also assign addresses in IA_PD prefixes on uplink interface

Closes #20808.

2 years agodocs: add guidelines w.r.t. compatibility to docs/CONTRIBUTING.md 20980/head
Luca Boccassi [Mon, 11 Oct 2021 11:16:44 +0000 (12:16 +0100)] 
docs: add guidelines w.r.t. compatibility to docs/CONTRIBUTING.md

2 years agoLICENSES/README.md: remove reference to non-existing files
Luca Boccassi [Mon, 11 Oct 2021 11:18:02 +0000 (12:18 +0100)] 
LICENSES/README.md: remove reference to non-existing files

All example code was relicensed

2 years agoMerge pull request #20853 from yuwata/network-radv-set-default-timeouts
Zbigniew Jędrzejewski-Szmek [Tue, 12 Oct 2021 08:49:03 +0000 (10:49 +0200)] 
Merge pull request #20853 from yuwata/network-radv-set-default-timeouts

network: RADV: set default timeouts

2 years agosd-boot: Move security and console control protocol to missing_efi.h
Jan Janssen [Thu, 30 Sep 2021 09:12:21 +0000 (11:12 +0200)] 
sd-boot: Move security and console control protocol to missing_efi.h

This also fixes a broken #ifdefs in the header itself.

2 years agosd-boot: Use _cleanup_ in more places
Jan Janssen [Mon, 27 Sep 2021 11:07:16 +0000 (13:07 +0200)] 
sd-boot: Use _cleanup_ in more places

2 years agosd-boot: Remove unnecessary TPM conditionalization
Jan Janssen [Mon, 27 Sep 2021 10:29:00 +0000 (12:29 +0200)] 
sd-boot: Remove unnecessary TPM conditionalization

This is already done in measure.h.

2 years agosd-boot: Use backup LBA location from first GPT header
Jan Janssen [Mon, 27 Sep 2021 10:20:15 +0000 (12:20 +0200)] 
sd-boot: Use backup LBA location from first GPT header

If a disk were dd'd to a lager block device, the last block on it
is not necessarily the backup header.

2 years agosd-boot: Split up xbootldr_open()
Jan Janssen [Mon, 27 Sep 2021 08:54:29 +0000 (10:54 +0200)] 
sd-boot: Split up xbootldr_open()

2 years agosd-boot: Fix xbootldr detection
Jan Janssen [Mon, 27 Sep 2021 08:14:53 +0000 (10:14 +0200)] 
sd-boot: Fix xbootldr detection

The broken crc32 calculation was a copy pasta error introduced in
87167331c902e89bea626c311f0d751ffbc95d73 and luckily has never been
shipped yet.

2 years agosd-boot: Move xbootldr code into its own file
Jan Janssen [Mon, 27 Sep 2021 08:02:50 +0000 (10:02 +0200)] 
sd-boot: Move xbootldr code into its own file

2 years agosd-boot: Invert if in disk_get_part_uuid()
Jan Janssen [Fri, 24 Sep 2021 08:24:38 +0000 (10:24 +0200)] 
sd-boot: Invert if in disk_get_part_uuid()

2 years agoMerge pull request #20985 from yuwata/test-bus-node-enumerator
Yu Watanabe [Tue, 12 Oct 2021 06:20:47 +0000 (15:20 +0900)] 
Merge pull request #20985 from yuwata/test-bus-node-enumerator

test: add more tests for sd-bus node enumerator

2 years agotest: use assert_se() instead of assert()
Yu Watanabe [Mon, 11 Oct 2021 17:39:11 +0000 (02:39 +0900)] 
test: use assert_se() instead of assert()

2 years agoci: use the system llvm-11 package on Focal
Frantisek Sumsal [Mon, 11 Oct 2021 19:12:42 +0000 (21:12 +0200)] 
ci: use the system llvm-11 package on Focal

ATTOW llvm-11 got into focal-updates, which conflicts with llvm-11
provided by the apt.llvm.org repositories. Let's use the system
llvm package if available in such cases to avoid that.

2 years agoMerge pull request #20968 from poettering/homed-pin
Lennart Poettering [Mon, 11 Oct 2021 21:11:03 +0000 (23:11 +0200)] 
Merge pull request #20968 from poettering/homed-pin

homed: pin+lock homes while logged in + keep trying to unmount on logging out + optionally drop caches on logging out

2 years agoMerge pull request #20776 from medhefgo/boot-timeout
Lennart Poettering [Mon, 11 Oct 2021 21:05:37 +0000 (23:05 +0200)] 
Merge pull request #20776 from medhefgo/boot-timeout

sd-boot: Allow disabling timeout

2 years agotest: shorten code a bit 20985/head
Yu Watanabe [Mon, 11 Oct 2021 18:04:06 +0000 (03:04 +0900)] 
test: shorten code a bit

2 years agonetwork: radv: extends lifetime for DNS servers or domains propagated from uplink 20853/head
Yu Watanabe [Tue, 28 Sep 2021 02:45:24 +0000 (11:45 +0900)] 
network: radv: extends lifetime for DNS servers or domains propagated from uplink

Previously, the lifetime was 30 minutes. But it is not necessary to set
to such short time compared with prefix or route prefix lifetime.
Note that the propagated DNS servers and domains are all 'static',
that is, configured in a .network file, and not provided dynamically.
So, it should be safe to use longer lifetime.

2 years agonetwork: radv: set non-zero lifetime for DNS servers and domains by default
Yu Watanabe [Tue, 28 Sep 2021 02:44:27 +0000 (11:44 +0900)] 
network: radv: set non-zero lifetime for DNS servers and domains by default

Closes #20850.

2 years agonetwork: radv: verify [IPv6Prefix] and [IPv6RoutePrefix] sections
Yu Watanabe [Mon, 27 Sep 2021 13:01:14 +0000 (22:01 +0900)] 
network: radv: verify [IPv6Prefix] and [IPv6RoutePrefix] sections

2 years agonetwork: radv: mask unnecessary part of specified addresses
Yu Watanabe [Mon, 27 Sep 2021 13:00:00 +0000 (22:00 +0900)] 
network: radv: mask unnecessary part of specified addresses

2 years agonetwork: radv: make conf parsers not set values into sd_radv_prefix/sd_radv_route_prefix
Yu Watanabe [Mon, 27 Sep 2021 12:07:27 +0000 (21:07 +0900)] 
network: radv: make conf parsers not set values into sd_radv_prefix/sd_radv_route_prefix

Preparation for later commits.

2 years agosd-radv: rename sd_radv_prefix_set_route_prefix() -> sd_radv_route_prefix_set_prefix()
Yu Watanabe [Mon, 27 Sep 2021 12:05:07 +0000 (21:05 +0900)] 
sd-radv: rename sd_radv_prefix_set_route_prefix() -> sd_radv_route_prefix_set_prefix()

2 years agotest: add more node enumerator tests
Yu Watanabe [Mon, 11 Oct 2021 18:02:41 +0000 (03:02 +0900)] 
test: add more node enumerator tests

2 years agoMerge pull request #20981 from poettering/glibc-less-internal
Yu Watanabe [Mon, 11 Oct 2021 17:10:49 +0000 (02:10 +0900)] 
Merge pull request #20981 from poettering/glibc-less-internal

various clean-ups: use less glibc internal symbols, modernize some other stuff

2 years agoMerge pull request #20965 from poettering/getdents
Yu Watanabe [Mon, 11 Oct 2021 17:03:12 +0000 (02:03 +0900)] 
Merge pull request #20965 from poettering/getdents

recurse-dir: use getdents64()

2 years agoMerge pull request #20970 from poettering/token-timeout
Lennart Poettering [Mon, 11 Oct 2021 14:28:58 +0000 (16:28 +0200)] 
Merge pull request #20970 from poettering/token-timeout

cryptsetup: add a timeout for waiting for FIDO2/PKCS#11/TPM2 devices

2 years agoupdate TODO 20968/head
Lennart Poettering [Sat, 28 Aug 2021 05:39:47 +0000 (07:39 +0200)] 
update TODO

2 years agohomed: allow overriding the root directory for home dirs via env var (i.e. use a...
Lennart Poettering [Thu, 7 Oct 2021 20:20:25 +0000 (22:20 +0200)] 
homed: allow overriding the root directory for home dirs via env var (i.e. use a different path than /home/)

This is a debugging feature. It's sometimes incredibly useful to be able
to run a second instance of homed that operates on another dir than
/home/.

Specifically, if you build homed from the source tree you can now run an
instance of it pretty reasonably directly from the build tree via:

  sudo SYSTEMD_HOME_DEBUG_SUFFIX=foo SYSTEMD_HOMEWORK_PATH=$(pwd)/build/systemd-homework SYSTEMD_HOME_ROOT=/home/foo ./build/systemd-homed

And then talk to it via

  sudo SYSTEMD_HOME_DEBUG_SUFFIX=foo homectl …

(you might need to tweak your dbus policy for this to work fully though)

2 years agohomed: optionally, drop caches on logout
Lennart Poettering [Tue, 5 Oct 2021 08:32:25 +0000 (10:32 +0200)] 
homed: optionally, drop caches on logout

Fixes: #20857
2 years agohomed: take BSD file lock on LUKS file while activated
Lennart Poettering [Tue, 5 Oct 2021 08:26:25 +0000 (10:26 +0200)] 
homed: take BSD file lock on LUKS file while activated

Fixes: #19758
2 years agohomed: retry deactivation every 15s until successful
Lennart Poettering [Mon, 30 Aug 2021 11:23:20 +0000 (13:23 +0200)] 
homed: retry deactivation every 15s until successful

Fixes: #17445
2 years agohomed: keep "pinning" fd open while home dir active
Lennart Poettering [Sat, 28 Aug 2021 05:36:25 +0000 (07:36 +0200)] 
homed: keep "pinning" fd open while home dir active

The pin fd keeps the mount busy, ensuring that unmount requests need to
go through us.

Note that this doesn't change too much IRL, since a logged in user
generally has processes keeping the home dir busy anyway. However, in
some corner cases it is safer to protect from accidental unmounts this
way. (e.g. if user manually called "homectl activate" first).

2 years agorm-rf: optionally fsync() after removing directory tree
Lennart Poettering [Tue, 5 Oct 2021 08:32:56 +0000 (10:32 +0200)] 
rm-rf: optionally fsync() after removing directory tree

2 years agovarlink: make one more parameter const
Lennart Poettering [Mon, 11 Oct 2021 13:37:18 +0000 (15:37 +0200)] 
varlink: make one more parameter const

2 years agoutil: define initializer for 'struct ucred' that properly invalidates all fields
Lennart Poettering [Mon, 11 Oct 2021 13:25:14 +0000 (15:25 +0200)] 
util: define initializer for 'struct ucred' that properly invalidates all fields

i.e. let's make sure to invalid uid/gid to UID_INVAID + GID_INVALID
instead of zero.

2 years agovirt: Fix Xen PV detection when nested inside another hypervisor
Bogdan Seniuc [Sat, 9 Oct 2021 12:00:36 +0000 (15:00 +0300)] 
virt: Fix Xen PV detection when nested inside another hypervisor

Currently, when Xen PV domains are nested within a hypervisor which is
detected through CPUID (such as VMware), the detected hypervisor might
not be Xen, because we don't check for Xen until after the CPUID check.

This change moves the Xen check before CPUID checks to fix the issue,
and moves Dom0 checking to detect_vm_xen so that we keep ignoring Xen
when we are in Dom0.

2 years agoLICENSES/README.md: fix typo
Luca Boccassi [Mon, 11 Oct 2021 11:17:31 +0000 (12:17 +0100)] 
LICENSES/README.md: fix typo

2 years agosd-stub: Provide initrd with LINUX_EFI_INITRD_MEDIA_GUID
Max Resch [Thu, 30 Sep 2021 16:43:52 +0000 (18:43 +0200)] 
sd-stub: Provide initrd with LINUX_EFI_INITRD_MEDIA_GUID

Register a LINUX_EFI_INITRD_MEDIA_GUID DevicePath with a LoadFile2Protocol interface and serve the initrd to a supported Linux kernel (Version 5.8+)
Leave the x86 code for older kernels in place until supported kernels become more mainstream

2 years agosort-util: avoid using glibc's internal __compar_d_fn_t type 20981/head
Lennart Poettering [Mon, 11 Oct 2021 12:03:00 +0000 (14:03 +0200)] 
sort-util: avoid using glibc's internal __compar_d_fn_t type

2 years agorecuse-dir: rework to use getdents64() instead of readdir() 20965/head
Lennart Poettering [Fri, 8 Oct 2021 08:48:52 +0000 (10:48 +0200)] 
recuse-dir: rework to use getdents64() instead of readdir()

Let's use the underlying Linux API directly, instead of
opendir()/readdir(). This makes it possible for us to do a single memory
allocation for all directory entries in common cases, instead of one for
each entry.

2 years agotest-recurse-dir: output some simple timing info, comparing recurse_dir() and nftw()
Lennart Poettering [Fri, 8 Oct 2021 08:47:41 +0000 (10:47 +0200)] 
test-recurse-dir: output some simple timing info, comparing recurse_dir() and nftw()

2 years agomissing: add getdents64() syscall wrapper
Lennart Poettering [Fri, 8 Oct 2021 08:46:02 +0000 (10:46 +0200)] 
missing: add getdents64() syscall wrapper

glibc 2.30 (Aug 2019) added a wrapper for getdents64(). For older
versions let's define our own.

(This syscall exists since Linux 2.4, hence should be safe to use for
us)

2 years agolocaled: use PROJECT_FILE rather than __FILE__ for logging
Lennart Poettering [Mon, 11 Oct 2021 11:56:22 +0000 (13:56 +0200)] 
localed: use PROJECT_FILE rather than __FILE__ for logging

All our log.h code uses PROJECT_FILE for this, let's hence use it here
too.

2 years agoethtool-util: let's use userspace types in userspace code
Lennart Poettering [Mon, 11 Oct 2021 11:50:54 +0000 (13:50 +0200)] 
ethtool-util: let's use userspace types in userspace code

Using kernel types __u32 is fine for headers shared by the kernel, but
if we define something in userspace and only use it in userspace, in our
own .c files, let's stick to userspace fixed-length types.

2 years agotree-wide: use C99 __func__ rather than obsolete __FUNCTION__
Lennart Poettering [Mon, 11 Oct 2021 11:50:29 +0000 (13:50 +0200)] 
tree-wide: use C99 __func__ rather than obsolete __FUNCTION__

We use __func__ almost everywhere, but there are some holdouts. Fix
that.

2 years agonetwork: use official bswap_32() rather than inofficial __bswap_32()
Lennart Poettering [Mon, 11 Oct 2021 11:39:25 +0000 (13:39 +0200)] 
network: use official bswap_32() rather than inofficial __bswap_32()

The former is a macro for the latter, but let's use the official API
(the one that has an API).