Skip to content

[asan][sanitizer_common] Enable build and testing of asan+sanitizer_common on AIX #137186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ if(WIN32)
set(ARM32 ${ARM32} armv7)
endif()

set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64}
set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC32} ${PPC64} ${RISCV64}
${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9}
${HEXAGON} ${LOONGARCH64})
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
${MIPS32} ${MIPS64} ${PPC32} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
${LOONGARCH64})
set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
Expand Down
3 changes: 2 additions & 1 deletion compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG
check_cxx_compiler_flag("-Werror -Wgnu-anonymous-struct" COMPILER_RT_HAS_WGNU_ANONYMOUS_STRUCT_FLAG)
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
check_cxx_compiler_flag("-Werror -Wunused-parameter" COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag("-Werror -Watomic-alignment" COMPILER_RT_HAS_WATOMIC_ALIGNMENT_FLAG)
check_cxx_compiler_flag("-Werror -Wcovered-switch-default" COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
check_cxx_compiler_flag("-Werror -Wsuggest-override" COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
check_cxx_compiler_flag("-Werror -Wthread-safety" COMPILER_RT_HAS_WTHREAD_SAFETY_FLAG)
Expand Down Expand Up @@ -760,7 +761,7 @@ set(COMPILER_RT_SANITIZERS_TO_BUILD all CACHE STRING
list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")

if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS|Haiku" OR
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD|NetBSD|Fuchsia|SunOS|Haiku|AIX" OR
(OS_NAME MATCHES "Windows" AND NOT CYGWIN AND
(NOT MINGW OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"))))
set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
Expand Down
8 changes: 7 additions & 1 deletion compiler-rt/lib/asan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ if(NOT MSVC)
list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS --driver-mode=g++)
endif()

# unittest will test asan sources which may require atomic library.
if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")
list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS -latomic)
endif()

# x86_64 FreeBSD 9.2 additionally requires libc++ to build the tests.
if(CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE")
list(APPEND ASAN_UNITTEST_COMMON_LINK_FLAGS "-lc++")
Expand Down Expand Up @@ -240,7 +245,8 @@ function(add_asan_tests arch test_runtime)
LINK_FLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINK_FLAGS} ${TARGET_LINK_FLAGS})
endfunction()

if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID)
# AIX can not run unittest because of shared library interception issue.
if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
set(ASAN_TEST_ARCH ${ASAN_SUPPORTED_ARCH})
if(APPLE)
darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH)
Expand Down
4 changes: 4 additions & 0 deletions compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ if(NOT MSVC)
list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON --driver-mode=g++)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -latomic)
endif()

