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 Many singleton patches - please see the various changelogs for details. 2024-09-21 08:20:50 -07:00
configs RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
crypto crypto: riscv - add vector crypto accelerated AES-CBC-CTS 2024-03-20 08:56:11 -07:00
errata riscv: errata: sifive: Use SYM_*() assembly macros 2024-09-15 00:03:22 -07:00
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 Merge branch 'kvm-redo-enable-virt' into HEAD 2024-09-17 11:38:20 -04:00
lib Merge patch series "riscv: Improve KASAN coverage to fix unit tests" 2024-09-19 01:10:44 -07:00
mm RISC-V Patches for the 6.12 Merge Window, Part 1 2024-09-24 10:59:17 -07:00
net RISC-V Patches for the 6.11 Merge Window, Part 1 2024-07-20 09:11:27 -07:00
purgatory Merge patch series "riscv: Improve KASAN coverage to fix unit tests" 2024-09-19 01:10:44 -07:00
tools riscv: Check relocations at compile time 2023-04-19 07:46:32 -07:00
Kbuild RISC-V: hook new crypto subdir into build-system 2024-01-22 17:55:17 -08:00
Kconfig riscv: Fix kernel stack size when KASAN is enabled 2024-10-01 13:08:11 -07:00
Kconfig.debug riscv: Add tests for riscv module loading 2023-11-07 14:59:32 -08:00
Kconfig.errata riscv: thead: Rename T-Head PBMT to MAE 2024-04-25 10:22:33 -07:00
Kconfig.socs RISC-V: drop SOC_VIRT for ARCH_VIRT 2024-04-10 11:37:50 +01:00
Kconfig.vendor riscv: Extend cpufeature.c to detect vendor extensions 2024-07-22 15:36:54 -07:00
Makefile riscv: boot: add Image.xz support 2024-09-01 20:43:27 -07:00
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00