[compiler-rt] 15c9af5 - [asan][test] Disable malloc-no-intercept.c on Solaris
Rainer Orth via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 02:59:42 PDT 2020
Author: Rainer Orth
Date: 2020-09-24T11:58:25+02:00
New Revision: 15c9af5618c8c4a810994df53543af9060086a8e
URL: https://github.com/llvm/llvm-project/commit/15c9af5618c8c4a810994df53543af9060086a8e
DIFF: https://github.com/llvm/llvm-project/commit/15c9af5618c8c4a810994df53543af9060086a8e.diff
LOG: [asan][test] Disable malloc-no-intercept.c on Solaris
`TestCases/malloc-no-intercept.c` `FAIL`s on Solaris/x86, e.g. with
`-Dtestfunc=mallinfo`:
/usr/bin/ld: /tmp/malloc-no-intercept-586529.o: in function `main':
/vol/llvm/src/llvm-project/dist/compiler-rt/test/asan/TestCases/malloc-no-intercept.c:30: undefined reference to `nonexistent_function'
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
This is not surprising, actually:
- `mallinfo` and `mallopt` only exist in `libmalloc`
- `pvalloc` doesn't exist all all
- `cfree` does exist in `libc`, but isn't declared in any public header and
the OpenSolaris sources reveal that it has a different signature than on
Linux
- only `memalign` is a public interface
To avoid this, this patch disables the interceptors for all but `meminfo`.
Additionally, the test is marked `UNSUPPORTED` on Solaris since the
`memalign` and `cfree` variants **do** link on Solaris.
Tested on `amd64-pc-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D87898
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/test/asan/TestCases/malloc-no-intercept.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index 6d174d8335c9..c28ac5513669 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -498,17 +498,17 @@
#define SANITIZER_INTERCEPT_MMAP SI_POSIX
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
+#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
- SI_NOT_RTEMS)
+ SI_NOT_RTEMS && !SI_SOLARIS)
#define SANITIZER_INTERCEPT_MEMALIGN \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_RTEMS)
-#define SANITIZER_INTERCEPT_PVALLOC \
+#define SANITIZER_INTERCEPT_PVALLOC \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
- SI_NOT_RTEMS)
-#define SANITIZER_INTERCEPT_CFREE \
+ SI_NOT_RTEMS && !SI_SOLARIS)
+#define SANITIZER_INTERCEPT_CFREE \
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
- SI_NOT_RTEMS)
+ SI_NOT_RTEMS && !SI_SOLARIS)
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE \
diff --git a/compiler-rt/test/asan/TestCases/malloc-no-intercept.c b/compiler-rt/test/asan/TestCases/malloc-no-intercept.c
index ca98febed0fb..198a496c4ad1 100644
--- a/compiler-rt/test/asan/TestCases/malloc-no-intercept.c
+++ b/compiler-rt/test/asan/TestCases/malloc-no-intercept.c
@@ -9,6 +9,9 @@
// Conflicts with BIONIC declarations.
// UNSUPPORTED: android
+// Lacks mallinfo, mallopt except in libmalloc. cfree with
diff erent
+// signature in libc.
+// UNSUPPORTED: solaris
// Inhibit conflicting declaration of memalign on Solaris.
#if defined(__sun__) && defined(__svr4__)
More information about the llvm-commits
mailing list