Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / sanbox_read_proc_self_maps_test.cpp
blobd9099edffcacbc7e304a8599e6f371bf5ff075c0
1 // REQUIRES: x86_64-target-arch
2 // RUN: %clangxx_asan %s -o %t
3 // RUN: not %run %t 2>&1 | FileCheck %s
4 #include <sanitizer/common_interface_defs.h>
5 #include <sched.h>
6 #include <unistd.h>
7 #include <stdio.h>
8 #include <stdlib.h>
10 int main() {
11 __sanitizer_sandbox_arguments args = {0};
12 // should cache /proc/self/maps
13 __sanitizer_sandbox_on_notify(&args);
15 if (unshare(CLONE_NEWUSER)) {
16 printf("unshare failed\n");
17 return 1;
20 // remove access to /proc/self/maps
21 if (chroot("/tmp")) {
22 printf("chroot failed\n");
23 return 2;
26 *(volatile int*)0x42 = 0;
27 // CHECK-NOT: CHECK failed