Skip to content

Commit b81d591

Browse files
dvyukovpalmer-dabbelt
authored andcommitted
riscv: Increase stack size under KASAN
KASAN requires more stack space because of compiler instrumentation. Increase stack size as other arches do. Signed-off-by: Dmitry Vyukov <dvyukov@google.com> Reported-by: syzbot+0600986d88e2d4d7ebb8@syzkaller.appspotmail.com Fixes: 8ad8b72 ("riscv: Add KASAN support") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 2b2b574 commit b81d591

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

arch/riscv/include/asm/thread_info.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111
#include <asm/page.h>
1212
#include <linux/const.h>
1313

14+
#ifdef CONFIG_KASAN
15+
#define KASAN_STACK_ORDER 1
16+
#else
17+
#define KASAN_STACK_ORDER 0
18+
#endif
19+
1420
/* thread information allocation */
1521
#ifdef CONFIG_64BIT
16-
#define THREAD_SIZE_ORDER (2)
22+
#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER)
1723
#else
18-
#define THREAD_SIZE_ORDER (1)
24+
#define THREAD_SIZE_ORDER (1 + KASAN_STACK_ORDER)
1925
#endif
2026
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
2127

0 commit comments

Comments
 (0)