]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agoman: document new has-tpm2 verb 23122/head
Lennart Poettering [Tue, 19 Apr 2022 13:08:23 +0000 (15:08 +0200)] 
man: document new has-tpm2 verb

3 years agocreds-tool: add new "has-tpm2" verb
Lennart Poettering [Tue, 19 Apr 2022 12:47:02 +0000 (14:47 +0200)] 
creds-tool: add new "has-tpm2" verb

Sometimes it's useful from shell scripts to check if we have a working
TPM2 chip around. For example, when putting together encrypted
credentials for the initrd (after all: it might be wise to place the
root pw in a credential for the initrd to consume, but do so only if we
can lock it to the TPM2, and not otherwise, so that we risk nothing).

Hence, let's add a new "systemd-creds has-tpm2" verb: it returns zero if we
have a working TPM2 (which means: supported by kernel + firmware + us),
or non-zero otherwise. Also show which parts are available.

Use-case: in future the 'kernel-install' script should use this when
deciding whether to augment kernels with security sensitive credentials.

3 years agobootctl: use new tpm2_support() helper to show TPM2 info
Lennart Poettering [Tue, 19 Apr 2022 12:45:20 +0000 (14:45 +0200)] 
bootctl: use new tpm2_support() helper to show TPM2 info

Let's improve the output regarding TPM2 support in "bootctl": let's show
whether we have local driver support and/or firmware support, and
colorize it.

(For now, don't show if we natively support TPM2, since the tool is
mostly bout boot time stuff, where it dosn't really matter much what we
do in userspace)

3 years agocondition: rework ConditionSecurity=tpm2 check on top of tpm2_support()
Lennart Poettering [Tue, 19 Apr 2022 12:44:26 +0000 (14:44 +0200)] 
condition: rework ConditionSecurity=tpm2 check on top of tpm2_support()

No change in behaviour. Let's just use our new helper here.

3 years agotpm2-util: add helper that checks for the various facets of TPM2 support
Lennart Poettering [Tue, 19 Apr 2022 12:42:27 +0000 (14:42 +0200)] 
tpm2-util: add helper that checks for the various facets of TPM2 support

So far we were a bit sloppy regarding checks for TPM2 support. Let's
make things more precise and introduce a single helper that checks for
three axis of TPM2 support: whether we have a loaded kernel driver,
whether the firmware used it, and whether we ourselves are compiled for
it.

This only adds the helper. Follow-up patches will use it at various
places.

3 years agoupdate TODO
Lennart Poettering [Wed, 20 Apr 2022 13:32:10 +0000 (15:32 +0200)] 
update TODO

3 years agoupdate TODO
Lennart Poettering [Wed, 20 Apr 2022 12:49:43 +0000 (14:49 +0200)] 
update TODO

3 years agoMerge pull request #23126 from keszybz/clone3-prohibit
Luca Boccassi [Wed, 20 Apr 2022 09:27:58 +0000 (11:27 +0200)] 
Merge pull request #23126 from keszybz/clone3-prohibit

Prohibit clone3() when RestrictNamespaces is used

3 years agocompression: add separate pre-processor definitions
Luca Boccassi [Tue, 19 Apr 2022 14:23:53 +0000 (16:23 +0200)] 
compression: add separate pre-processor definitions

Follow-up for https://github.com/systemd/systemd/commit/cd3c6322dbc6370448bafc216ee4e19e32a79d9e

journal-def.h should be self-contained too, as it represents the journal object ABI.
Duplicate the enums, as they also need to be in config.h for it to be self-contained,
and enums are not available to the preprocessor. Use an assert to ensure they don't
diverge.

3 years agomanager: prohibit clone3() in seccomp filters 23126/head
Zbigniew Jędrzejewski-Szmek [Tue, 19 Apr 2022 10:44:26 +0000 (12:44 +0200)] 
manager: prohibit clone3() in seccomp filters

RestrictNamespaces should block clone3() like flatpak:
https://github.com/flatpak/flatpak/commit/a10f52a7565c549612c92b8e736a6698a53db330

clone3() passes arguments in a structure referenced by a pointer, so we can't
filter on the flags as with clone(). Let's disallow the whole function call.

3 years agonspawn: fix --ephemeral with --machine
Luca Boccassi [Tue, 19 Apr 2022 10:45:26 +0000 (12:45 +0200)] 
nspawn: fix --ephemeral with --machine

