Thread (29 messages) 29 messages, 7 authors, 2021-03-25

Re: [PATCH v5] ARM: Implement SLS mitigation

From: Jian Cai <hidden>
Date: 2021-03-23 22:41:03
Also in: linux-arm-kernel, lkml

Thanks for the suggestion. I've sent an inquiry to the author of
-mharden-sls* in GCC and hopefully that would shed some more light. We
do get warnings for oraphon sections when using lld. The other linkers
do not seem to provide such warnings, although the boot failure also
does not seem to happen with them.

On Mon, Mar 22, 2021 at 4:45 AM Linus Walleij [off-list ref] wrote:
On Wed, Mar 10, 2021 at 5:43 AM Jian Cai [off-list ref] wrote:
quoted
On Sat, Mar 6, 2021 at 4:25 AM Linus Walleij [off-list ref] wrote:
quoted
On Fri, Mar 5, 2021 at 12:23 AM Jian Cai [off-list ref] wrote:
quoted
On Wed, Mar 3, 2021 at 7:04 AM Linus Walleij [off-list ref] wrote:
quoted
quoted
quoted
I think gcc also has these options.
https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
And how does that work with this part of your patch:

+#define SLS_TEXT                                       \
+       ALIGN_FUNCTION();                              \
+       *(.text.__llvm_slsblr_thunk_*)

This does not look compiler agnostic?
You are right, GCC does generate different oraphan section names. I
will address it in the next version of the patch. Also it seems only
arm64 gcc supports -mharden-sls=* at this moment, arm32 gcc does not
support it yet. I don't know if there is any plan to implement it for
32-bit gcc, but should we patch arm32 linker script preemptively,
assuming the sections will be named with the same pattern like how
clang does so the kernel would not fail to boot when the flag is
implemented?
I think the best thing is to have something like this:
Implement a macro such as this in
include/linux/compiler-clang.h

#define SLS_TEXT_SECTION *(.text.__llvm_slsblr_thunk_*)

then the corresponding in include/linux/compiler-gcc.h
but here also add a

#define SLS_TEXT_SECTION #error "no compiler support"

if the compiler version does not have this.

I don't know the exact best approach sadly, as the patch
looks now it seems a bit fragile, I wonder if you get linker
warnings when this section is unused?

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help