From 7f14902cc2e9d4200b2b192947c1a441a773c870 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 14 Dec 2024 17:29:56 +0900 Subject: [PATCH 1/2] mkosi: drop wrapper for unshare This effectively reverts ef9a3241b37690ee0e76d84d48f82135da42e48b, as it does not work. --- mkosi.sanitizers/mkosi.postinst | 1 - 1 file changed, 1 deletion(-) diff --git a/mkosi.sanitizers/mkosi.postinst b/mkosi.sanitizers/mkosi.postinst index af9db43911..8d9d19ba04 100755 --- a/mkosi.sanitizers/mkosi.postinst +++ b/mkosi.sanitizers/mkosi.postinst @@ -78,7 +78,6 @@ wrap=( su tar tgtd - unshare useradd userdel veritysetup From b8f49003d38f3e80e038b89f52dde67bef92ec81 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 14 Dec 2024 17:34:55 +0900 Subject: [PATCH 2/2] TEST-07-PID1: skip test cases that invokes unshare when running with sanitizers Fixes #35546. --- test/units/TEST-07-PID1.exec-context.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/units/TEST-07-PID1.exec-context.sh b/test/units/TEST-07-PID1.exec-context.sh index 1e253b390d..592c64ca4c 100755 --- a/test/units/TEST-07-PID1.exec-context.sh +++ b/test/units/TEST-07-PID1.exec-context.sh @@ -416,6 +416,13 @@ fi (! systemd-run --wait --pipe -p RootDirectory=/tmp/root /foo) (! systemd-run --wait --pipe --service-type=oneshot -p ExecStartPre=-/foo/bar/baz -p ExecStart=-/foo/bar/baz -p RootDirectory=/tmp/root -- "- foo") -# RestrictNamespaces= -systemd-run --wait --pipe unshare -T true -(! systemd-run --wait --pipe -p RestrictNamespaces=~time unshare -T true) +# Tests for RestrictNamespaces= +# For some reasons, the following test cases fail when running with sanitizers: +# TEST-07-PID1.sh[194]: + systemd-run --wait --pipe unshare -T true +# TEST-07-PID1.sh[718]: ==718==ASan runtime does not come first in +# initial library list; you should either link runtime to your +# application or manually preload it with LD_PRELOAD. +if [[ ! -v ASAN_OPTIONS ]]; then + systemd-run --wait --pipe unshare -T true + (! systemd-run --wait --pipe -p RestrictNamespaces=~time unshare -T true) +fi