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
@@ -62,8 +63,11 @@ void *Thread(void *arg) {
62
63
63
64
int main (void ) {
64
65
// Allocate main and alt stack for future thread.
65
- void *main_stack = malloc (kStackSize );
66
- void *alt_stack = malloc (kStackSize );
66
+ 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 );
67
71
68
72
// Pick the lower stack as the main stack, as we want to trigger GC in
69
73
// 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