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