[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202203091406.E94510FD@keescook>
Date: Wed, 9 Mar 2022 14:06:35 -0800
From: Kees Cook <keescook@...omium.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Marc Zyngier <maz@...nel.org>,
Guenter Roeck <linux@...ck-us.net>,
Yanteng Si <siyanteng01@...il.com>, linux-mips@...r.kernel.org,
Nick Desaulniers <ndesaulniers@...gle.com>,
Mark Rutland <mark.rutland@....com>,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] MIPS: Only use current_stack_pointer on GCC
On Wed, Mar 09, 2022 at 01:51:13PM -0700, Nathan Chancellor wrote:
> Nit: I think the subject needs to be updated (I assume this was written
> before Nick's fix?).
>
> On Wed, Mar 09, 2022 at 12:45:37PM -0800, Kees Cook wrote:
> > Unfortunately, Clang did not have support for "sp" as a global register
> > definition, and was crashing after the addition of current_stack_pointer.
> > This has been fixed in Clang 15, but earlier Clang versions need to
> > avoid this code, so add a versioned test and revert back to the
> > open-coded asm instances. Fixes Clang build error:
> >
> > fatal error: error in backend: Invalid register name global variable
> >
> > Fixes: 200ed341b864 ("mips: Implement "current_stack_pointer"")
> > Reported-by: Nathan Chancellor <nathan@...nel.org>
> > Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
> > Cc: Marc Zyngier <maz@...nel.org>
> > Cc: Guenter Roeck <linux@...ck-us.net>
> > Cc: Yanteng Si <siyanteng01@...il.com>
> > Cc: linux-mips@...r.kernel.org
> > Signed-off-by: Kees Cook <keescook@...omium.org>
>
> Thanks for sending this!
>
> Reviewed-by: Nathan Chancellor <nathan@...nel.org>
>
> > ---
> > arch/mips/Kconfig | 2 +-
> > arch/mips/include/asm/thread_info.h | 2 ++
> > arch/mips/kernel/irq.c | 3 ++-
> > arch/mips/lib/uncached.c | 4 +++-
> > 4 files changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index 3f58b45fc953..15769013f46e 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -4,7 +4,7 @@ config MIPS
> > default y
> > select ARCH_32BIT_OFF_T if !64BIT
> > select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
> > - select ARCH_HAS_CURRENT_STACK_POINTER
> > + select ARCH_HAS_CURRENT_STACK_POINTER if !CC_IS_CLANG || CLANG_VERSION >= 150000
>
> Nit: This can be 140000, as release/14.x has received the fix:
>
> https://github.com/llvm/llvm-project/commit/0826716786cd4a8c7cbcb8c01e4d9fac46b7a17a
Oh! Excellent. Thanks; I missed that it made the branch. I'll send a v2.
--
Kees Cook
Powered by blists - more mailing lists