Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1 | Upstream-Status: Submitted [https://github.com/karelzak/util-linux/pull/1375] |
| 2 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 3 | |
| 4 | From dd956268ba89fc1caf83c45c3c495f34d261e0e2 Mon Sep 17 00:00:00 2001 |
| 5 | From: Ross Burton <ross.burton@arm.com> |
| 6 | Date: Thu, 1 Jul 2021 20:44:31 +0100 |
| 7 | Subject: [PATCH] test/eject: guard asan LD_PRELOAD with use-system-commands |
| 8 | check |
| 9 | |
| 10 | This test tries to add asan to LD_PRELOAD because the just-built eject |
| 11 | will call the host /bin/umount, and apparently asan doesn't like this. |
| 12 | |
| 13 | However, if ldd isn't present, this fails as the path to asan is the |
| 14 | error message saying that ldd isn't present. |
| 15 | |
| 16 | As the asan workaround is only needed when executing the binaries that |
| 17 | have just been built and not the system binaries, only use it if the |
| 18 | test is on the built binaries. |
| 19 | |
| 20 | Closes #1373. |
| 21 | |
| 22 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 23 | --- |
| 24 | tests/ts/eject/umount | 16 +++++++++------- |
| 25 | 1 file changed, 9 insertions(+), 7 deletions(-) |
| 26 | |
| 27 | diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount |
| 28 | index 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 | -- |
| 55 | 2.25.1 |
| 56 | |