Re: [PATCH] m68k: Implement "current_stack_pointer"

From: Geert Uytterhoeven
Date: Thu Feb 24 2022 - 03:59:43 EST


Hi Kees,

On Thu, Feb 24, 2022 at 7:04 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> To follow the existing per-arch conventions, add asm "sp" as
> "current_stack_pointer". This will let it be used in non-arch places
> (like HARDENED_USERCOPY).
>
> Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Cc: linux-m68k@xxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks for your patch!

> --- a/arch/m68k/include/asm/current.h
> +++ b/arch/m68k/include/asm/current.h
> @@ -24,6 +24,8 @@ static inline struct task_struct *get_current(void)
>
> #define current get_current()
>
> +register unsigned long current_stack_pointer __asm__("sp");

I don't know what HARDENED_USERCOPY does, so I don't know if you need
"usp" (see rdusp()) or "sp"?

> +
> #endif /* CONFNIG_MMU */
>
> #endif /* !(_M68K_CURRENT_H) */

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds