2019-04-16 23:19:35 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2018-01-08 23:38:10 +08:00
|
|
|
// Copyright (C) 2017 Arm Ltd.
|
|
|
|
#ifndef __ASM_VMAP_STACK_H
|
|
|
|
#define __ASM_VMAP_STACK_H
|
|
|
|
|
|
|
|
#include <linux/bug.h>
|
|
|
|
#include <linux/gfp.h>
|
|
|
|
#include <linux/kconfig.h>
|
|
|
|
#include <linux/vmalloc.h>
|
2020-06-09 12:32:38 +08:00
|
|
|
#include <linux/pgtable.h>
|
2020-06-09 12:32:42 +08:00
|
|
|
#include <asm/memory.h>
|
2018-01-08 23:38:10 +08:00
|
|
|
#include <asm/thread_info.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd
|
|
|
|
* stacks need to have the same alignment.
|
|
|
|
*/
|
|
|
|
static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node)
|
|
|
|
{
|
2022-03-25 09:11:10 +08:00
|
|
|
void *p;
|
|
|
|
|
2018-01-08 23:38:10 +08:00
|
|
|
BUILD_BUG_ON(!IS_ENABLED(CONFIG_VMAP_STACK));
|
|
|
|
|
2022-03-25 09:11:10 +08:00
|
|
|
p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node,
|
2020-06-02 12:52:06 +08:00
|
|
|
__builtin_return_address(0));
|
2022-03-25 09:11:10 +08:00
|
|
|
return kasan_reset_tag(p);
|
2018-01-08 23:38:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __ASM_VMAP_STACK_H */
|