libsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]
commit7c6071a66f32f43cea7aa4aa32d89b338e768307
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 16 Feb 2024 13:06:24 +0000 (16 14:06 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 16 Feb 2024 13:06:24 +0000 (16 14:06 +0100)
treec2c0c16f28c74572e3ff3b4d06759c986a747f18
parent5fd1cbfd65ef2b6dd87cd78ce6509e7d561981ac
libsanitizer: Intercept __makecontext_v2 on Solaris/SPARC [PR113785]

c-c++-common/asan/swapcontext-test-1.c FAILs on Solaris/SPARC:

FAIL: c-c++-common/asan/swapcontext-test-1.c   -O0  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O1  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O2 -flto  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c -O2 -flto -flto-partition=none
execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -O3 -g  execution test
FAIL: c-c++-common/asan/swapcontext-test-1.c   -Os  execution test

As detailed in PR sanitizer/113785, this happens because an ABI change
in Solaris 10/SPARC caused the external symbol for makecontext to be
changed to __makecontext_v2, which isn't intercepted.

The following patch, submitted upstream at
https://github.com/llvm/llvm-project/pull/81588, fixes that.

Tested on sparc-sun-solaris2.11 and i386-pc-solaris2.11.

2024-02-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

libsanitizer:
PR sanitizer/113785
* asan/asan_interceptors.cpp: Cherry-pick llvm-project revision
8c2033719a843a1880427a5e8caa5563248bce78.
libsanitizer/asan/asan_interceptors.cpp