summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorAlexandre Ghiti <alexandre.ghiti@canonical.com>2021-12-06 13:46:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-09 11:20:47 +0300
commit4a5c7a61ff506a7cc385cd952038183a2d095880 (patch)
treed176c591ec3aa2ee6d93ed7d60361ef6c596b5fd /arch/riscv
parent6b45437959dcfa177df32ac63318d3e1d7377523 (diff)
downloadlinux-4a5c7a61ff506a7cc385cd952038183a2d095880.tar.xz
riscv: Initialize thread pointer before calling C functions
commit 35d33c76d68dfacc330a8eb477b51cc647c5a847 upstream. Because of the stack canary feature that reads from the current task structure the stack canary value, the thread pointer register "tp" must be set before calling any C function from head.S: by chance, setup_vm and all the functions that it calls does not seem to be part of the functions where the canary check is done, but in the following commits, some functions will. Fixes: f2c9699f65557a31 ("riscv: Add STACKPROTECTOR supported") Signed-off-by: Alexandre Ghiti <alexandre.ghiti@canonical.com> 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/kernel/head.S1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 1a819c18bede..47d1411db0a9 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -261,6 +261,7 @@ clear_bss_done:
REG_S a0, (a2)
/* Initialize page tables and relocate to virtual addresses */
+ la tp, init_task
la sp, init_thread_union + THREAD_SIZE
mv a0, s1
call setup_vm