[PATCH] D87898: [asan][test] Disable malloc-no-intercept.c on Solaris
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 05:21:04 PDT 2020
ro created this revision.
ro added a reviewer: vitalybuka.
ro added a project: Sanitizers.
Herald added subscribers: Sanitizers, fedor.sergeev.
ro requested review of this revision.
`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`.
It seems a bit weird that for this apparently `glibc`-only group of interfaces every non-`glibc` target not only has to analyze the failure, but opt out of the interceptors. It would feel way more natural the other way round: opt-in for known users only.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87898
Files:
compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/test/asan/TestCases/malloc-no-intercept.c
Index: compiler-rt/test/asan/TestCases/malloc-no-intercept.c
===================================================================
--- compiler-rt/test/asan/TestCases/malloc-no-intercept.c
+++ 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 different
+// signature in libc.
+// UNSUPPORTED: solaris
// Inhibit conflicting declaration of memalign on Solaris.
#if defined(__sun__) && defined(__svr4__)
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ 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)
-#define SANITIZER_INTERCEPT_MEMALIGN \
+ 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 \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87898.292759.patch
Type: text/x-patch
Size: 2072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/340615b8/attachment.bin>
More information about the llvm-commits
mailing list