Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

riscv: Rename "sp_in_global" to "current_stack_pointer"

To follow the existing per-arch conventions, rename "sp_in_global" to
"current_stack_pointer". This will let it be used in non-arch places
(like HARDENED_USERCOPY).

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

authored by

Kees Cook and committed by
Palmer Dabbelt
fdecfea0 60210a3d

+5 -4
+1
arch/riscv/Kconfig
··· 16 16 select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION 17 17 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 18 18 select ARCH_HAS_BINFMT_FLAT 19 + select ARCH_HAS_CURRENT_STACK_POINTER 19 20 select ARCH_HAS_DEBUG_VM_PGTABLE 20 21 select ARCH_HAS_DEBUG_VIRTUAL if MMU 21 22 select ARCH_HAS_DEBUG_WX
+2
arch/riscv/include/asm/current.h
··· 33 33 34 34 #define current get_current() 35 35 36 + register unsigned long current_stack_pointer __asm__("sp"); 37 + 36 38 #endif /* __ASSEMBLY__ */ 37 39 38 40 #endif /* _ASM_RISCV_CURRENT_H */
+2 -4
arch/riscv/kernel/stacktrace.c
··· 14 14 15 15 #include <asm/stacktrace.h> 16 16 17 - register unsigned long sp_in_global __asm__("sp"); 18 - 19 17 #ifdef CONFIG_FRAME_POINTER 20 18 21 19 void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, ··· 28 30 pc = instruction_pointer(regs); 29 31 } else if (task == NULL || task == current) { 30 32 fp = (unsigned long)__builtin_frame_address(0); 31 - sp = sp_in_global; 33 + sp = current_stack_pointer; 32 34 pc = (unsigned long)walk_stackframe; 33 35 } else { 34 36 /* task blocked in __switch_to */ ··· 76 78 sp = user_stack_pointer(regs); 77 79 pc = instruction_pointer(regs); 78 80 } else if (task == NULL || task == current) { 79 - sp = sp_in_global; 81 + sp = current_stack_pointer; 80 82 pc = (unsigned long)walk_stackframe; 81 83 } else { 82 84 /* task blocked in __switch_to */