if(ANDROID)
list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -pie)
endif()
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ static inline uint32_t my_rand() {
#endif

#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__ANDROID__) && \
!defined(__NetBSD__) && !defined(_WIN32)
# define SANITIZER_TEST_HAS_MEMALIGN 1
!defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
# define SANITIZER_TEST_HAS_MEMALIGN 1
#else
# define SANITIZER_TEST_HAS_MEMALIGN 0
#endif
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()
macro(get_bits_for_arch arch bits)
if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9|riscv64|loongarch64")
set(${bits} 64)
elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc")
elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc|powerpc")
set(${bits} 32)
else()
message(FATAL_ERROR "Unknown target architecture: ${arch}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
// CHECK-BAD-ADDR: #0 0xabcdabcd
// CHECK-BAD-ADDR-EMPTY:

// AIX does not have a system symbolizer which will return result like expected.
// llvm-symbolizer will not generate expected result either, an error will be emitted indicating "No such file or directory".
// UNSUPPORTED: target={{.*aix.*}}

int main() {
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

// UNSUPPORTED: ios

// Asan on AIX doesn't print the full path for user libraries or executables, so this test fails to
// symbolize.
// UNSUPPORTED: target={{.*}}-aix{{.*}}

#if !defined(SHARED_LIB)
#include <dlfcn.h>
#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// UNSUPPORTED: ios, android
// Check plugin command line args get parsed and that plugin functions get called as expected.

// Asan on AIX doesn't print the full path for user libraries or executables, so this test fails to
// symbolize.
// UNSUPPORTED: target={{.*}}-aix{{.*}}

// RUN: %clangxx_asan -O0 -g %s -o %t.executable
// RUN: not %env_asan_opts=symbolize=0 %run %t.executable > %t.log 2>&1
// RUN: %asan_symbolize --plugins %S/plugin_no_op.py --log-level info -l %t.log --unlikely-option-name-XXX=15 2>&1 | FileCheck %s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// UNSUPPORTED: android
// UNSUPPORTED: ios

// Asan on AIX doesn't print the full path for user libraries or executables, so this test fails to
// symbolize.
// UNSUPPORTED: target={{.*}}-aix{{.*}}

// RUN: %clangxx_asan -O0 -g %s -o %t
// RUN: %env_asan_opts=symbolize=0 not %run %t DUMMY_ARG > %t.asan_report 2>&1
// RUN: %asan_symbolize --log-level debug --log-dest %t_debug_log_output.txt -l %t.asan_report --plugins %S/plugin_wrong_frame_number_bug.py > %t.asan_report_sym
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/asprintf.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s

// AIX libc does not define asprintf.
// UNSUPPORTED: target={{.*aix.*}}

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/TestCases/Posix/closed-fds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ int main(int argc, char **argv) {
// CHECK-FILE: {{.*ERROR: AddressSanitizer: heap-use-after-free on address}}
// CHECK-FILE: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}}
// CHECK-FILE: {{WRITE of size 1 at 0x.* thread T0}}
// CHECK-FILE: {{ #0 0x.* in main .*closed-fds.cpp:}}[[@LINE-4]]
// CHECK-FILE: {{ #0 0x.* in \.?main .*closed-fds.cpp:}}[[@LINE-4]]
return 0;
}
2 changes: 2 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// UNSUPPORTED: android
// UNSUPPORTED: iossim
//
// UNSUPPORTED: target={{.*aix.*}}

// Ideally a forked-subprocess should only report it's own coverage,
// not parent's one. But trace-pc-guard currently does nothing special for fork,
// and thus this test is relaxed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// XFAIL: android
// UNSUPPORTED: ios

// FIXME: support -fsanitize-coverage on AIX
// UNSUPPORTED: target={{.*aix.*}}

#include <assert.h>
#include <dlfcn.h>
#include <stdint.h>
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
//
// UNSUPPORTED: ios

// UNSUPPORTED: target={{.*aix.*}}

#include <stdio.h>

#include <sanitizer/coverage_interface.h>
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/coverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
// XFAIL: android
// UNSUPPORTED: ios

// FIXME: support -fsanitize-coverage on AIX.
// UNSUPPORTED: target={{.*aix.*}}

#include <assert.h>
#include <stdio.h>
#include <string.h>
Expand Down
3 changes: 2 additions & 1 deletion compiler-rt/test/asan/TestCases/Posix/deep_call_stack.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Check that UAR mode can handle very deep recursion.
// On AIX, we need a large stack size to contain all the 15000 frames and its callees.
// REQUIRES: shell
// RUN: %clangxx_asan -O2 %s -o %t
// RUN: ulimit -s 4096
// RUN: ulimit -s 8192
// RUN: %env_asan_opts=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s

// Also check that use_sigaltstack+verbosity doesn't crash.
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/fake_stack_gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// (https://github.com/llvm/llvm-project/issues/64942).
// UNSUPPORTED: iossim

// FIXME: investigate this failure on AIX.
// UNSUPPORTED: target={{.*aix.*}}

#include <algorithm>
#include <assert.h>
#include <csignal>
Expand Down
6 changes: 3 additions & 3 deletions compiler-rt/test/asan/TestCases/Posix/fgets_fputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ int main(int argc, char *argv[]) {
}

// CHECK-FGETS: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
// CHECK-FGETS: #{{.*}} in {{(wrap_|__interceptor_)?}}fgets
// CHECK-FGETS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fgets}}
// CHECK-FPUTS: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
// CHECK-FPUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}fputs
// CHECK-FPUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fputs}}
// CHECK-PUTS: {{.*ERROR: AddressSanitizer: heap-use-after-free}}
// CHECK-PUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}puts
// CHECK-PUTS: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?puts}}
4 changes: 2 additions & 2 deletions compiler-rt/test/asan/TestCases/Posix/fread_fwrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ int main(int argc, char *argv[]) {
}

// CHECK-FREAD: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
// CHECK-FREAD: #{{.*}} in {{(wrap_|__interceptor_)?}}fread
// CHECK-FREAD: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fread}}
// CHECK-FWRITE: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
// CHECK-FWRITE: #{{.*}} in {{(wrap_|__interceptor_)?}}fwrite
// CHECK-FWRITE: #{{.*}} in {{(wrap_|__interceptor_)?}}{{\.?fwrite}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Check that memset() call from a shared library gets intercepted.

// FIXME: Instructions don't start at 0x0 in shared libraries on AIX
// XFAIL: target={{.*-aix.*}}

// RUN: %clangxx_asan -O0 %s -DSHARED_LIB \
// RUN: -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
// RUN: %clangxx_asan -O0 %s -o %t %ld_flags_rpath_exe && \
Expand All @@ -21,7 +24,7 @@ int main(int argc, char *argv[]) {
my_memset(buf, 11);
// CHECK: {{.*ERROR: AddressSanitizer: stack-buffer-overflow}}
// CHECK: {{WRITE of size 11 at 0x.* thread T0}}
// CHECK: {{0x.* in my_memset .*interception-in-shared-lib-test.cpp:}}[[@LINE-10]]
// CHECK: {{0x.* in \.?my_memset .*interception-in-shared-lib-test.cpp:}}[[@LINE-10]]
return 0;
}
#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
// On AIX, for 32 bit, the stack of main thread contains all other thread's stack.
// So we should be able to check invalid pointer based on the main thread stack, because
// all the stack address are in main thread's stack.
// However this is not true for 64 bit, for 64 bit, main thread stack does not overlap with
// other thread stack. This is same with other targets.
// See GetStackVariableShadowStart() for details.

// RUN: %clangxx_asan -O0 %s -pthread -o %t -mllvm -asan-detect-invalid-pointer-pair

// RUN: %env_asan_opts=detect_invalid_pointer_pairs=2 %run %t a 2>&1 | FileCheck %s -check-prefix=OK -allow-empty
// RUN: %if target={{.*aix.*}} && asan-32-bits %{ %env_asan_opts=detect_invalid_pointer_pairs=2 not %run %t a 2>&1 | FileCheck %s -check-prefix=AIX %} %else \
// RUN: %{ %env_asan_opts=detect_invalid_pointer_pairs=2 %run %t a 2>&1 | FileCheck %s -check-prefix=OK -allow-empty %}
// RUN: %env_asan_opts=detect_invalid_pointer_pairs=2 not %run %t b 2>&1 | FileCheck %s -check-prefix=B

// pthread barriers are not available on OS X
Expand Down Expand Up @@ -38,13 +46,15 @@ int main(int argc, char **argv) {

if (t == 'a') {
// OK-NOT: not handled yet
// AIX: ERROR: AddressSanitizer: invalid-pointer-pair
// AIX: #{{[0-9]+ .*}} in .main {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]]
unsigned r = pointers[0] - pointers[1];
} else {
char local;
char *parent_pointer = &local;

// B: ERROR: AddressSanitizer: invalid-pointer-pair
// B: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]]
// B: #{{[0-9]+ .*}} in {{\.?main}} {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]]
unsigned r = parent_pointer - pointers[0];
}

Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/TestCases/Posix/ioctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int main(int argc, char **argv) {
int res = ioctl(fd, FIONBIO, &nonblock + 1);
// CHECK: AddressSanitizer: stack-buffer-overflow
// CHECK: READ of size 4 at
// CHECK: {{#.* in main .*ioctl.cpp:}}[[@LINE-3]]
// CHECK: {{#.* in \.?main .*ioctl.cpp:}}[[@LINE-3]]
assert(res == 0);
close(fd);
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ struct C {
int main(int argc, char **argv) {
C *buffer = new C[argc];
buffer[-2].x = 10;
// CHECK: AddressSanitizer: heap-buffer-overflow
// CHECK: in main {{.*}}new_array_cookie_test.cpp:[[@LINE-2]]
// CHECK: is located 0 bytes inside of 12-byte region
// NO_COOKIE: ZZZZZZZZ
// CHECK: AddressSanitizer: heap-buffer-overflow
// CHECK: in {{\.?main}} {{.*}}new_array_cookie_test.cpp:[[@LINE-2]]
// CHECK: is located 0 bytes inside of 12-byte region
// NO_COOKIE: ZZZZZZZZ
delete [] buffer;
}
2 changes: 2 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/no_asan_gen_globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// RUN: %clang_asan %s -o %t.exe
// RUN: nm %t.exe | FileCheck %s

// UNSUPPORTED: target={{.*aix.*}}

int x, y, z;
int main() { return 0; }
// CHECK-NOT: ___asan_gen_
4 changes: 2 additions & 2 deletions compiler-rt/test/asan/TestCases/Posix/shared-lib-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ int main(int argc, char *argv[]) {
if (!inc) return 1;
printf("ok\n");
inc(1);
inc(-1); // BOOM
inc(11); // BOOM, 11 is more robust than -1 as -1 requires the GLOB and pad are stored adjacent.
// CHECK: {{.*ERROR: AddressSanitizer: global-buffer-overflow}}
// CHECK: {{READ of size 4 at 0x.* thread T0}}
// CHECK: {{ #0 0x.*}}
// CHECK: {{ #1 0x.* in main .*shared-lib-test.cpp:}}[[@LINE-4]]
// CHECK: {{ #1 0x.* in \.?main .*shared-lib-test.cpp:}}[[@LINE-4]]
return 0;
}
#else // SHARED_LIB
Expand Down
4 changes: 4 additions & 0 deletions compiler-rt/test/asan/TestCases/Posix/start-deactivated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// Fails with debug checks: https://bugs.llvm.org/show_bug.cgi?id=46862
// XFAIL: !compiler-rt-optimized

// For this case, do_another_bad_thing(which calls malloc) is compiled to a shared library,
// and intercepting symbols in a shared library is still unsupported.
// UNSUPPORTED: target={{.*aix.*}}

// RUN: %clangxx_asan -O0 -DSHARED_LIB %s -std=c++11 -fPIC -shared -o %t-so.so
// RUN: %clangxx -O0 %s -std=c++11 -c -o %t.o
// RUN: %clangxx_asan -O0 %t.o %libdl -o %t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// RUN: %clangxx_asan -fexceptions -O0 %s -o %t -pthread
// RUN: %env_asan_opts=detect_stack_use_after_return=0 %run %t

// This will hang on AIX
// UNSUPPORTED: target={{.*aix.*}}

#include <algorithm>
#include <cassert>
#include <cerrno>
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/test/asan/TestCases/Posix/wait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ int main(int argc, char **argv) {
// CHECK: stack-buffer-overflow
// CHECK: {{WRITE of size .* at 0x.* thread T0}}
// CHECK: {{in .*wait}}
// CHECK: {{in main .*wait.cpp:}}
// CHECK: {{in \.?main .*wait.cpp:}}
// CHECK: is located in stack of thread T0 at offset
// CHECK: {{in main}}
// CHECK: {{in \.?main}}
return res == -1 ? 1 : 0;
}
// child
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/test/asan/TestCases/Posix/wait3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ int main(int argc, char **argv) {
// CHECK: stack-buffer-overflow
// CHECK: {{WRITE of size .* at 0x.* thread T0}}
// CHECK: {{in .*wait}}
// CHECK: {{in main .*wait3.cpp:}}
// CHECK: {{in \.?main .*wait3.cpp:}}
// CHECK: is located in stack of thread T0 at offset
// CHECK: {{in main}}
// CHECK: {{in \.?main}}
return res == -1 ? 1 : 0;
}
// child
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/test/asan/TestCases/Posix/wait4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ int main(int argc, char **argv) {
// CHECK: stack-buffer-overflow
// CHECK: {{WRITE of size .* at 0x.* thread T0}}
// CHECK: {{in .*wait}}
// CHECK: {{in main .*wait4.cpp:}}
// CHECK: {{in \.?main .*wait4.cpp:}}
// CHECK: is located in stack of thread T0 at offset
// CHECK: {{in main}}
// CHECK: {{in \.?main}}
return res == -1 ? 1 : 0;
}
// child
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/test/asan/TestCases/Posix/waitid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ int main(int argc, char **argv) {
// CHECK: stack-buffer-overflow
// CHECK: {{WRITE of size .* at 0x.* thread T0}}
// CHECK: {{in .*waitid}}
// CHECK: {{in main .*waitid.cpp:}}
// CHECK: {{in \.?main .*waitid.cpp:}}
// CHECK: is located in stack of thread T0 at offset
// CHECK: {{in main}}
// CHECK: {{in \.?main}}
return res != -1;
}
// child
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/asan/TestCases/calloc-overflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main() {
void *p = calloc(-1, 1000);
// CHECK: {{ERROR: AddressSanitizer: calloc parameters overflow: count \* size \(.* \* 1000\) cannot be represented in type size_t}}
// CHECK: {{#0 0x.* in .*calloc}}
// CHECK: {{#[1-3] 0x.* in main .*calloc-overflow.cpp:}}[[@LINE-3]]
// CHECK: {{#[1-3] 0x.* in \.?main .*calloc-overflow.cpp:}}[[@LINE-3]]
// CHECK: SUMMARY: AddressSanitizer: calloc-overflow

printf("calloc returned: %zu\n", (size_t)p);
Expand Down
Loading
Loading