New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 35996 - asan_rt_conflict_test-1 segfaults
Summary: asan_rt_conflict_test-1 segfaults
Status: RESOLVED FIXED
Alias: None
Product: compiler-rt
Classification: Unclassified
Component: compiler-rt (show other bugs)
Version: 6.0
Hardware: PC Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
: 36025 (view as bug list)
Depends on:
Blocks: release-6.0
  Show dependency tree
 
Reported: 2018-01-18 03:23 PST by Diana Picus
Modified: 2018-02-08 23:38 PST (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diana Picus 2018-01-18 03:23:18 PST
I am seeing something like this while testing the 6.0.0 release on ARM, AArch64 and x86:

FAIL: AddressSanitizer-aarch64-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc (3574 of 47777)
******************** TEST 'AddressSanitizer-aarch64-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc' FAILED ********************
Script:
--
/home/tcwg-buildslave/workspace/tcwg-llvm-release/tcwg-apm_64-build/rc1/Phase3/Release/llvmCore-6.0.0-rc1.obj/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only    /home/tcwg-buildslave/workspace/tcwg-llvm-release/tcwg-apm_64-build/rc1/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc -o /home/tcwg-buildslave/workspace/tcwg-llvm-release/tcwg-apm_64-build/rc1/Phase3/Release/llvmCore-6.0.0-rc1.obj/projects/compiler-rt/test/asan/AARCH64LinuxDynamicConfig/TestCases/Linux/Output/asan_rt_confict_test-1.cc.tmp
env LD_PRELOAD=libclang_rt.asan-aarch64.so not  /home/tcwg-buildslave/workspace/tcwg-llvm-release/tcwg-apm_64-build/rc1/Phase3/Release/llvmCore-6.0.0-rc1.obj/projects/compiler-rt/test/asan/AARCH64LinuxDynamicConfig/TestCases/Linux/Output/asan_rt_confict_test-1.cc.tmp 2>&1 | FileCheck /home/tcwg-buildslave/workspace/tcwg-llvm-release/tcwg-apm_64-build/rc1/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc
--
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildslave/workspace/tcwg-llvm-release/tcwg-apm_64-build/rc1/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc:13:11: error: expected string not found in input
// CHECK: Your application is linked against incompatible ASan runtimes
          ^
<stdin>:1:1: note: scanning from here
Error: Segmentation fault (core dumped)
^
<stdin>:1:3: note: possible intended match here
Error: Segmentation fault (core dumped)
  ^
Comment 1 Hans Wennborg 2018-01-30 03:11:51 PST
+eugenis maybe
Comment 2 Hans Wennborg 2018-01-31 04:50:54 PST
After moving to my new Debian-based workstation, I get similar errors.

When testing the branch with:

$ utils/release/test-release.sh -svn-path branches/release_60 -triple x86_64-unknown-linux-gnu


I get the two errors below. For some reason I don't get it during regular builds. I also don't know how to debug this, really :-/





FAIL: AddressSanitizer-i386-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc (4030 of 50225)
******************** TEST 'AddressSanitizer-i386-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc' FAILED ********************
Script:
--
/work/llvm-release-test/branches_release_60/Phase3/Release/llvmCore-test-branches_release_60.obj/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m32  /work/llvm-release-test/branches_release_60/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc -o /work/llvm-release-test/branches_release_60/Phase3/Release/llvmCore-test-branches_release_60.obj/projects/compiler-rt/test/asan/I386LinuxDynamicConfig/TestCases/Linux/Output/asan_rt_confict_test-1.cc.tmp
env LD_PRELOAD=libclang_rt.asan-i386.so not  /work/llvm-release-test/branches_release_60/Phase3/Release/llvmCore-test-branches_release_60.obj/projects/compiler-rt/test/asan/I386LinuxDynamicConfig/TestCases/Linux/Output/asan_rt_confict_test-1.cc.tmp 2>&1 | FileCheck /work/llvm-release-test/branches_release_60/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc
--
Exit Code: 1

Command Output (stderr):
--
/work/llvm-release-test/branches_release_60/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc:13:11: error: expected string not found in input
// CHECK: Your application is linked against incompatible ASan runtimes
          ^
<stdin>:1:1: note: scanning from here
ERROR: ld.so: object 'libclang_rt.asan-i386.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
^
<stdin>:2:1: note: possible intended match here
Error: Segmentation fault
^

--

********************
Testing: 0 ..
FAIL: AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc (4876 of 50225)
******************** TEST 'AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/asan_rt_confict_test-1.cc' FAILED ********************
Script:
--
/work/llvm-release-test/branches_release_60/Phase3/Release/llvmCore-test-branches_release_60.obj/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64  /work/llvm-release-test/branches_release_60/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc -o /work/llvm-release-test/branches_release_60/Phase3/Release/llvmCore-test-branches_release_60.obj/projects/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Linux/Output/asan_rt_confict_test-1.cc.tmp
env LD_PRELOAD=libclang_rt.asan-x86_64.so not  /work/llvm-release-test/branches_release_60/Phase3/Release/llvmCore-test-branches_release_60.obj/projects/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Linux/Output/asan_rt_confict_test-1.cc.tmp 2>&1 | FileCheck /work/llvm-release-test/branches_release_60/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc
--
Exit Code: 1

Command Output (stderr):
--
/work/llvm-release-test/branches_release_60/llvm.src/projects/compiler-rt/test/asan/TestCases/Linux/asan_rt_confict_test-1.cc:13:11: error: expected string not found in input
// CHECK: Your application is linked against incompatible ASan runtimes
          ^
<stdin>:1:1: note: scanning from here
Error: Segmentation fault
^

--

********************
Comment 3 Evgenii Stepanov 2018-02-01 17:10:39 PST
I don't have the same setup, but...

how does this test ever work on multilib systems?

// RUN: env LD_PRELOAD=%shared_libasan not %run %t 2>&1 | FileCheck %s   

"not" is either 32 or 64 bit binary, and the test is run in both variants. One has got to fail.
Comment 4 Evgenii Stepanov 2018-02-01 18:00:46 PST
Ah, that's OK, unlike bionic, glibc loader ignores incompatible LD_PRELOAD.

So, I can not reproduce this. A stack trace from the segmentation fault would help a lot.
Comment 5 Yvan Roux 2018-02-02 12:56:57 PST
I reproduced the issue, and it is related to the size of the path of the shared lib. If you copy libclang_rt.asan-i386.so into a directory path which is 113 characters long you will get a segmentation fault and it will work for anything shorter. Notice that it also the case in 5.0 release.

Looking quickly into the sanitizers code, it seems that size of filenames are hardcoded and not homogeneous, here in AsanCheckIncompatibleRT() (from asan_linux.cc) it is a 128 char array, in tsan it is 256 and in sanitizer_posix.cc it is 4095
Comment 6 Yvan Roux 2018-02-03 01:22:17 PST
I think that the safest thing to do is to use MAXPATHLEN from <sys/param.h> to be in sync with glibc LD_PRELOAD name limits (value can be 4096 or 1024).

Quick test fixes the issue, I'll submit a patch after a full validation.
Comment 7 Yvan Roux 2018-02-05 01:36:55 PST
Proposed fix: https://reviews.llvm.org/D42900
Comment 8 Michał Górny 2018-02-06 12:13:49 PST
*** Bug 36025 has been marked as a duplicate of this bug. ***
Comment 9 Hans Wennborg 2018-02-07 11:53:12 PST
The fix landed in r324496 and I've merged it to 6.0 in r324506.

I plan to tag rc2, so let's leave it open for now and close when it's confirmed.
Comment 10 Diana Picus 2018-02-08 23:38:33 PST
Seems to be gone now, thanks!