* [PATCH] alpha: Implement "current_stack_pointer"
@ 2022-02-24 6:05 Kees Cook
2023-02-26 2:08 ` Matt Turner
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2022-02-24 6:05 UTC (permalink / raw)
To: Richard Henderson
Cc: Kees Cook, Ivan Kokshaysky, Matt Turner, Geert Uytterhoeven,
Andrew Morton, Mike Rapoport, Mark Rutland,
Peter Zijlstra (Intel),
Kefeng Wang, Alexander A. Klimov, linux-alpha, Arnd Bergmann,
linux-kernel, linux-hardening
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).
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: "Alexander A. Klimov" <grandmaster@al2klimov.de>
Cc: linux-alpha@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
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(-)
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 4e87783c90ad..31f3dbcdc28c 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -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
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
index 2592356e3215..28214db31053 100644
--- a/arch/alpha/include/asm/thread_info.h
+++ b/arch/alpha/include/asm/thread_info.h
@@ -43,6 +43,8 @@ struct thread_info {
register struct thread_info *__current_thread_info __asm__("$8");
#define current_thread_info() __current_thread_info
+register unsigned long *current_stack_pointer __asm__ ("$30");
+
#endif /* __ASSEMBLY__ */
/* Thread information allocation. */
diff --git a/arch/alpha/lib/stacktrace.c b/arch/alpha/lib/stacktrace.c
index 62454a7810e2..2b1176dd5174 100644
--- a/arch/alpha/lib/stacktrace.c
+++ b/arch/alpha/lib/stacktrace.c
@@ -92,7 +92,7 @@ stacktrace(void)
{
instr * ret_pc;
instr * prologue = (instr *)stacktrace;
- register unsigned char * sp __asm__ ("$30");
+ unsigned char *sp = (unsigned char *)current_stack_pointer;
printk("\tstack trace:\n");
do {
--
2.30.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] alpha: Implement "current_stack_pointer"
2022-02-24 6:05 [PATCH] alpha: Implement "current_stack_pointer" Kees Cook
@ 2023-02-26 2:08 ` Matt Turner
2023-02-26 10:24 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Matt Turner @ 2023-02-26 2:08 UTC (permalink / raw)
To: Kees Cook
Cc: Richard Henderson, Ivan Kokshaysky, Geert Uytterhoeven,
Andrew Morton, Mike Rapoport, Mark Rutland,
Peter Zijlstra (Intel),
Kefeng Wang, Alexander A. Klimov, linux-alpha, Arnd Bergmann,
linux-kernel, linux-hardening
On Thu, Feb 24, 2022 at 1:06 AM Kees Cook <keescook@chromium.org> wrote:
>
> 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).
>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
> Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
> Cc: "Alexander A. Klimov" <grandmaster@al2klimov.de>
> Cc: linux-alpha@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> 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(-)
>
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index 4e87783c90ad..31f3dbcdc28c 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -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
> diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
> index 2592356e3215..28214db31053 100644
> --- a/arch/alpha/include/asm/thread_info.h
> +++ b/arch/alpha/include/asm/thread_info.h
> @@ -43,6 +43,8 @@ struct thread_info {
> register struct thread_info *__current_thread_info __asm__("$8");
> #define current_thread_info() __current_thread_info
>
> +register unsigned long *current_stack_pointer __asm__ ("$30");
> +
> #endif /* __ASSEMBLY__ */
>
> /* Thread information allocation. */
> diff --git a/arch/alpha/lib/stacktrace.c b/arch/alpha/lib/stacktrace.c
> index 62454a7810e2..2b1176dd5174 100644
> --- a/arch/alpha/lib/stacktrace.c
> +++ b/arch/alpha/lib/stacktrace.c
> @@ -92,7 +92,7 @@ stacktrace(void)
> {
> instr * ret_pc;
> instr * prologue = (instr *)stacktrace;
> - register unsigned char * sp __asm__ ("$30");
> + unsigned char *sp = (unsigned char *)current_stack_pointer;
>
> printk("\tstack trace:\n");
> do {
> --
> 2.30.2
>
Thanks for the patch! This was included in my pull request today and
is now upstream in Linus' tree.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] alpha: Implement "current_stack_pointer"
2023-02-26 2:08 ` Matt Turner
@ 2023-02-26 10:24 ` Arnd Bergmann
2023-02-26 10:46 ` Stephen Rothwell
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2023-02-26 10:24 UTC (permalink / raw)
To: Matt Turner; +Cc: linux-alpha, linux-kernel, Stephen Rothwell
On Sun, Feb 26, 2023, at 03:08, Matt Turner wrote:
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] alpha: Implement "current_stack_pointer"
2023-02-26 10:24 ` Arnd Bergmann
@ 2023-02-26 10:46 ` Stephen Rothwell
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2023-02-26 10:46 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Matt Turner, linux-alpha, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
Hi Arnd,
On Sun, 26 Feb 2023 11:24:13 +0100 "Arnd Bergmann" <arnd@arndb.de> wrote:
>
> On Sun, Feb 26, 2023, at 03:08, Matt Turner wrote:
> >
> > 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?
There has never been an alpha branch in linux-next.
I would welcome one, however ;-)
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-26 10:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 6:05 [PATCH] alpha: Implement "current_stack_pointer" Kees Cook
2023-02-26 2:08 ` Matt Turner
2023-02-26 10:24 ` Arnd Bergmann
2023-02-26 10:46 ` Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®