Compare commits

..

7 Commits

Author SHA1 Message Date
Yu Watanabe 55c734b2aa
Merge c6679e0bd4 into 94eacb9329 2024-11-24 19:20:11 +01:00
Yu Watanabe c6679e0bd4 TEST-17: check if udevd can be restarted within reasonably short time
Even if there are long running spawned processes.
2024-11-24 16:57:59 +09:00
Yu Watanabe b91cc106dd test-udev-spawn: add test cases for SIGTERM handling 2024-11-24 16:57:59 +09:00
Yu Watanabe 993737ccd3 udev-spawn: kill spawned process when worker received SIGTERM and skip remaining executions.
Otherwise, if long running program is spawned (of course, that's bad
configuration, but anyway), restarting udevd also takes longer, and
may be killed forcibly.
2024-11-24 16:57:55 +09:00
Yu Watanabe 3c48a15bf3 test-udev-spawn: migrate to use ASSERT_XYZ() 2024-11-24 16:54:18 +09:00
Yu Watanabe 388151b721 test: add reproducer for issue #35329
Without the previous commit, the test case will fail.
2024-11-24 14:35:05 +09:00
Yu Watanabe ca0cef2869 core/device: ignore ID_PROCESSING udev property on enumerate
This partially reverts the commit 405be62f05
"tree-wide: refuse enumerated device with ID_PROCESSING=1".

Otherwise, when systemd-udev-trigger.service is started just before
daemon-reexec, which can be easily happen on update, then udev database
files for many devices may have ID_PROCESSING=1 property, thus devices may
not enumerated on daemon-reexec. That causes many units especially mount
units deactivated after daemon-reexec.

Fixes #35329.
2024-11-24 14:30:11 +09:00
11 changed files with 15 additions and 32 deletions

View File

@ -1,18 +1,12 @@
#!/bin/bash #!/bin/bash
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
if command -v flatpak-spawn >/dev/null; then MKOSI_CONFIG="$(mkosi --json summary | jq -r .Images[-1])"
SPAWN=(flatpak-spawn --host)
else
SPAWN=()
fi
MKOSI_CONFIG="$("${SPAWN[@]}" --host mkosi --json summary | jq -r .Images[-1])"
DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")" DISTRIBUTION="$(jq -r .Distribution <<< "$MKOSI_CONFIG")"
RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")" RELEASE="$(jq -r .Release <<< "$MKOSI_CONFIG")"
ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")" ARCH="$(jq -r .Architecture <<< "$MKOSI_CONFIG")"
exec "${SPAWN[@]}" mkosi \ exec mkosi \
--incremental=strict \ --incremental=strict \
--build-sources-ephemeral=no \ --build-sources-ephemeral=no \
--format=none \ --format=none \

View File

@ -38,8 +38,9 @@ SignExpectedPcr=yes
[Content] [Content]
ExtraTrees= ExtraTrees=
mkosi.extra.common
mkosi.crt:/usr/lib/verity.d/mkosi.crt # sysext verification key mkosi.crt:/usr/lib/verity.d/mkosi.crt # sysext verification key
mkosi.leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions
mkosi.coredump-journal-storage.conf:/usr/lib/systemd/coredump.conf.d/10-coredump-journal-storage.conf
%O/minimal-0.root-%a.raw:/usr/share/minimal_0.raw %O/minimal-0.root-%a.raw:/usr/share/minimal_0.raw
%O/minimal-0.root-%a-verity.raw:/usr/share/minimal_0.verity %O/minimal-0.root-%a-verity.raw:/usr/share/minimal_0.verity
%O/minimal-0.root-%a-verity-sig.raw:/usr/share/minimal_0.verity.sig %O/minimal-0.root-%a-verity-sig.raw:/usr/share/minimal_0.verity.sig

View File

@ -6,7 +6,9 @@ Include=
%D/mkosi.sanitizers %D/mkosi.sanitizers
[Content] [Content]
ExtraTrees=%D/mkosi.extra.common ExtraTrees=
%D/mkosi.leak-sanitizer-suppressions:/usr/lib/systemd/leak-sanitizer-suppressions
%D/mkosi.coredump-journal-storage.conf:/usr/lib/systemd/coredump.conf.d/10-coredump-journal-storage.conf
Packages= Packages=
findutils findutils

View File

@ -1,6 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
# shellcheck disable=SC2317
set -ex set -ex
set -o pipefail set -o pipefail
@ -9,19 +8,6 @@ set -o pipefail
IFNAME=udevtestnetif IFNAME=udevtestnetif
at_exit() {
set +e
systemctl stop testsleep.service
rm -f /run/udev/udev.conf.d/timeout.conf
rm -f /run/udev/rules.d/99-testsuite.rules
# Check if udevd can be restarted within a reasonably short time.
timeout 10 systemctl restart systemd-udevd.service
ip link del "$IFNAME"
}
trap at_exit EXIT
udevadm settle udevadm settle
mkdir -p /run/udev/udev.conf.d/ mkdir -p /run/udev/udev.conf.d/
@ -66,4 +52,12 @@ done
# Check if the reexec and reload have finished during processing the event. # Check if the reexec and reload have finished during processing the event.
grep -F 'ID_PROCESSING=1' "/run/udev/data/n${IFINDEX}" grep -F 'ID_PROCESSING=1' "/run/udev/data/n${IFINDEX}"
# cleanup
systemctl stop testsleep.service
rm -f /run/udev/udev.conf.d/timeout.conf
rm -f /run/udev/rules.d/99-testsuite.rules
# Check if udevd can be restarted within a reasonably short time.
timeout 10 systemctl restart systemd-udevd.service
ip link del "$IFNAME"
exit 0 exit 0

View File

@ -6,14 +6,6 @@ set -o pipefail
# shellcheck source=test/units/test-control.sh # shellcheck source=test/units/test-control.sh
. "$(dirname "$0")"/test-control.sh . "$(dirname "$0")"/test-control.sh
if systemd-detect-virt --quiet --container; then
# This comes from the selinux package and tries to write
# some files under sysfs, which will be read-only in a container,
# so mask it. It's not our tmpfiles.d file anyway.
mkdir -p /run/tmpfiles.d/
ln -s /dev/null /run/tmpfiles.d/selinux-policy.conf
fi
run_subtests run_subtests
touch /testok touch /testok