alpha: Implement "current_stack_pointer"
PATCH 1/1 alpha: Implement "current_stack_pointer"
To follow the existing per-arch conventions replace open-coded use of asm "$30" as "current_stack_pointer". This will let it be used in non-arch places (like HARDENED_USERCOPY).
--- arch/alpha/Kconfig | 1 + arch/alpha/include/asm/thread_info.h | 2 ++ arch/alpha/lib/stacktrace.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)
arch/alpha/Kconfig +1 -0
@@ -3,6 +3,7 @@ config ALPHA bool default y select ARCH_32BIT_USTAT_F_TINODE + select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select ARCH_NO_PREEMPT
arch/alpha/include/asm/thread_info.h +2 -0
@@ -43,6 +43,8 @@ struct thread_info { registerstruct thread_info *__current_thread_info __asm__("$8" );#define current_thread_info () __current_thread_info +registerunsigned long *current_stack_pointer __asm__ ("$30" ); +#endif /* __ASSEMBLY__ */ /* Thread information allocation. */
arch/alpha/lib/stacktrace.c +1 -1
@@ -92,7 +92,7 @@ stacktrace(void) {instr * ret_pc;instr * prologue = (instr *)stacktrace; - registerunsigned char * sp __asm__ ("$30" ); +unsigned char *sp = (unsigned char *)current_stack_pointer;printk ("\tstack trace:\n" ); do {
Signature · 1 line
2.30.2
Matt Turner
maintainerQuoted 62 lines · Kees Cook
To follow the existing per-arch conventions replace open-coded use of asm "$30" as "
current_stack_pointer". This will let it be used in non-arch places (likeHARDENED_USERCOPY).Cc Richard Henderson <[email protected]>Cc Ivan Kokshaysky <[email protected]>Cc Matt Turner <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Andrew Morton <[email protected]>Cc Mike Rapoport <[email protected]>Cc Mark Rutland <[email protected]>Cc "Peter Zijlstra (Intel)" <[email protected]>Cc Kefeng Wang <[email protected]>Cc "Alexander A. Klimov" <[email protected]>Signed-off-by Kees Cook <[email protected]>--- arch/alpha/Kconfig | 1 + arch/alpha/include/asm/thread_info.h | 2 ++ arch/alpha/lib/stacktrace.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-)arch/alpha/Kconfig +1
-0@@ -3,6 +3,7 @@ config ALPHA bool default y select ARCH_32BIT_USTAT_F_TINODE + select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select ARCH_NO_PREEMPTarch/alpha/include/asm/thread_info.h +2
-0@@ -43,6 +43,8 @@ struct thread_info { registerstruct thread_info *__current_thread_info __asm__("$8" );#define current_thread_info () __current_thread_info +registerunsigned long *current_stack_pointer __asm__ ("$30" ); +#endif /* __ASSEMBLY__ */ /* Thread information allocation. */ arch/alpha/lib/stacktrace.c +1
-2@@ -92,7 +92,7 @@ stacktrace(void) {instr * ret_pc;instr * prologue = (instr *)stacktrace; - registerunsigned char * sp __asm__ ("$30" ); +unsigned char *sp = (unsigned char *)current_stack_pointer;printk ("\tstack trace:\n" ); do { --
Quoted 2 lines
2.30.2
Thanks for the patch! This was included in my pull request today and is now upstream in Linus' tree.
Quoted 3 lines · Matt Turner
Thanks for the patch! This was included in my pull request today and is now upstream in Linus' tree.
[trimming Cc list for hijacked thread]
Hi Matt,
I remember that Stephen Rothwell mentioned he dropped a couple of architecture trees from linux-next due to long inactivity, and I see that none of your branches are included any more. Should
https://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha.git/log/?h=for-linus
or the (currently empty) alpha-next branch be added back there?
Arnd
Hi Arnd,
Quoted 10 lines · On Sun, 26 Feb 2023 11:24:13 +0100 "Arnd Bergmann" <[email protected]> wrote:
Quoted 3 lines · Matt Turner
Thanks for the patch! This was included in my pull request today and is now upstream in Linus' tree.
[trimming Cc list for hijacked thread]
Hi Matt,
Quoted 7 lines
I remember that Stephen Rothwell mentioned he dropped a couple of architecture trees from linux-next due to long inactivity, and I see that none of your branches are included any more. Should
https://git.kernel.org/pub/scm/linux/kernel/git/mattst88/alpha.git/log/?h=for-linus
or the (currently empty) alpha-next branch be added back there?
There has never been an alpha branch in linux-next.
I would welcome one, however ;-)
Signature · 2 lines
Cheers, Stephen Rothwell