Lines Matching refs: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");
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",
105 tst_res(TINFO, "mapped pages %zu, stack pages %zu",
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)
135 void *limit = stack + page_size;
141 ret = pthread_attr_setstack(&attr, stack, size);
155 void *stack;
159 stack = allocate_stack(stack_size, mapped_size);
160 grow_stack(stack, stack_size);
172 * We map a page at the bottom of the stack which will cause the thread to be
179 void *stack;
184 stack = allocate_stack(stack_size, mapped_size);
186 SAFE_MMAP(stack, page_size, PROT_READ | PROT_WRITE,
189 tst_res(TINFO, "mapped page at %p", stack);
191 grow_stack(stack, stack_size);