linux/arch/riscv
Alexandre Ghiti cfb10de185
riscv: Fix kernel stack size when KASAN is enabled
We use Kconfig to select the kernel stack size, doubling the default
size if KASAN is enabled.

But that actually only works if KASAN is selected from the beginning,
meaning that if KASAN config is added later (for example using
menuconfig), CONFIG_THREAD_SIZE_ORDER won't be updated, keeping the
default size, which is not enough for KASAN as reported in [1].

So fix this by moving the logic to compute the right kernel stack into a
header.

Fixes: a7555f6b62 ("riscv: stack: Add config of thread stack size")
Reported-by: syzbot+ba9eac24453387a9d502@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/000000000000eb301906222aadc2@google.com/ [1]
Cc: stable@vger.kernel.org
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20240917150328.59831-1-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2024-10-01 13:08:11 -07:00
..
boot
configs RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
crypto
errata
include riscv: Fix kernel stack size when KASAN is enabled 2024-10-01 13:08:11 -07:00
kernel RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
kvm
lib
mm RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
net
purgatory
tools
Kbuild
Kconfig riscv: Fix kernel stack size when KASAN is enabled 2024-10-01 13:08:11 -07:00
Kconfig.debug
Kconfig.errata
Kconfig.socs
Kconfig.vendor
Makefile
Makefile.postlink