1 | // RUN: %clangxx -O1 %s -o %t && %run %t |
---|---|
2 | // UNSUPPORTED: android |
3 | |
4 | // Fail on powerpc64 bots with: |
5 | // AddressSanitizer: CHECK failed: asan_thread.cpp:315 "((AddrIsInStack((uptr)&local))) != (0)" |
6 | // https://lab.llvm.org/buildbot/#/builders/18/builds/8162 |
7 | // UNSUPPORTED: target=powerpc64{{.*}} |
8 | /// Occasionally fail on loongarch64 machine |
9 | // UNSUPPORTED: target=loongarch64{{.*}} |
10 | |
11 | #include <assert.h> |
12 | #include <stdlib.h> |
13 | #include <sys/resource.h> |
14 | #include <sys/wait.h> |
15 | #include <unistd.h> |
16 | |
17 | int main(int argc, char **argv) { |
18 | if (getenv(name: "SANITIZER_TEST_REEXECED")) |
19 | exit(status: 0); |
20 | struct rlimit rl; |
21 | assert(!getrlimit(RLIMIT_STACK, &rl)); |
22 | struct rlimit rl_new = rl; |
23 | rl_new.rlim_cur = 17351; |
24 | assert(!setrlimit(RLIMIT_STACK, &rl_new)); |
25 | int pid = fork(); |
26 | assert(pid >= 0); |
27 | if (pid == 0) { |
28 | const char *envp[] = {"SANITIZER_TEST_REEXECED=1", nullptr}; |
29 | execve(path: argv[0], argv: argv, envp: const_cast<char **>(envp)); |
30 | assert(false); |
31 | } |
32 | int status; |
33 | while (waitpid(pid: -1, stat_loc: &status, __WALL) != pid) { |
34 | } |
35 | assert(WIFEXITED(status) && WEXITSTATUS(status) == 0); |
36 | return 0; |
37 | } |
38 |