1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
3
4#include <assert.h>
5#include <errno.h>
6#include <glob.h>
7#include <stdio.h>
8#include <string.h>
9
10#include <sanitizer/linux_syscall_hooks.h>
11
12/* Test the presence of __sanitizer_syscall_ in the tool runtime, and general
13 sanity of their behaviour. */
14
15int main(int argc, char *argv[]) {
16 char buf[1000];
17 __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
18 // CHECK: AddressSanitizer: stack-buffer-{{.*}}erflow
19 // CHECK: READ of size {{.*}} at {{.*}} thread T0
20 // CHECK: {{#[0-9]+ .*}} in __sanitizer_syscall{{.*}}recvmsg
21 return 0;
22}
23

source code of compiler-rt/test/asan/TestCases/Linux/syscalls.cpp