2020-07-31 15:00:59

by Maninder Singh

[permalink] [raw]
Subject: [PATCH 1/1] arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack

IRQ_STACK_SIZE can be made different from THREAD_SIZE,
and as IRQ_STACK_SIZE is used while irq stack allocation,
same define should be used while printing information of irq stack.

Signed-off-by: Maninder Singh <[email protected]>
---
arch/arm64/kernel/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 47f651d..13ebd5c 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -855,7 +855,7 @@ asmlinkage void handle_bad_stack(struct pt_regs *regs)
pr_emerg("Task stack: [0x%016lx..0x%016lx]\n",
tsk_stk, tsk_stk + THREAD_SIZE);
pr_emerg("IRQ stack: [0x%016lx..0x%016lx]\n",
- irq_stk, irq_stk + THREAD_SIZE);
+ irq_stk, irq_stk + IRQ_STACK_SIZE);
pr_emerg("Overflow stack: [0x%016lx..0x%016lx]\n",
ovf_stk, ovf_stk + OVERFLOW_STACK_SIZE);

--
1.9.1


2020-07-31 15:35:23

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH 1/1] arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack

On Fri, Jul 31, 2020 at 05:19:50PM +0530, Maninder Singh wrote:
> IRQ_STACK_SIZE can be made different from THREAD_SIZE,

While that's true in theory, IRQ_STACK_SIZE is defined as:

| #define IRQ_STACK_SIZE THREAD_SIZE

... which *must* be the case or the overflow detction will either miss
some overflows, or spuriously detect overflows where there are none.

Pleased beware if you are changing this locally.

> and as IRQ_STACK_SIZE is used while irq stack allocation,
> same define should be used while printing information of irq stack.
>
> Signed-off-by: Maninder Singh <[email protected]>

Regardless of the above, it is best to use the more specific mnemonic,
so:

Acked-by: Mark Rutland <[email protected]>

I'll leave it to Catalin and Will to pick this up.

Mark.

> ---
> arch/arm64/kernel/traps.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
> index 47f651d..13ebd5c 100644
> --- a/arch/arm64/kernel/traps.c
> +++ b/arch/arm64/kernel/traps.c
> @@ -855,7 +855,7 @@ asmlinkage void handle_bad_stack(struct pt_regs *regs)
> pr_emerg("Task stack: [0x%016lx..0x%016lx]\n",
> tsk_stk, tsk_stk + THREAD_SIZE);
> pr_emerg("IRQ stack: [0x%016lx..0x%016lx]\n",
> - irq_stk, irq_stk + THREAD_SIZE);
> + irq_stk, irq_stk + IRQ_STACK_SIZE);
> pr_emerg("Overflow stack: [0x%016lx..0x%016lx]\n",
> ovf_stk, ovf_stk + OVERFLOW_STACK_SIZE);
>
> --
> 1.9.1
>

2020-07-31 17:52:46

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH 1/1] arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack

On Fri, 31 Jul 2020 17:19:50 +0530, Maninder Singh wrote:
> IRQ_STACK_SIZE can be made different from THREAD_SIZE,
> and as IRQ_STACK_SIZE is used while irq stack allocation,
> same define should be used while printing information of irq stack.

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64: use IRQ_STACK_SIZE instead of THREAD_SIZE for irq stack
https://git.kernel.org/arm64/c/338c11e94e16

--
Catalin