summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-03-14 12:06:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-08 15:39:53 +0300
commit34bc1f69bf569309e76e5dfd574ee9034ceca147 (patch)
tree5c28a008d9051af35d58452fd7b96ac0bd2ea40d /arch/riscv
parent24b9b8e95ca1bc87e055cf3ee4f8c502c10ef938 (diff)
downloadlinux-34bc1f69bf569309e76e5dfd574ee9034ceca147.tar.xz
riscv: Increase stack size under KASAN
commit b81d591386c3a50b96dddcf663628ea0df0bf2b3 upstream. 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: 8ad8b72721d0 ("riscv: Add KASAN support") Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/include/asm/thread_info.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h
index a390711129de..d79ae9d98999 100644
--- a/arch/riscv/include/asm/thread_info.h
+++ b/arch/riscv/include/asm/thread_info.h
@@ -11,11 +11,17 @@
#include <asm/page.h>
#include <linux/const.h>
+#ifdef CONFIG_KASAN
+#define KASAN_STACK_ORDER 1
+#else
+#define KASAN_STACK_ORDER 0
+#endif
+
/* thread information allocation */
#ifdef CONFIG_64BIT
-#define THREAD_SIZE_ORDER (2)
+#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER)
#else
-#define THREAD_SIZE_ORDER (1)
+#define THREAD_SIZE_ORDER (1 + KASAN_STACK_ORDER)
#endif
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)