linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] RISC-V: Align the shadow stack
@ 2022-11-30  2:35 Palmer Dabbelt
  2022-11-30  2:35 ` [PATCH 2/2] RISC-V: Add some comments about the shadow and overflow stacks Palmer Dabbelt
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Palmer Dabbelt @ 2022-11-30  2:35 UTC (permalink / raw)
  To: jszhang, guoren, linux-riscv, linux-kernel; +Cc: Palmer Dabbelt

The standard RISC-V ABIs all require 16-byte stack alignment.  We're
only calling that one function on the shadow stack so I doubt it'd
result in a real issue, but might as well keep this lined up.

Fixes: 31da94c25aea ("riscv: add VMAP_STACK overflow detection")
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
 arch/riscv/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index be54ccea8c47..acdfcacd7e57 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -206,7 +206,7 @@ static DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)],
  * shadow stack, handled_ kernel_ stack_ overflow(in kernel/entry.S) is used
  * to get per-cpu overflow stack(get_overflow_stack).
  */
-long shadow_stack[SHADOW_OVERFLOW_STACK_SIZE/sizeof(long)];
+long shadow_stack[SHADOW_OVERFLOW_STACK_SIZE/sizeof(long)] __aligned(16);
 asmlinkage unsigned long get_overflow_stack(void)
 {
 	return (unsigned long)this_cpu_ptr(overflow_stack) +
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-12-13  6:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30  2:35 [PATCH 1/2] RISC-V: Align the shadow stack Palmer Dabbelt
2022-11-30  2:35 ` [PATCH 2/2] RISC-V: Add some comments about the shadow and overflow stacks Palmer Dabbelt
2022-12-01 13:17   ` Guo Ren
2022-12-01 16:21   ` Jisheng Zhang
2022-11-30  2:47 ` [PATCH 1/2] RISC-V: Align the shadow stack Khem Raj
2022-11-30  2:50   ` Palmer Dabbelt
2022-11-30  2:56     ` Khem Raj
2022-11-30  3:00       ` Palmer Dabbelt
2022-12-01 16:22 ` Jisheng Zhang
2022-12-13  6:17 ` Palmer Dabbelt
2022-12-13  6:20 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).