2020-06-18 14:56:01

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 4/7] x86/entry: Increase entry_stack size to a full page

Marco crashed in bad_iret with a Clang11/KCSAN build due to
overflowing the stack. Now that we run C code on it, expand it to a
full page.

Suggested-by: Andy Lutomirski <[email protected]>
Reported-by: Marco Elver <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
arch/x86/include/asm/processor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -370,7 +370,7 @@ struct x86_hw_tss {
#define IO_BITMAP_OFFSET_INVALID (__KERNEL_TSS_LIMIT + 1)

struct entry_stack {
- unsigned long words[64];
+ char stack[PAGE_SIZE];
};

struct entry_stack_page {



2020-06-18 15:11:46

by Marco Elver

[permalink] [raw]
Subject: Re: [PATCH 4/7] x86/entry: Increase entry_stack size to a full page

On Thu, 18 Jun 2020 at 16:50, Peter Zijlstra <[email protected]> wrote:
>
> Marco crashed in bad_iret with a Clang11/KCSAN build due to
> overflowing the stack. Now that we run C code on it, expand it to a
> full page.
>
> Suggested-by: Andy Lutomirski <[email protected]>
> Reported-by: Marco Elver <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>

This fixes the unpredictable crashes.

Tested-by: Marco Elver <[email protected]>

Thanks!


> ---
> arch/x86/include/asm/processor.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -370,7 +370,7 @@ struct x86_hw_tss {
> #define IO_BITMAP_OFFSET_INVALID (__KERNEL_TSS_LIMIT + 1)
>
> struct entry_stack {
> - unsigned long words[64];
> + char stack[PAGE_SIZE];
> };
>
> struct entry_stack_page {
>
>

2020-06-19 04:50:40

by Lai Jiangshan

[permalink] [raw]
Subject: Re: [PATCH 4/7] x86/entry: Increase entry_stack size to a full page

On Fri, Jun 19, 2020 at 4:37 AM Peter Zijlstra <[email protected]> wrote:
>
> Marco crashed in bad_iret with a Clang11/KCSAN build due to
> overflowing the stack. Now that we run C code on it, expand it to a
> full page.

Some of my experimental code also once got crashed due to overflowing
the stack. I'm glad to have the stack expanded, thanks.

Reviewed-by: Lai Jiangshan <[email protected]>

>
> Suggested-by: Andy Lutomirski <[email protected]>
> Reported-by: Marco Elver <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> ---
> arch/x86/include/asm/processor.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/arch/x86/include/asm/processor.h
> +++ b/arch/x86/include/asm/processor.h
> @@ -370,7 +370,7 @@ struct x86_hw_tss {
> #define IO_BITMAP_OFFSET_INVALID (__KERNEL_TSS_LIMIT + 1)
>
> struct entry_stack {
> - unsigned long words[64];
> + char stack[PAGE_SIZE];
> };
>
> struct entry_stack_page {
>
>

2020-06-25 11:54:20

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [tip: x86/entry] x86/entry: Increase entry_stack size to a full page

The following commit has been merged into the x86/entry branch of tip:

Commit-ID: c7aadc09321d8f9a1d3bd1e6d8a47222ecddf6c5
Gitweb: https://git.kernel.org/tip/c7aadc09321d8f9a1d3bd1e6d8a47222ecddf6c5
Author: Peter Zijlstra <[email protected]>
AuthorDate: Wed, 17 Jun 2020 18:25:57 +02:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Thu, 25 Jun 2020 13:45:40 +02:00

x86/entry: Increase entry_stack size to a full page

Marco crashed in bad_iret with a Clang11/KCSAN build due to
overflowing the stack. Now that we run C code on it, expand it to a
full page.

Suggested-by: Andy Lutomirski <[email protected]>
Reported-by: Marco Elver <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Lai Jiangshan <[email protected]>
Tested-by: Marco Elver <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
arch/x86/include/asm/processor.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 42cd333..03b7c4c 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -370,7 +370,7 @@ struct x86_hw_tss {
#define IO_BITMAP_OFFSET_INVALID (__KERNEL_TSS_LIMIT + 1)

struct entry_stack {
- unsigned long words[64];
+ char stack[PAGE_SIZE];
};

struct entry_stack_page {