[llvm-bugs] [Bug 45076] New: ASAN lit test fails when linked with LLD on PowerPC64 and run with ASLR enabled.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 2 07:45:18 PST 2020


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: unassignedbugs at nondot.org
          Reporter: sfertile at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org, smithp352 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200302/0412f313/attachment.html>


More information about the llvm-bugs mailing list