arm64: disable -fsanitize=shadow-call-stack for big-endian
PATCH 1/1 arm64: disable -fsanitize=shadow-call-stack for big-endian
clang-11 and earlier do not support -fsanitize=shadow-call-stack in combination with -mbig-endian, but the Kconfig check does not pass the endianess flag, so building a big-endian kernel with this fails at build time:
clang: error: unsupported option '-fsanitize=shadow-call-stack' for target 'aarch64_be-unknown-linux'
Change the Kconfig check to let Kconfig figure this out earlier and prevent the broken configuration. I assume this is a bug in clang that needs to be fixed, but we also have to work around existing releases.
--- arch/arm64/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +3 -1
@@ -1031,7 +1031,9 @@ config ARCH_ENABLE_SPLIT_PMD_PTLOCK # Supported by clang >= 7.0 config CC_HAVE_SHADOW_CALL_STACK - def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18) + bool + default $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18 -mbig-endian) if CPU_BIG_ENDIAN + default $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18 -mlittle-endian) if !CPU_BIG_ENDIAN config SECCOMP bool "Enable seccomp to safely compute untrusted bytecode"
Signature · 7 lines
2.26.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Mark Rutland
reviewerQuoted 7 lines · Arnd Bergmann
clang-11 and earlier do not support -fsanitize=shadow-call-stack in combination with -mbig-endian, but the
Kconfigcheck does not pass the endianess flag, so building a big-endian kernel with this fails at build time:clang: error: unsupported option '-fsanitize=shadow-call-stack' for target 'aarch64_be-unknown-linux'
Quoted 8 lines
Change the
Kconfigcheck to letKconfigfigure this out earlier and prevent the broken configuration. I assume this is a bug in clang that needs to be fixed, but we also have to work around existing releases.Fixes 5287569a790d ("arm64: Implement Shadow Call Stack")Signed-off-by Arnd Bergmann <[email protected]>
I suspect this is similar to the patchable-function-entry issue, and this is an oversight that we'd rather fix toolchain side.
Nick, Fangrui, thoughts?
Mark.
Quoted 27 lines
--- arch/arm64/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/arm64/Kconfig +3
-1@@ -1031,7 +1031,9 @@ config ARCH_ENABLE_SPLIT_PMD_PTLOCK # Supported by clang >= 7.0 config CC_HAVE_SHADOW_CALL_STACK - def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18) + bool + default $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18 -mbig-endian) if CPU_BIG_ENDIAN + default $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18 -mlittle-endian) if !CPU_BIG_ENDIAN config SECCOMP bool "Enable seccomp to safely compute untrusted bytecode"Signature · 7 lines
2.26.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 14 lines · Mark Rutland
Quoted 12 lines · Arnd Bergmann
clang-11 and earlier do not support -fsanitize=shadow-call-stack in combination with -mbig-endian, but the
Kconfigcheck does not pass the endianess flag, so building a big-endian kernel with this fails at build time:clang: error: unsupported option '-fsanitize=shadow-call-stack' for target 'aarch64_be-unknown-linux'
Change the
Kconfigcheck to letKconfigfigure this out earlier and prevent the broken configuration. I assume this is a bug in clang that needs to be fixed, but we also have to work around existing releases.
Quoted 8 lines
Quoted 3 lines
Fixes 5287569a790d ("arm64: Implement Shadow Call Stack")Signed-off-by Arnd Bergmann <[email protected]>I suspect this is similar to the patchable-function-entry issue, and this is an oversight that we'd rather fix toolchain side.
Nick, Fangrui, thoughts?
Exactly, Fangrui already has a fix: https://reviews.llvm.org/D80647.
Thanks Fangrui!
It seems it's easy in the codebase to check the specific ABI, which isn't explicitly LE, rather than use a method that checks the ISA regardless of endianness.
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 20 lines · Nick Desaulniers' via Clang Built Linux
Quoted 18 lines · Mark Rutland
Quoted 15 lines · Arnd Bergmann
clang-11 and earlier do not support -fsanitize=shadow-call-stack in combination with -mbig-endian, but the
Kconfigcheck does not pass the endianess flag, so building a big-endian kernel with this fails at build time:clang: error: unsupported option '-fsanitize=shadow-call-stack' for target 'aarch64_be-unknown-linux'
Change the
Kconfigcheck to letKconfigfigure this out earlier and prevent the broken configuration. I assume this is a bug in clang that needs to be fixed, but we also have to work around existing releases.Fixes 5287569a790d ("arm64: Implement Shadow Call Stack")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 7 lines
Quoted 4 lines
I suspect this is similar to the patchable-function-entry issue, and this is an oversight that we'd rather fix toolchain side.
Nick, Fangrui, thoughts?
Exactly, Fangrui already has a fix: https://reviews.llvm.org/D80647.
Thanks Fangrui!
Ok, great! I had opened the bug first so I could reference it in the commit changelog, it seems the fix came fast than I managed to send out the kernel workaround.
Do we still want the kernel workaround anyway to make it work with older clang versions, or do we expect to fall back to not use the integrated assembler for the moment?
Arnd
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 34 lines · Arnd Bergmann
Quoted 20 lines · Nick Desaulniers' via Clang Built Linux
Quoted 18 lines · Mark Rutland
Quoted 15 lines · Arnd Bergmann
clang-11 and earlier do not support -fsanitize=shadow-call-stack in combination with -mbig-endian, but the
Kconfigcheck does not pass the endianess flag, so building a big-endian kernel with this fails at build time:clang: error: unsupported option '-fsanitize=shadow-call-stack' for target 'aarch64_be-unknown-linux'
Change the
Kconfigcheck to letKconfigfigure this out earlier and prevent the broken configuration. I assume this is a bug in clang that needs to be fixed, but we also have to work around existing releases.Fixes 5287569a790d ("arm64: Implement Shadow Call Stack")Signed-off-by Arnd Bergmann <[email protected]>Quoted 7 lines
Quoted 4 lines
I suspect this is similar to the patchable-function-entry issue, and this is an oversight that we'd rather fix toolchain side.
Nick, Fangrui, thoughts?
Exactly, Fangrui already has a fix: https://reviews.llvm.org/D80647.
Thanks Fangrui!Ok, great! I had opened the bug first so I could reference it in the commit changelog, it seems the fix came fast than I managed to send out the kernel workaround.
Quoted 5 lines
Do we still want the kernel workaround anyway to make it work with older clang versions, or do we expect to fall back to not use the integrated assembler for the moment?
Arnd
We can condition it on CLANG_VERSION >= 100001 (assuming Tom (CCed)
is happy (and there is still time) cherrying pick the two commits https://bugs.llvm.org/show_bug.cgi?id=46076 to clang 10.0.1)
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 35 lines · Fangrui Song' via Clang Built Linux
Quoted 34 lines · Arnd Bergmann
Quoted 20 lines · Nick Desaulniers' via Clang Built Linux
Quoted 18 lines · Mark Rutland
Quoted 15 lines · Arnd Bergmann
clang-11 and earlier do not support -fsanitize=shadow-call-stack in combination with -mbig-endian, but the
Kconfigcheck does not pass the endianess flag, so building a big-endian kernel with this fails at build time:clang: error: unsupported option '-fsanitize=shadow-call-stack' for target 'aarch64_be-unknown-linux'
Change the
Kconfigcheck to letKconfigfigure this out earlier and prevent the broken configuration. I assume this is a bug in clang that needs to be fixed, but we also have to work around existing releases.Fixes 5287569a790d ("arm64: Implement Shadow Call Stack")Signed-off-by Arnd Bergmann <[email protected]>Quoted 7 lines
Quoted 4 lines
I suspect this is similar to the patchable-function-entry issue, and this is an oversight that we'd rather fix toolchain side.
Nick, Fangrui, thoughts?
Exactly, Fangrui already has a fix: https://reviews.llvm.org/D80647.
Thanks Fangrui!Ok, great! I had opened the bug first so I could reference it in the commit changelog, it seems the fix came fast than I managed to send out the kernel workaround.
Quoted 6 lines
Quoted 3 lines
Do we still want the kernel workaround anyway to make it work with older clang versions, or do we expect to fall back to not use the integrated assembler for the moment?
We can condition it on
CLANG_VERSION >= 100001(assuming Tom (CCed)
is happy (and there is still time) cherrying pick the two commits https://bugs.llvm.org/show_bug.cgi?id=46076 to clang 10.0.1)
Good idea. I assume we will keep requiring fairly recent clang versions for a while now, so chances are that 10.1 or 11.0 becomes the minimum supported version not too far in the future and then the workaround can be dropped again.
Arnd