diff mbox series

x86: Increase exception stack sizes

Message ID YUIO9Ye98S5Eb68w@hirez.programming.kicks-ass.net (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series x86: Increase exception stack sizes | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Peter Zijlstra Sept. 15, 2021, 3:19 p.m. UTC
On Wed, Sep 15, 2021 at 03:34:20PM +0800, 王贇 wrote:
> Hi, Dave, Peter
> 
> What if we just increase the stack size when ftrace enabled?

I think we can do an unconditional increase. But please first test that
guard page patch :-)

---
Subject: x86: Increase exception stack sizes
From: Peter Zijlstra <peterz@infradead.org>
Date: Wed Sep 15 16:19:46 CEST 2021

It turns out that a single page of stack is trivial to overflow with
all the tracing gunk enabled. Raise the exception stacks to 2 pages,
which is still half the interrupt stacks, which are at 4 pages.

Reported-by: Michael Wang <yun.wang@linux.alibaba.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/include/asm/page_64_types.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

王贇 Sept. 16, 2021, 3:42 a.m. UTC | #1
On 2021/9/15 下午11:19, Peter Zijlstra wrote:
> On Wed, Sep 15, 2021 at 03:34:20PM +0800, 王贇 wrote:
>> Hi, Dave, Peter
>>
>> What if we just increase the stack size when ftrace enabled?
> 
> I think we can do an unconditional increase. But please first test that
> guard page patch :-)

Nice~ let's focus on the guard one firstly.

Regards,
Michael Wang

> 
> ---
> Subject: x86: Increase exception stack sizes
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Wed Sep 15 16:19:46 CEST 2021
> 
> It turns out that a single page of stack is trivial to overflow with
> all the tracing gunk enabled. Raise the exception stacks to 2 pages,
> which is still half the interrupt stacks, which are at 4 pages.
> 
> Reported-by: Michael Wang <yun.wang@linux.alibaba.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  arch/x86/include/asm/page_64_types.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/arch/x86/include/asm/page_64_types.h
> +++ b/arch/x86/include/asm/page_64_types.h
> @@ -15,7 +15,7 @@
>  #define THREAD_SIZE_ORDER	(2 + KASAN_STACK_ORDER)
>  #define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
>  
> -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER)
> +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)
>  #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
>  
>  #define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)
>
diff mbox series

Patch

--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -15,7 +15,7 @@ 
 #define THREAD_SIZE_ORDER	(2 + KASAN_STACK_ORDER)
 #define THREAD_SIZE  (PAGE_SIZE << THREAD_SIZE_ORDER)
 
-#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER)
+#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)
 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
 
 #define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)