lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEdQ38Fg=Au5=BbyTHiEO+GaivheCe6hPBjcZhjgALxn4503Mg@mail.gmail.com>
Date:   Sat, 25 Feb 2023 21:08:37 -0500
From:   Matt Turner <mattst88@...il.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Richard Henderson <rth@...ddle.net>,
        Ivan Kokshaysky <ink@...assic.park.msu.ru>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mike Rapoport <rppt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        "Alexander A. Klimov" <grandmaster@...klimov.de>,
        linux-alpha@...r.kernel.org, Arnd Bergmann <arnd@...db.de>,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] alpha: Implement "current_stack_pointer"

On Thu, Feb 24, 2022 at 1:06 AM Kees Cook <keescook@...omium.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@...ddle.net>
> Cc: Ivan Kokshaysky <ink@...assic.park.msu.ru>
> Cc: Matt Turner <mattst88@...il.com>
> Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Mike Rapoport <rppt@...nel.org>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>
> Cc: Kefeng Wang <wangkefeng.wang@...wei.com>
> Cc: "Alexander A. Klimov" <grandmaster@...klimov.de>
> Cc: linux-alpha@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