Follow-up for https://github.com/systemd/systemd/commit/2362fdde1bd4bf54772383ef29431f683729ba76

When --machine is specified with --ephemeral, no random suffix is added, so
the recently added assert would fail.

Add a top-level variable with the expected file name for nspawn files, and
compute it when the rest of the names are computed.

3 years agovirt: detect OpenStack Nova instance
w30023233 [Tue, 19 Apr 2022 13:05:25 +0000 (21:05 +0800)] 
virt: detect OpenStack Nova instance

3 years agohostnamed: display firmware version
Sonali Srivastava [Mon, 18 Apr 2022 18:47:50 +0000 (00:17 +0530)] 
hostnamed: display firmware version

3 years agoupdate TODO
Lennart Poettering [Tue, 19 Apr 2022 10:43:14 +0000 (12:43 +0200)] 
update TODO

3 years agoshared/seccomp: add note about clone2() being unimportant
Zbigniew Jędrzejewski-Szmek [Tue, 19 Apr 2022 09:56:23 +0000 (11:56 +0200)] 
shared/seccomp: add note about clone2() being unimportant

In case anyone else starts wondering whether it should be listed
as I did…

3 years agohwdb: 60-keyboard: Add Acer Aspire One AO532h keymappings
Hans de Goede [Mon, 18 Apr 2022 18:36:39 +0000 (20:36 +0200)] 
hwdb: 60-keyboard: Add Acer Aspire One AO532h keymappings

Add keymappings for the Acer Aspire One AO532h netbook.

Unmap the brightnesskeys because they send duplicate key events with
the ACPI video bus key events and add a mapping for the bluetooth
on/off hotkey.

3 years agonspawn: fix locating config files with --ephemeral
Luca Boccassi [Mon, 18 Apr 2022 16:39:18 +0000 (18:39 +0200)] 
nspawn: fix locating config files with --ephemeral

When --ephemeral is used, a random 16 characters suffix is added to the image
name, so matching on .nspawn files based on the image name no longer works.

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

