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.
1 parent 52d1cda commit 8b7b434Copy full SHA for 8b7b434
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
@@ -62,8 +63,11 @@ void *Thread(void *arg) {
62
63
64
int main(void) {
65
// Allocate main and alt stack for future thread.
- void *main_stack = malloc(kStackSize);
66
- void *alt_stack = malloc(kStackSize);
+ void *main_stack;
67
+ void *alt_stack;
68
+ size_t const kPageSize = sysconf(_SC_PAGESIZE);
69
+ assert(posix_memalign(&main_stack, kPageSize, kStackSize) == 0);
70
+ assert(posix_memalign(&alt_stack, kPageSize, kStackSize) == 0);
71
72
// Pick the lower stack as the main stack, as we want to trigger GC in
73
// FakeStack from alt stack in a such way that main stack is allocated below.
0 commit comments