[Bug sanitizer/80953] Support libsanitizer on Solaris

ro at CeBiTec dot Uni-Bielefeld.DE gcc-bugzilla@gcc.gnu.org
Mon Feb 11 09:35:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80953

--- Comment #32 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> ---
> --- Comment #31 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
>> I think it is important to find out why there are those differences in line
>> numbers.  Is libbacktrace broken on Solaris, or not used at all, something
>> different?
>
> The libsanitizer does its private unwinding by means of _Unwind_Backtrace,
> which works fine.  But, at the end, it overwrites the first address with the
> result of __builtin_return_address, which returns the address of the call
> instruction and not the return address on the SPARC (maybe you know why,
> Jakub?) so the first frame is off by 8 bytes.  I have a tentative fixlet for
> the libsanitizer.

Excellent, thanks for the detective work.

> Btw, Rainer, why did you disable fast unwinding on the SPARC?  This puts the
> SPARC  port in its own basket (admittedly with MIPS) so that's not very
> convenient.

For one, this is how it had been on Linux/sparc (although I wonder how
this can ever have been tested given that asan with clang is useless on
sparc).  When I looked into this

        https://reviews.llvm.org/D54099

I found that enabling it causes quite a number of regressions.  Here's
the list that I've just recreated:

+FAIL: c-c++-common/asan/heap-overflow-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/heap-overflow-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/heap-overflow-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/heap-overflow-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/heap-overflow-1.c   -O2 -flto -flto-partition=none 
output pattern test
+FAIL: c-c++-common/asan/heap-overflow-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/heap-overflow-1.c   -Os  output pattern test

+FAIL: c-c++-common/asan/pr70541.c   -O0  output pattern test

+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -O2 -flto -flto-partition=none 
output pattern test
+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/strncpy-overflow-1.c   -Os  output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -O0  output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -O1  output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -O2  output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -O2 -flto  output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -O2 -flto -flto-partition=none 
output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -O3 -g  output pattern test
+FAIL: c-c++-common/asan/use-after-free-1.c   -Os  output pattern test
+FAIL: g++.dg/asan/deep-stack-uaf-1.C   -O0  output pattern test

Maybe this goes away with your unwinding fix, though.

While trying this, I stumbled over the fact that a 64-bit-default gcc
with -m32 doesn't define __sparcv8, unlike its 32-bit-default
equivalent, which leaves an empty sanitizer_stacktrace_sparc.o.  Need to
look into this.


More information about the Gcc-bugs mailing list