3 years agohwdb: Update 60-keyboard.hwdb (#23074)
davijosw [Mon, 18 Apr 2022 11:51:45 +0000 (08:51 -0300)] 
hwdb: Update 60-keyboard.hwdb (#23074)

Fix Fn+F1 (toggle touchpad) that wasn't working.

Closes #23058

3 years agoMerge pull request #23107 from yuwata/man-network-numeric-prefix 23068/head
Yu Watanabe [Sun, 17 Apr 2022 22:02:10 +0000 (07:02 +0900)] 
Merge pull request #23107 from yuwata/man-network-numeric-prefix

man: recommend that .network or friends should have a numeric prefix

3 years agoMerge pull request #23101 from yuwata/sd-device-cleanups
Yu Watanabe [Sun, 17 Apr 2022 22:01:42 +0000 (07:01 +0900)] 
Merge pull request #23101 from yuwata/sd-device-cleanups

sd-device: several cleanups

3 years agoresolve: fix typo in dns_class_is_pseudo()
Yu Watanabe [Sun, 17 Apr 2022 17:09:58 +0000 (02:09 +0900)] 
resolve: fix typo in dns_class_is_pseudo()

3 years agocompression: add build-time option to select default
Luca Boccassi [Sat, 9 Apr 2022 17:38:06 +0000 (18:38 +0100)] 
compression: add build-time option to select default

Compression and decompression are controlled by the same build flag,
so if one wants to use, say, LZ4 to compress, ZSTD has to be disabled,
which means one loses the ability to read zstd-compressed journals.

Add a default-compression meson option, that allows to select any of
the available compression algorithms as the default.

3 years agosd-device: rename arguments and variables 23101/head
Yu Watanabe [Sun, 17 Apr 2022 07:09:57 +0000 (16:09 +0900)] 
sd-device: rename arguments and variables

3 years agosd-device: fix possible use-of-uninitialized-value
Yu Watanabe [Sun, 17 Apr 2022 07:09:11 +0000 (16:09 +0900)] 
sd-device: fix possible use-of-uninitialized-value

3 years agosd-device: use ERRNO_IS_DEVICE_ABSENT() at one more place
Yu Watanabe [Sun, 17 Apr 2022 05:59:06 +0000 (14:59 +0900)] 
sd-device: use ERRNO_IS_DEVICE_ABSENT() at one more place

3 years agosd-device: rename function arguments for storing results
Yu Watanabe [Sun, 17 Apr 2022 05:51:13 +0000 (14:51 +0900)] 
sd-device: rename function arguments for storing results

3 years agosd-device: use correct type and parser for device node uid and gid
Yu Watanabe [Sun, 17 Apr 2022 05:45:45 +0000 (14:45 +0900)] 
sd-device: use correct type and parser for device node uid and gid

3 years agosd-device: shorten code a bit
Yu Watanabe [Sun, 17 Apr 2022 05:29:07 +0000 (14:29 +0900)] 
sd-device: shorten code a bit

3 years agosd-device: use path_extract_filename() at one more place
Yu Watanabe [Sun, 17 Apr 2022 05:25:27 +0000 (14:25 +0900)] 
sd-device: use path_extract_filename() at one more place

This also does several cleanups.

3 years agosd-device: reset sysname and sysnum on renaming
Yu Watanabe [Sun, 17 Apr 2022 04:38:39 +0000 (13:38 +0900)] 
sd-device: reset sysname and sysnum on renaming

3 years agosd-device: reduce indentation
Yu Watanabe [Sun, 17 Apr 2022 04:11:08 +0000 (13:11 +0900)] 
sd-device: reduce indentation

3 years agosd-device: verify new syspath on renaming
Yu Watanabe [Sun, 17 Apr 2022 04:07:38 +0000 (13:07 +0900)] 
sd-device: verify new syspath on renaming

3 years agoman: DHCPPrefixDelegation= needs to be enabled on downstream side for assigning deleg... 23107/head
Yu Watanabe [Sun, 17 Apr 2022 18:58:29 +0000 (03:58 +0900)] 
man: DHCPPrefixDelegation= needs to be enabled on downstream side for assigning delegated prefixes

Closes #23041.

3 years agoman: recommend that .network or friends should have a numeric prefix
Yu Watanabe [Sun, 17 Apr 2022 18:08:55 +0000 (03:08 +0900)] 
man: recommend that .network or friends should have a numeric prefix

Closes #23105.

3 years agoudevadm: info: also show parent devices by --tree
Yu Watanabe [Thu, 14 Apr 2022 08:12:10 +0000 (17:12 +0900)] 
udevadm: info: also show parent devices by --tree

3 years agoMerge pull request #23100 from yuwata/network-fix-tunnel-address-parser
Luca Boccassi [Sun, 17 Apr 2022 19:24:38 +0000 (21:24 +0200)] 
Merge pull request #23100 from yuwata/network-fix-tunnel-address-parser

network: fix tunnel address parser

3 years agoAdd test support for systemd-tmpfiles.standalone
Mike Gilbert [Sun, 17 Apr 2022 13:48:28 +0000 (09:48 -0400)] 
Add test support for  systemd-tmpfiles.standalone

3 years agoMerge pull request #23093 from mrc0mmand/test-md-partitions
Yu Watanabe [Sun, 17 Apr 2022 16:26:30 +0000 (01:26 +0900)] 
Merge pull request #23093 from mrc0mmand/test-md-partitions

test: more MD coverage improvements

3 years agotest: partition the MD device 23093/head
Frantisek Sumsal [Fri, 15 Apr 2022 17:01:45 +0000 (19:01 +0200)] 
test: partition the MD device

Also, loop the assemble/disassemble part couple of times to test udev
even harder.

Resolves: #23092

3 years agotest: cleanup after the MD + LVM test case as well
Frantisek Sumsal [Sat, 16 Apr 2022 20:43:20 +0000 (05:43 +0900)] 
test: cleanup after the MD + LVM test case as well

3 years agosystemctl: colorize "enabled" in 'systemctl status ...'
amarjargal [Fri, 15 Apr 2022 17:29:15 +0000 (01:29 +0800)] 
systemctl: colorize "enabled" in 'systemctl status ...'

"enabled" state is highlighted in green and "disabled" state is
highlighted in yellow because I felt that white and grey colors were not
so distinguishable. Other states are not highlighted. Any other coloring
suggestions are welcome!

Closes #16932.

3 years agonetwork: l2tp: refuse null address 23100/head
Yu Watanabe [Sun, 17 Apr 2022 00:29:24 +0000 (09:29 +0900)] 
network: l2tp: refuse null address

3 years agonetwork: tunnel: handle null address as "any"
Yu Watanabe [Sun, 17 Apr 2022 00:19:26 +0000 (09:19 +0900)] 
network: tunnel: handle null address as "any"

Fixes oss-fuzz#44881 (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=44881).

Fixes #23098.

3 years agoRevert "lgtm: disable cpp/missing-return (again)"
Frantisek Sumsal [Sat, 16 Apr 2022 09:36:02 +0000 (11:36 +0200)] 
Revert "lgtm: disable cpp/missing-return (again)"

This reverts commit 000096f4c61477f96fbd9c48b2d772c7c690d259.

After a couple of manual tests LGTM finally appears to have the fix for
https://github.com/github/codeql/issues/8409, so let's reenable the
check for the last time.

3 years agoMerge pull request #23089 from yuwata/sd-device-use-path_extract_filename
Yu Watanabe [Sat, 16 Apr 2022 05:33:58 +0000 (14:33 +0900)] 
Merge pull request #23089 from yuwata/sd-device-use-path_extract_filename

sd-device: use path_extract_filename()

3 years agoMerge pull request #23021 from fbuihuu/tmpfiles-fix-precedence-with-plus-sign
Yu Watanabe [Fri, 15 Apr 2022 16:36:51 +0000 (01:36 +0900)] 
Merge pull request #23021 from fbuihuu/tmpfiles-fix-precedence-with-plus-sign

Tmpfiles fix precedence with plus sign

3 years agoshared/install: fix crash when reenable is called without --root
Zbigniew Jędrzejewski-Szmek [Tue, 12 Apr 2022 18:42:32 +0000 (20:42 +0200)] 
shared/install: fix crash when reenable is called without --root

3 years agotest: add tests for sd_device_get_sysnum() 23089/head
Yu Watanabe [Fri, 15 Apr 2022 05:06:56 +0000 (14:06 +0900)] 
test: add tests for sd_device_get_sysnum()

3 years agosd-device: shorten code a bit
Yu Watanabe [Fri, 15 Apr 2022 04:45:26 +0000 (13:45 +0900)] 
sd-device: shorten code a bit

3 years agosd-device: use path_extract_filename() at one more place
Yu Watanabe [Fri, 15 Apr 2022 04:29:53 +0000 (13:29 +0900)] 
sd-device: use path_extract_filename() at one more place

3 years agonetworkctl: obey --full with lldp command
Simon Ellmann [Wed, 13 Apr 2022 19:53:10 +0000 (04:53 +0900)] 
networkctl: obey --full with lldp command

Do not ellipsize output when -l or --full is handed to networkctl lldp.

Fixes #22806.

3 years agofs-util: use path_extract_filename() at one more place
Yu Watanabe [Fri, 15 Apr 2022 04:33:43 +0000 (13:33 +0900)] 
fs-util: use path_extract_filename() at one more place

3 years agoMerge pull request #23090 from yuwata/firewall-util-cleanups
Yu Watanabe [Fri, 15 Apr 2022 11:11:58 +0000 (20:11 +0900)] 
Merge pull request #23090 from yuwata/firewall-util-cleanups

firewall-util: cleanups

3 years agofirewall-util: inline iterator and add several missing assertions 23090/head
Yu Watanabe [Fri, 15 Apr 2022 08:38:31 +0000 (17:38 +0900)] 
firewall-util: inline iterator and add several missing assertions

3 years agosd-netlink: use correct type of iterator
Yu Watanabe [Fri, 15 Apr 2022 08:37:52 +0000 (17:37 +0900)] 
sd-netlink: use correct type of iterator

3 years agoMerge pull request #23081 from mrc0mmand/more-md-tests
Yu Watanabe [Fri, 15 Apr 2022 05:30:55 +0000 (14:30 +0900)] 
Merge pull request #23081 from mrc0mmand/more-md-tests

test: extend the MD coverage with more RAID levels and LVM

3 years agoboot: Add missing continue statements
Jan Janssen [Thu, 14 Apr 2022 11:34:07 +0000 (13:34 +0200)] 
boot: Add missing continue statements

Fortunately, this was not causing any issues as it will just try
the other option branches unsuccessfuly before going to the next
config line.

3 years agoupdate TODO
Lennart Poettering [Thu, 14 Apr 2022 16:37:32 +0000 (18:37 +0200)] 
update TODO

3 years agoupdate TODO
Lennart Poettering [Thu, 14 Apr 2022 13:15:11 +0000 (15:15 +0200)] 
update TODO

3 years agotest: add a test case for MD + LVM + ext4 23081/head
Frantisek Sumsal [Thu, 14 Apr 2022 10:54:16 +0000 (12:54 +0200)] 
test: add a test case for MD + LVM + ext4

3 years agotest: extend testcase_mdadm_basic() with RAID 5 and 10
Frantisek Sumsal [Thu, 14 Apr 2022 10:30:42 +0000 (12:30 +0200)] 
test: extend testcase_mdadm_basic() with RAID 5 and 10

3 years agoMerge pull request #23073 from medhefgo/boot-fixes
Yu Watanabe [Thu, 14 Apr 2022 07:58:21 +0000 (16:58 +0900)] 
Merge pull request #23073 from medhefgo/boot-fixes

boot: Some fixes

3 years agoAdd ConditionCPUFeature to load-fragment-gperf.gperf (#23076)
Eduard Tolosa [Thu, 14 Apr 2022 06:30:03 +0000 (01:30 -0500)] 
Add ConditionCPUFeature to load-fragment-gperf.gperf (#23076)

Fixes #23075

3 years agoboot: Use correct device root when loading device trees 23073/head
Jan Janssen [Thu, 10 Mar 2022 11:32:15 +0000 (12:32 +0100)] 
boot: Use correct device root when loading device trees

If the boot entry comes from a XBOOT partition, we have to load the device
tree from that instead of the ESP.

3 years agoboot: Fix integer format specifiers
Jan Janssen [Wed, 16 Feb 2022 11:28:20 +0000 (12:28 +0100)] 
boot: Fix integer format specifiers

gnu-efi only knows two sizes for formatting integers: 32bit without
a length prefix and 64bit with 'l' prefix. Provide a PRI-style format
specifier for (U)INTN so that Print() can read the right amount of
bytes instead of printing garbage or worse.

3 years agoMerge pull request #23011 from mrc0mmand/TEST-64-md
Lennart Poettering [Wed, 13 Apr 2022 20:26:50 +0000 (22:26 +0200)] 
Merge pull request #23011 from mrc0mmand/TEST-64-md

test: add MD-related tests to TEST-64

3 years agoMerge pull request #22759 from msekletar/issue-18077-long-sysfs-paths-hashing
Lennart Poettering [Wed, 13 Apr 2022 20:21:38 +0000 (22:21 +0200)] 
Merge pull request #22759 from msekletar/issue-18077-long-sysfs-paths-hashing

Create "hashed" unit names from long paths

3 years agoMerge pull request #23070 from poettering/devnum-split
Yu Watanabe [Wed, 13 Apr 2022 18:45:39 +0000 (03:45 +0900)] 
Merge pull request #23070 from poettering/devnum-split

basic: some devnum handling tweaks and refactorings

3 years agoMerge pull request #22969 from poettering/udevadm-tree
Yu Watanabe [Wed, 13 Apr 2022 18:45:14 +0000 (03:45 +0900)] 
Merge pull request #22969 from poettering/udevadm-tree

udevadm: add new "udevadm info --tree" command

3 years agotests: reflect that we can now handle devices with very long sysfs paths 22759/head
Michal Sekletar [Thu, 24 Mar 2022 18:24:16 +0000 (19:24 +0100)] 
tests: reflect that we can now handle devices with very long sysfs paths

3 years agotest: add MD-related tests to TEST-64 23011/head
Frantisek Sumsal [Thu, 7 Apr 2022 16:03:17 +0000 (18:03 +0200)] 
test: add MD-related tests to TEST-64

3 years agoudev: set ID_IGNORE_DISKSEQ for md devices
Yu Watanabe [Wed, 13 Apr 2022 14:09:14 +0000 (23:09 +0900)] 
udev: set ID_IGNORE_DISKSEQ for md devices

3 years agoudev: do not create disk/by-diskseq symlink when ID_IGNORE_DISKSEQ property is set
Yu Watanabe [Wed, 13 Apr 2022 14:04:47 +0000 (23:04 +0900)] 
udev: do not create disk/by-diskseq symlink when ID_IGNORE_DISKSEQ property is set

3 years agosd-device: skip diskseq verification when ID_IGNORE_DISKSEQ property is set
Yu Watanabe [Wed, 13 Apr 2022 14:01:33 +0000 (23:01 +0900)] 
sd-device: skip diskseq verification when ID_IGNORE_DISKSEQ property is set

Some drivers do not announce the diskseq change.
E.g. for md devices, the kernel increments the diskseq *after*
emitting a 'change' uevent when backing block devices are added to
a md device, and udevd does not receive no uevent which contains
the new diskseq.

3 years agodevnum-util: catch potential stack overruns early 23070/head
Lennart Poettering [Wed, 13 Apr 2022 14:25:32 +0000 (16:25 +0200)] 
devnum-util: catch potential stack overruns early

3 years agodevnum-util: define helper macros for formatting devnum major/minor pairs
Lennart Poettering [Wed, 13 Apr 2022 14:13:10 +0000 (16:13 +0200)] 
devnum-util: define helper macros for formatting devnum major/minor pairs

And port some parts over.

3 years agobasic: split out dev_t related calls into new devno-util.[ch]
Lennart Poettering [Wed, 13 Apr 2022 13:38:21 +0000 (15:38 +0200)] 
basic: split out dev_t related calls into new devno-util.[ch]

No actual code changes, just splitting out of some dev_t handling
related calls from stat-util.[ch], they are quite a number already, and
deserve their own module now I think.

Also, try to settle on the name "devnum" as the name for the concept,
instead of "devno" or "dev" or "devid". "devnum" is the name exported in
udev APIs, hence probably best to stick to that. (this just renames a
few symbols to "devum", local variables are left untouched, to make the
patch not too invasive)

No actual code changes.

3 years agoudev: create disk/by-diskseq symlink only when the device has diskseq
Yu Watanabe [Sun, 10 Apr 2022 16:42:59 +0000 (01:42 +0900)] 
udev: create disk/by-diskseq symlink only when the device has diskseq

Follow-up for 0d08db7f89ee665a9dcb6dd66c1f9e203192e8ec.

3 years agoupdate TODO 22969/head
Lennart Poettering [Tue, 5 Apr 2022 08:21:14 +0000 (10:21 +0200)] 
update TODO

3 years agoudevadm: use xopendirat() where appropriate
Lennart Poettering [Tue, 12 Apr 2022 16:30:49 +0000 (18:30 +0200)] 
udevadm: use xopendirat() where appropriate

And while we are at it, let's use more appropriate open flags.

O_NONBLOCk is pointless in combination with O_NOFOLLOW.

O_NOFOLLOW makes a ton of sense otoh, since the inode is supposed to be
a dir, we just checked.

THe other flags are implied by xopendirat()

3 years agoudevadm: add new --tree mode to "udevadm info"
Lennart Poettering [Tue, 5 Apr 2022 08:20:18 +0000 (10:20 +0200)] 
udevadm: add new --tree mode to "udevadm info"

sysfs is a tree, hence let's a mode that allows showing it as such.

3 years agosd-device: include parent devices in enumeration
Lennart Poettering [Mon, 11 Apr 2022 21:13:40 +0000 (23:13 +0200)] 
sd-device: include parent devices in enumeration

3 years agosd-device: properly support some corner case syspath
Lennart Poettering [Tue, 12 Apr 2022 13:45:48 +0000 (15:45 +0200)] 
sd-device: properly support some corner case syspath

3 years agosd-device: add some comments
Lennart Poettering [Tue, 12 Apr 2022 13:45:07 +0000 (15:45 +0200)] 
sd-device: add some comments

3 years agosd-device: filter regular files when enumerating
Lennart Poettering [Tue, 12 Apr 2022 09:25:00 +0000 (11:25 +0200)] 
sd-device: filter regular files when enumerating

Currently if enumerating with debug logging you'll likely see something
like this:

sd-device: the syspath "/sys/class/devcoredump/disabled" is not a directory.
sd-device: the syspath "/sys/class/firmware/timeout" is not a directory.
sd-device: the syspath "/sys/class/zram-control/hot_remove" is not a directory.
sd-device: the syspath "/sys/class/zram-control/hot_add" is not a directory.
sd-device: the syspath "/sys/class/drm/version" is not a directory.

This is because these sysfs classes place regular files in these
directories, which we so far didn't expect.

Let's filter them early, and only bother with enumerated inodes if they
actually are dirs or symlinks, i.e. can be kobject dirs. Regular file
definitely never are kobject dirs...

3 years agosd-device: split out checking of matches from enumerator_scan_dir_and_add_devices()
Lennart Poettering [Mon, 11 Apr 2022 21:00:52 +0000 (23:00 +0200)] 
sd-device: split out checking of matches from enumerator_scan_dir_and_add_devices()

No change in behaviour, just some splitting out of code.

3 years agosd-device: generate e better error code when trying to allocate sd_device for non-dir
Lennart Poettering [Tue, 12 Apr 2022 09:42:30 +0000 (11:42 +0200)] 
sd-device: generate e better error code when trying to allocate sd_device for non-dir

Currently, for sysfs paths outside of /sys/devices/ we do better
checking if something is a suitable path: we check if it's actually a
directory, and if not return ENODEV.

Let's make the codepath for nodes *inside* of /sys/device/ similar:
let's also return ENODEV if the path supplied is not a directory.

Previously, we'd return ENOTDIR in that case, which is quite confusing I
think.

3 years agosd-device: don't accept non-sysfs paths
Lennart Poettering [Mon, 11 Apr 2022 20:04:06 +0000 (22:04 +0200)] 
sd-device: don't accept non-sysfs paths

There are some file systems mounted below /sys/ that are not actually
sysfs, i.e. are not arranged in a sysfs/kobject style. Let's refuse
those early. (Example, /sys/fs/cgroup/ and similar.)

(Also, let's add an env var for this, so that it can be turned off for
test cases.)

3 years agosd-device: use chase_symlinks() O_PATH fd
Lennart Poettering [Mon, 11 Apr 2022 20:02:23 +0000 (22:02 +0200)] 
sd-device: use chase_symlinks() O_PATH fd

chase_symlinks() can return its last O_PATH fd to us. Let's use that and
make the access() check a bit tighter by going via faccessat() on the
O_PATH fd.

This doesn't really change too much, but is nice in context of the next
commit, which uses the O_PATH fd in one other way.

3 years agoMerge pull request #23065 from poettering/env-var-generator
Lennart Poettering [Wed, 13 Apr 2022 11:44:30 +0000 (13:44 +0200)] 
Merge pull request #23065 from poettering/env-var-generator

pid1: pass additional env vars about exec context to generators

3 years agoupdate TODO 23065/head
Lennart Poettering [Tue, 12 Apr 2022 21:47:07 +0000 (23:47 +0200)] 
update TODO

3 years agoman: document new generator env vars
Lennart Poettering [Tue, 12 Apr 2022 21:29:36 +0000 (23:29 +0200)] 
man: document new generator env vars

3 years agoman: rebreak all paragraphs in systemd.generator(7)
Lennart Poettering [Tue, 12 Apr 2022 21:00:45 +0000 (23:00 +0200)] 
man: rebreak all paragraphs in systemd.generator(7)

3 years agopid1: pass useful env vars to generators
Lennart Poettering [Tue, 12 Apr 2022 13:44:46 +0000 (15:44 +0200)] 
pid1: pass useful env vars to generators

This is inspired by this:

    https://github.com/systemd/zram-generator/blob/main/src/generator.rs#L29

Given it's easy for PID 1 to pass this to generators, I thin we should.
All generators not written by us likely want to know these things so
that the can adjust to the execution environment.

3 years agoMerge pull request #23002 from yuwata/udev-use-child-event
Zbigniew Jędrzejewski-Szmek [Wed, 13 Apr 2022 06:32:16 +0000 (08:32 +0200)] 
Merge pull request #23002 from yuwata/udev-use-child-event

udev: use child event source

3 years agoMerge pull request #23061 from poettering/chase-symlinks-tweaks,-new
Lennart Poettering [Tue, 12 Apr 2022 20:57:17 +0000 (22:57 +0200)] 
Merge pull request #23061 from poettering/chase-symlinks-tweaks,-new

some chase_symlinks() tweaks

3 years agocore: use assert_se() which takes side-effect
Yu Watanabe [Tue, 12 Apr 2022 14:52:22 +0000 (23:52 +0900)] 
core: use assert_se() which takes side-effect

Fixes #23059.

3 years agoudev: use child event source to manage workers 23002/head
Yu Watanabe [Wed, 6 Apr 2022 18:00:20 +0000 (03:00 +0900)] 
udev: use child event source to manage workers

3 years agoudev: use EventResult type
Yu Watanabe [Wed, 6 Apr 2022 17:58:43 +0000 (02:58 +0900)] 
udev: use EventResult type

This also adds EVENT_RESULT_SUCCESS for readability.

3 years agosd-event: make inotify event work after the process is forked
Yu Watanabe [Fri, 8 Apr 2022 23:50:44 +0000 (08:50 +0900)] 
sd-event: make inotify event work after the process is forked