Skip to content

Commit c90841d

Browse files
committed
Merge tag 'hardening-v6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening fixes from Kees Cook: "This is a work-around for a (now fixed) corner case in the arm32 build with Clang KCFI enabled. - Introduce __nocfi_generic for arm32 Clang (Nathan Chancellor)" * tag 'hardening-v6.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: libeth: xdp: Disable generic kCFI pass for libeth_xdp_tx_xmit_bulk() ARM: Select ARCH_USES_CFI_GENERIC_LLVM_PASS compiler_types: Introduce __nocfi_generic
2 parents c2c2ccf + c57f5fe commit c90841d

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

arch/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,13 @@ config ARCH_USES_CFI_TRAPS
917917
An architecture should select this option if it requires the
918918
.kcfi_traps section for KCFI trap handling.
919919

920+
config ARCH_USES_CFI_GENERIC_LLVM_PASS
921+
bool
922+
help
923+
An architecture should select this option if it uses the generic
924+
KCFIPass in LLVM to expand kCFI bundles instead of architecture-specific
925+
lowering.
926+
920927
config CFI
921928
bool "Use Kernel Control Flow Integrity (kCFI)"
922929
default CFI_CLANG

arch/arm/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ config ARM
4444
select ARCH_USE_BUILTIN_BSWAP
4545
select ARCH_USE_CMPXCHG_LOCKREF
4646
select ARCH_USE_MEMTEST
47+
# https://github.com/llvm/llvm-project/commit/d130f402642fba3d065aacb506cb061c899558de
48+
select ARCH_USES_CFI_GENERIC_LLVM_PASS if CLANG_VERSION < 220000
4749
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
4850
select ARCH_WANT_GENERAL_HUGETLB
4951
select ARCH_WANT_IPC_PARSE_VERSION

include/linux/compiler_types.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ struct ftrace_likely_data {
461461
# define __nocfi
462462
#endif
463463

464+
#if defined(CONFIG_ARCH_USES_CFI_GENERIC_LLVM_PASS)
465+
# define __nocfi_generic __nocfi
466+
#else
467+
# define __nocfi_generic
468+
#endif
469+
464470
/*
465471
* Any place that could be marked with the "alloc_size" attribute is also
466472
* a place to be marked with the "malloc" attribute, except those that may

include/net/libeth/xdp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ struct libeth_xdp_tx_desc {
513513
* can't fail, but can send less frames if there's no enough free descriptors
514514
* available. The actual free space is returned by @prep from the driver.
515515
*/
516-
static __always_inline u32
516+
static __always_inline __nocfi_generic u32
517517
libeth_xdp_tx_xmit_bulk(const struct libeth_xdp_tx_frame *bulk, void *xdpsq,
518518
u32 n, bool unroll, u64 priv,
519519
u32 (*prep)(void *xdpsq, struct libeth_xdpsq *sq),

0 commit comments

Comments
 (0)