powerpc: align stack to 2 * THREAD_SIZE with VMAP_STACK
In order to ease stack overflow detection, align stack to 2 * THREAD_SIZE when using VMAP_STACK. This allows overflow detection using a single bit check. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/60e9ae86b7d2cdcf21468787076d345663648f46.1576916812.git.christophe.leroy@c-s.fr
This commit is contained in:

committed by
Michael Ellerman

부모
028474876f
커밋
63289e7d3a
@@ -22,6 +22,19 @@
|
||||
|
||||
#define THREAD_SIZE (1 << THREAD_SHIFT)
|
||||
|
||||
/*
|
||||
* By aligning VMAP'd stacks to 2 * THREAD_SIZE, we can detect overflow by
|
||||
* checking sp & (1 << THREAD_SHIFT), which we can do cheaply in the entry
|
||||
* assembly.
|
||||
*/
|
||||
#ifdef CONFIG_VMAP_STACK
|
||||
#define THREAD_ALIGN_SHIFT (THREAD_SHIFT + 1)
|
||||
#else
|
||||
#define THREAD_ALIGN_SHIFT THREAD_SHIFT
|
||||
#endif
|
||||
|
||||
#define THREAD_ALIGN (1 << THREAD_ALIGN_SHIFT)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <linux/cache.h>
|
||||
#include <asm/processor.h>
|
||||
|
Reference in New Issue
Block a user