xref: /linux/arch/arm64/include/asm/vmap_stack.h (revision 7fc2cd2e4b398c57c9cf961cfea05eadbf34c05c)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2017 Arm Ltd.
3 #ifndef __ASM_VMAP_STACK_H
4 #define __ASM_VMAP_STACK_H
5 
6 #include <linux/gfp.h>
7 #include <linux/vmalloc.h>
8 #include <linux/pgtable.h>
9 #include <asm/memory.h>
10 #include <asm/thread_info.h>
11 
12 /*
13  * To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd
14  * stacks need to have the same alignment.
15  */
16 static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node)
17 {
18 	void *p;
19 
20 	p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node,
21 			__builtin_return_address(0));
22 	return kasan_reset_tag(p);
23 }
24 
25 #endif /* __ASM_VMAP_STACK_H */
26