Skip to content

Commit 15c9af5

Browse files
committed
[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
1 parent 00e05b1 commit 15c9af5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,17 @@
498498

499499
#define SANITIZER_INTERCEPT_MMAP SI_POSIX
500500
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
501-
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
501+
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
502502
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
503-
SI_NOT_RTEMS)
503+
SI_NOT_RTEMS && !SI_SOLARIS)
504504
#define SANITIZER_INTERCEPT_MEMALIGN \
505505
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_RTEMS)
506-
#define SANITIZER_INTERCEPT_PVALLOC \
506+
#define SANITIZER_INTERCEPT_PVALLOC \
507507
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
508-
SI_NOT_RTEMS)
509-
#define SANITIZER_INTERCEPT_CFREE \
508+
SI_NOT_RTEMS && !SI_SOLARIS)
509+
#define SANITIZER_INTERCEPT_CFREE \
510510
(!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
511-
SI_NOT_RTEMS)
511+
SI_NOT_RTEMS && !SI_SOLARIS)
512512
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
513513
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
514514
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE \

compiler-rt/test/asan/TestCases/malloc-no-intercept.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
// Conflicts with BIONIC declarations.
1111
// UNSUPPORTED: android
12+
// Lacks mallinfo, mallopt except in libmalloc. cfree with different
13+
// signature in libc.
14+
// UNSUPPORTED: solaris
1215

1316
// Inhibit conflicting declaration of memalign on Solaris.
1417
#if defined(__sun__) && defined(__svr4__)

0 commit comments

Comments
 (0)