[PATCH] arm64: scs: Work around full LTO issue with dynamic SCS

Ard Biesheuvel ardb at kernel.org
Wed Jan 10 12:21:46 PST 2024


(cc Nathan)

On Wed, 10 Jan 2024 at 20:58, Sami Tolvanen <samitolvanen at google.com> wrote:
>
> Hi Ard,
>
> On Wed, Jan 10, 2024 at 5:26 AM Ard Biesheuvel <ardb+git at google.com> wrote:
> >
> > From: Ard Biesheuvel <ardb at kernel.org>
> >
> > Full LTO takes the '-mbranch-protection=none' passed to the compiler
> > when generating the dynamic shadow call stack patching code as a hint to
> > stop emitting PAC instructions altogether. (Thin LTO appears unaffected
> > by this)
>
> Does this affect all Clang versions? Is there a compiler bug filed for
> this issue?
>

No, not yet.

I suppose reporting this as-is with LLVM is not going to be practical,
but I'm not sure how to isolate a reproducer. Note that there are
other compilation units (under arch/arm64/kernel/pi) that are also
built with -mbranch-protection=none, but those don't appear to trigger
this issue in the same way.


> > Work around this by stripping unwind tables from the object in question,
> > which should be sufficient to prevent the patching code from attempting
> > to patch itself.
> >
> > Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
>
> Please add a Fixes tag to ensure this gets backported. Otherwise,
> looks like a reasonable workaround to me.
>

Ok


> Reviewed-by: Sami Tolvanen <samitolvanen at google.com>
>

Thanks

> Sami



More information about the linux-arm-kernel mailing list