• Home
  • Raw
  • Download

Lines Matching full:stack

13  *   a thread as a stack and expect the mapping to grow when we touch the
15 * growable mapping as a stack.
17 * The kernel only grows the memory region when the stack pointer is within
22 * 'stack_guard_gap' pages to an existing mapping. So when we map the stack we
23 * make sure there is enough of free address space before the lowest stack
28 * The stack memory map would look like:
36 * ^ | - - stack size - - |
39 * stack bottom stack top
43 * We allocate stack as we do in the first test but we mmap a page in the
44 * space the stack is supposed to grow into and we expect the thread to
77 tst_brk(TCONF, "Test can't be performed with stack grows up architecture"); in setup()
83 * Returns stack lowest address. Note that the address is not mapped and will
84 * be mapped on page fault when we grow the stack to the lowest address possible.
103 tst_res(TINFO, "start = %p, stack_top = %p, stack bottom = %p", in allocate_stack()
105 tst_res(TINFO, "mapped pages %zu, stack pages %zu", in allocate_stack()
122 * We set the limit one page above the stack bottom to make sure that the stack
126 * Generally the stack frame would be much smaller than page_size so moving the
130 static void grow_stack(void *stack, size_t size) in grow_stack() argument
135 void *limit = stack + page_size; in grow_stack()
141 ret = pthread_attr_setstack(&attr, stack, size); in grow_stack()
155 void *stack; in grow_stack_success() local
159 stack = allocate_stack(stack_size, mapped_size); in grow_stack_success()
160 grow_stack(stack, stack_size); in grow_stack_success()
165 tst_res(TPASS, "Stack grows in unmapped region"); in grow_stack_success()
172 * We map a page at the bottom of the stack which will cause the thread to be
179 void *stack; in grow_stack_fail() local
184 stack = allocate_stack(stack_size, mapped_size); in grow_stack_fail()
186 SAFE_MMAP(stack, page_size, PROT_READ | PROT_WRITE, in grow_stack_fail()
189 tst_res(TINFO, "mapped page at %p", stack); in grow_stack_fail()
191 grow_stack(stack, stack_size); in grow_stack_fail()