File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
compiler-rt/test/asan/TestCases/Posix Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11
11
#include < signal.h>
12
12
#include < stdio.h>
13
13
#include < stdlib.h>
14
+ #include < unistd.h>
14
15
15
16
const size_t kStackSize = 0x100000 ;
16
17
@@ -63,8 +64,11 @@ void *Thread(void *arg) {
63
64
64
65
int main (void ) {
65
66
// Allocate main and alt stack for future thread.
66
- void *main_stack = malloc (kStackSize );
67
- void *alt_stack = malloc (kStackSize );
67
+ 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 );
68
72
69
73
// Pick the lower stack as the main stack, as we want to trigger GC in
70
74
// FakeStack from alt stack in a such way that main stack is allocated below.
You can’t perform that action at this time.
0 commit comments