blob: 51e914d5664ef9036d0b23b608288328e9055a03 [file] [log] [blame]
Andrew Geissler5f350902021-07-23 13:09:54 -04001Upstream-Status: Submitted [https://github.com/karelzak/util-linux/pull/1375]
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From dd956268ba89fc1caf83c45c3c495f34d261e0e2 Mon Sep 17 00:00:00 2001
5From: Ross Burton <ross.burton@arm.com>
6Date: Thu, 1 Jul 2021 20:44:31 +0100
7Subject: [PATCH] test/eject: guard asan LD_PRELOAD with use-system-commands
8 check
9
10This test tries to add asan to LD_PRELOAD because the just-built eject
11will call the host /bin/umount, and apparently asan doesn't like this.
12
13However, if ldd isn't present, this fails as the path to asan is the
14error message saying that ldd isn't present.
15
16As the asan workaround is only needed when executing the binaries that
17have just been built and not the system binaries, only use it if the
18test is on the built binaries.
19
20Closes #1373.
21
22Signed-off-by: Ross Burton <ross.burton@arm.com>
23---
24 tests/ts/eject/umount | 16 +++++++++-------
25 1 file changed, 9 insertions(+), 7 deletions(-)
26
27diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount
28index a829d46c0..2be281ee3 100755
29--- a/tests/ts/eject/umount
30+++ b/tests/ts/eject/umount
31@@ -60,13 +60,15 @@ function deinit_device {
32 ts_scsi_debug_rmmod
33 }
34
35-# As the eject binary execl()s an uninstrumented /bin/umount binary, we need
36-# to explicitly $LD_PRELOAD the ASan's runtime DSO, otherwise ASan will complain.
37-# Since all three utilities used by this test (eject, fdisk, mount) are just
38-# libtool wrappers, let's check the kill binary instead, which should have
39-# the needed DSO information.
40-ASAN_RT_PATH="$(ts_get_asan_rt_path "$TS_CMD_KILL")"
41-[ -n "$ASAN_RT_PATH" ] && export LD_PRELOAD="$ASAN_RT_PATH:$LD_PRELOAD"
42+if [ "$TS_USE_SYSTEM_COMMANDS" != "yes" ]; then
43+ # As the eject binary execl()s an uninstrumented /bin/umount binary, we need
44+ # to explicitly $LD_PRELOAD the ASan's runtime DSO, otherwise ASan will complain.
45+ # Since all three utilities used by this test (eject, fdisk, mount) are just
46+ # libtool wrappers, let's check the kill binary instead, which should have
47+ # the needed DSO information.
48+ ASAN_RT_PATH="$(ts_get_asan_rt_path "$TS_CMD_KILL")"
49+ [ -n "$ASAN_RT_PATH" ] && export LD_PRELOAD="$ASAN_RT_PATH:$LD_PRELOAD"
50+fi
51
52 ts_init_subtest "by-disk"
53 init_device
54--
552.25.1
56