https://bugs.llvm.org/show_bug.cgi?id=45076

            Bug ID: 45076
           Summary: ASAN lit test fails when linked with LLD on PowerPC64
                    and run with ASLR enabled.
           Product: lld
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedb...@nondot.org
          Reporter: sfert...@ca.ibm.com
                CC: llvm-bugs@lists.llvm.org, smithp...@googlemail.com

compiler-rt/test/asan/TestCases/Posix/no-fd.cpp fails when run with ASLR
enabled, but only when linked with LLD. Linking with ld.bfd and ld.gold the
test succeeds.

The relevant difference between the 2 binaries is that the got entry for the
symbol `__libc_stack_end` is always 0 when linked with LLD, while bfd and gold
emit a R_PPC64_ADDR64 dynamic relocation.

The reason for the failure is a culmination of several things:
* When an ASAN instrumented binary is invoked with ASLR enabled on PPC64 ELF V2
the sanitizer runtime will attempt to disable ASLR and rexec with a call to
'ReExec()'. 

* When "__libc_stack_end' is undefined, the sanitizer runtime gets the
environment and args for re-execing by trying to open and parse
`/proc/self/cmdline` and `/proc/self/environ`. 

*The lit tests uses an option to mimicking opening files failing
"test_only_emulate_no_memorymap=1" which means we fail to open and parse the
previously mentioned files leading to an invalid call to execve --> 

execve("./bad_lld.out", [], [/* 0 vars */]) = 0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to