From 59dd6505012317eea4bb2b9c353dc6d7a1f65064 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 9 May 2025 17:45:26 +0900 Subject: [PATCH 1/6] TEST-21-DFUZZER: skip test when no sanitizer is enabled --- .github/workflows/mkosi.yml | 8 -------- test/integration-tests/integration-test-wrapper.py | 8 ++++++++ test/units/TEST-21-DFUZZER.sh | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 511240435cf..83f1d06caf0 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -61,7 +61,6 @@ jobs: cflags: "-O2 -D_FORTIFY_SOURCE=3" relabel: no vm: 1 - skip: TEST-21-DFUZZER - distro: debian release: testing sanitizers: "" @@ -69,7 +68,6 @@ jobs: cflags: "-Og" relabel: no vm: 0 - skip: TEST-21-DFUZZER - distro: ubuntu release: noble sanitizers: "" @@ -77,7 +75,6 @@ jobs: cflags: "-Og" relabel: no vm: 0 - skip: TEST-21-DFUZZER - distro: fedora release: "42" sanitizers: address,undefined @@ -92,7 +89,6 @@ jobs: cflags: "-Og" relabel: yes vm: 0 - skip: TEST-21-DFUZZER - distro: opensuse release: tumbleweed sanitizers: "" @@ -100,7 +96,6 @@ jobs: cflags: "-Og" relabel: no vm: 0 - skip: TEST-21-DFUZZER - distro: centos release: "9" sanitizers: "" @@ -108,7 +103,6 @@ jobs: cflags: "-Og" relabel: yes vm: 0 - skip: TEST-21-DFUZZER - distro: centos release: "10" sanitizers: "" @@ -116,7 +110,6 @@ jobs: cflags: "-Og" relabel: yes vm: 0 - skip: TEST-21-DFUZZER steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -228,7 +221,6 @@ jobs: sudo --preserve-env mkosi sandbox -- \ env \ TEST_PREFER_QEMU=${{ matrix.vm }} \ - TEST_SKIP=${{ matrix.skip }} \ meson test \ -C build \ --no-rebuild \ diff --git a/test/integration-tests/integration-test-wrapper.py b/test/integration-tests/integration-test-wrapper.py index 77552cbfad6..5f456cd3e9f 100755 --- a/test/integration-tests/integration-test-wrapper.py +++ b/test/integration-tests/integration-test-wrapper.py @@ -490,6 +490,14 @@ def main() -> None: """ ) + if os.getenv('TEST_RUN_DFUZZER'): + dropin += textwrap.dedent( + f""" + [Service] + Environment=TEST_RUN_DFUZZER={os.environ['TEST_RUN_DFUZZER']} + """ + ) + if os.getenv('TEST_JOURNAL_USE_TMP', '0') == '1': if statfs(Path('/tmp')) != 'tmpfs' and statfs(Path('/dev/shm')) == 'tmpfs': tmp = Path('/dev/shm') diff --git a/test/units/TEST-21-DFUZZER.sh b/test/units/TEST-21-DFUZZER.sh index 08ebfd91eb6..ac49938c380 100755 --- a/test/units/TEST-21-DFUZZER.sh +++ b/test/units/TEST-21-DFUZZER.sh @@ -9,6 +9,11 @@ if ! command -v dfuzzer &>/dev/null; then exit 77 fi +if [[ ! -v ASAN_OPTIONS && ! -v UBSAN_OPTIONS && "${TEST_RUN_DFUZZER:-0}" == "0" ]]; then + echo "no sanitizer is enabled, skipping. (Hint: set TEST_RUN_DFUZZER=1 to run test forcibly)." + exit 77 +fi + # Save the end.service state before we start fuzzing, as it might get changed # on the fly by one of the fuzzers systemctl list-jobs | grep -F 'end.service' && SHUTDOWN_AT_EXIT=1 || SHUTDOWN_AT_EXIT=0 From 48a092afbb27b03daaeb2db938917eb98c82e366 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 9 May 2025 16:41:06 +0900 Subject: [PATCH 2/6] github/mkosi: tentatively disable mkosi(opensuse) job There is a package dependency issue in opensuse, and there is nothing we can do. Let's reenable later when the issue is fixed. --- .github/workflows/mkosi.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 83f1d06caf0..a437dd87c94 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -89,13 +89,13 @@ jobs: cflags: "-Og" relabel: yes vm: 0 - - distro: opensuse - release: tumbleweed - sanitizers: "" - llvm: 0 - cflags: "-Og" - relabel: no - vm: 0 + # - distro: opensuse + # release: tumbleweed + # sanitizers: "" + # llvm: 0 + # cflags: "-Og" + # relabel: no + # vm: 0 - distro: centos release: "9" sanitizers: "" From 71078275e87ba5a33863ba90a534162f41be692c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 9 May 2025 16:56:48 +0900 Subject: [PATCH 3/6] integration-tests: adjust priorities When running with sanitizers: ``` 26/95 systemd:integration-tests / TEST-21-DFUZZER OK 1517.75s 40/95 systemd:integration-tests / TEST-85-NETWORK-NetworkdDHCPClientTests OK 779.18s 42/95 systemd:integration-tests / TEST-04-JOURNAL OK 716.17s ``` and without sanitizers: ``` 44/95 systemd:integration-tests / TEST-85-NETWORK-NetworkdDHCPClientTests OK 730.33s 29/95 systemd:integration-tests / TEST-64-UDEV-STORAGE-simultaneous_events OK 701.49s 40/95 systemd:integration-tests / TEST-04-JOURNAL OK 348.05s ``` So, let's set higher priorities only on these tests. --- test/integration-tests/TEST-04-JOURNAL/meson.build | 1 + test/integration-tests/TEST-64-UDEV-STORAGE/meson.build | 3 ++- test/integration-tests/TEST-73-LOCALE/meson.build | 1 - test/integration-tests/TEST-85-NETWORK/meson.build | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/integration-tests/TEST-04-JOURNAL/meson.build b/test/integration-tests/TEST-04-JOURNAL/meson.build index 184f70ab720..d61cbcb0018 100644 --- a/test/integration-tests/TEST-04-JOURNAL/meson.build +++ b/test/integration-tests/TEST-04-JOURNAL/meson.build @@ -6,5 +6,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), 'storage' : 'persistent', + 'priority' : 10, }, ] diff --git a/test/integration-tests/TEST-64-UDEV-STORAGE/meson.build b/test/integration-tests/TEST-64-UDEV-STORAGE/meson.build index cbd6b697772..76b0ebeb87d 100644 --- a/test/integration-tests/TEST-64-UDEV-STORAGE/meson.build +++ b/test/integration-tests/TEST-64-UDEV-STORAGE/meson.build @@ -146,6 +146,7 @@ udev_storage_tests += udev_storage_test_template + { 'name' : 'simultaneous_events', 'cmdline' : cmdline, 'qemu-args' : qemu_args, + 'priority' : 10, } cmdline = [] @@ -256,7 +257,7 @@ foreach testcase : udev_storage_tests }, }, 'mkosi-args' : integration_test_template['mkosi-args'] + cmdline, - 'priority' : 10, + 'priority' : testcase.get('priority', 0), 'vm' : true, # Suppress ASan error # 'multipathd[1820]: ==1820==ERROR: AddressSanitizer: Joining already joined thread, aborting.' diff --git a/test/integration-tests/TEST-73-LOCALE/meson.build b/test/integration-tests/TEST-73-LOCALE/meson.build index e5b9f190151..f3e645b872d 100644 --- a/test/integration-tests/TEST-73-LOCALE/meson.build +++ b/test/integration-tests/TEST-73-LOCALE/meson.build @@ -3,7 +3,6 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), - 'priority' : 10, # TODO: Remove when https://github.com/systemd/systemd/issues/35335 is fixed. 'coredump-exclude-regex' : '/systemd-localed', }, diff --git a/test/integration-tests/TEST-85-NETWORK/meson.build b/test/integration-tests/TEST-85-NETWORK/meson.build index 7bce51abbe7..cf3ea534694 100644 --- a/test/integration-tests/TEST-85-NETWORK/meson.build +++ b/test/integration-tests/TEST-85-NETWORK/meson.build @@ -32,7 +32,7 @@ foreach testcase : [ 'TEST_MATCH_TESTCASE': testcase, } }, - 'priority' : 10, + 'priority' : testcase == 'NetworkdDHCPClientTests' ? 10 : 0, 'vm' : true, }, ] From 7ded7cfb7f260a6bff62b19b43b3224cde5b3284 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 9 May 2025 17:09:19 +0900 Subject: [PATCH 4/6] TEST-73-LOCALE: drop unnecessary workaround It should be fixed by 157d5b5c30b472c8c70a629a0c609ad240151746. --- test/integration-tests/TEST-73-LOCALE/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/integration-tests/TEST-73-LOCALE/meson.build b/test/integration-tests/TEST-73-LOCALE/meson.build index f3e645b872d..8dec5f37e73 100644 --- a/test/integration-tests/TEST-73-LOCALE/meson.build +++ b/test/integration-tests/TEST-73-LOCALE/meson.build @@ -3,7 +3,5 @@ integration_tests += [ integration_test_template + { 'name' : fs.name(meson.current_source_dir()), - # TODO: Remove when https://github.com/systemd/systemd/issues/35335 is fixed. - 'coredump-exclude-regex' : '/systemd-localed', }, ] From 18609909d93a4d17e962b47e51fffe38845e99f5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 9 May 2025 16:33:12 +0900 Subject: [PATCH 5/6] TEST-73-LOCALE: skip lv keymap and friends The following failure should be in libxkbcommon and/or sanitizer. There is nothing we can do here. Let's skip it. ``` TEST-73-LOCALE.sh[3733]: + assert_rc 0 localectl set-keymap lv TEST-73-LOCALE.sh[6699]: + set +ex TEST-73-LOCALE.sh[6700]: Failed to set keymap: Remote peer disconnected TEST-73-LOCALE.sh[6703]: FAIL: expected: '0' actual: '1' TEST-73-LOCALE.sh[157]: + rm -f /etc/dbus-1/system.d/systemd-localed-read-only.conf [FAILED] Failed to start TEST-73-LOCALE.service - TEST-73-LOCALE. ``` ``` ==3719==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fa51f161000 at pc 0x7fa521250be4 bp 0x7ffe49130a80 sp 0x7ffe49130240 READ of size 19126 at 0x7fa51f161000 thread T0 #0 0x7fa521250be3 in strndup (/usr/lib/clang/20/lib/x86_64-redhat-linux-gnu/libclang_rt.asan.so+0x50be3) (BuildId: aa6231e817f72469c44a6c6cee9f0694a87db7fb) #1 0x7fa51f128325 (/lib64/libxkbcommon.so.0+0x1c325) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #2 0x7fa51f121952 (/lib64/libxkbcommon.so.0+0x15952) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #3 0x7fa51f123d3a (/lib64/libxkbcommon.so.0+0x17d3a) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #4 0x7fa51f117c86 (/lib64/libxkbcommon.so.0+0xbc86) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #5 0x7fa51f12548f (/lib64/libxkbcommon.so.0+0x1948f) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #6 0x7fa51f125c9e (/lib64/libxkbcommon.so.0+0x19c9e) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #7 0x7fa51f126a59 (/lib64/libxkbcommon.so.0+0x1aa59) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #8 0x7fa51f12cec6 (/lib64/libxkbcommon.so.0+0x20ec6) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #9 0x7fa51f12e3c2 (/lib64/libxkbcommon.so.0+0x223c2) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #10 0x7fa51f12a4e5 in xkb_keymap_new_from_names (/lib64/libxkbcommon.so.0+0x1e4e5) (BuildId: 72e8cb985db37963272d140f7b2aee551c465ff5) #11 0x5574dd63f864 in verify_xkb_rmlvo /usr/src/debug/systemd/src/locale/xkbcommon-util.c:69:14 (snip) ``` --- test/units/TEST-73-LOCALE.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/units/TEST-73-LOCALE.sh b/test/units/TEST-73-LOCALE.sh index de935183ad6..b070e99af16 100755 --- a/test/units/TEST-73-LOCALE.sh +++ b/test/units/TEST-73-LOCALE.sh @@ -210,6 +210,10 @@ testcase_vc_keymap() { for i in $(localectl list-keymaps); do # set VC keymap + + # Skip lv keymap and friends, otherwise the sanitizer detects heap-buffer-overflow in libxkbcommon. + [[ "$i" =~ ^lv ]] && continue + assert_rc 0 localectl set-keymap "$i" output=$(localectl) From e9ad95438d283d2d4b1ed35ab57503004ed4c49a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 14 May 2025 00:58:32 +0900 Subject: [PATCH 6/6] meson: fix path to coverage.h Follow-up for 30d20907bddfe064cc3437a888dd8f00d14929e4. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ebe24c6290f..81e494ee044 100644 --- a/meson.build +++ b/meson.build @@ -1969,7 +1969,7 @@ endif ##################################################################### if get_option('b_coverage') - userspace_c_args += ['-include', 'src/basic/coverage.h'] + userspace_c_args += ['-include', 'coverage.h'] endif #####################################################################