We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents de66661 + 1655795 commit 89e8106Copy full SHA for 89e8106
compiler-rt/test/asan/TestCases/Posix/fake_stack_gc.cpp
@@ -11,6 +11,7 @@
11
#include <signal.h>
12
#include <stdio.h>
13
#include <stdlib.h>
14
+#include <unistd.h>
15
16
const size_t kStackSize = 0x100000;
17
@@ -63,8 +64,11 @@ void *Thread(void *arg) {
63
64
65
int main(void) {
66
// Allocate main and alt stack for future thread.
- void *main_stack = malloc(kStackSize);
67
- void *alt_stack = malloc(kStackSize);
+ void *main_stack;
68
+ void *alt_stack;
69
+ size_t const kPageSize = sysconf(_SC_PAGESIZE);
70
+ assert(posix_memalign(&main_stack, kPageSize, kStackSize) == 0);
71
+ assert(posix_memalign(&alt_stack, kPageSize, kStackSize) == 0);
72
73
// Pick the lower stack as the main stack, as we want to trigger GC in
74
// FakeStack from alt stack in a such way that main stack is allocated below.
0 commit comments