linux-mainline/scripts
Ada Couprie Diaz 51337a9a3a kasan: fix GCC mem-intrinsic prefix with sw tags
GCC doesn't support "hwasan-kernel-mem-intrinsic-prefix", only
"asan-kernel-mem-intrinsic-prefix"[0], while LLVM supports both.  This is
already taken into account when checking
"CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX", but not in the KASAN Makefile
adding those parameters when "CONFIG_KASAN_SW_TAGS" is enabled.

Replace the version check with "CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX",
which already validates that mem-intrinsic prefix parameter can be used,
and choose the correct name depending on compiler.

GCC 13 and above trigger "CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX" which
prevents `mem{cpy,move,set}()` being redefined in "mm/kasan/shadow.c"
since commit 36be5cba99 ("kasan: treat meminstrinsic as builtins in
uninstrumented files"), as we expect the compiler to prefix those calls
with `__(hw)asan_` instead.  But as the option passed to GCC has been
incorrect, the compiler has not been emitting those prefixes, effectively
never calling the instrumented versions of `mem{cpy,move,set}()` with
"CONFIG_KASAN_SW_TAGS" enabled.

If "CONFIG_FORTIFY_SOURCES" is enabled, this issue would be mitigated as
it redefines `mem{cpy,move,set}()` and properly aliases the
`__underlying_mem*()` that will be called to the instrumented versions.

Link: https://lkml.kernel.org/r/20250821120735.156244-1-ada.coupriediaz@arm.com
Link: https://gcc.gnu.org/onlinedocs/gcc-13.4.0/gcc/Optimize-Options.html [0]
Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Fixes: 36be5cba99 ("kasan: treat meminstrinsic as builtins in uninstrumented files")
Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Marc Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-08-27 22:45:43 -07:00
..
atomic
bash-completion
basic
clang-tools
coccinelle
crypto
dtc
dummy-tools
gcc-plugins
gdb Significant patch series in this pull request: 2025-08-03 16:23:09 -07:00
gendwarfksyms gendwarfksyms: order -T symtypes output by name 2025-07-26 15:31:30 +09:00
genksyms
include
ipe
kconfig kconfig: lxdialog: replace strcpy() with strncpy() in inputbox.c 2025-08-06 10:23:36 +09:00
ksymoops
lib It has been a relatively busy cycle for docs, especially the build system: 2025-07-31 08:36:51 -07:00
mod
package
selinux
tracing
.gitignore
as-version.sh
asn1_compiler.c
bloat-o-meter
bootgraph.pl
bpf_doc.py
build-version
cc-can-link.sh
cc-version.sh
check_extable.sh
check-git
check-sysctl-docs docs: Replace spaces with tabs in check-sysctl-docs 2025-07-23 11:57:05 +02:00
check-uapi.sh
check-variable-fonts.sh
checkdeclares.pl
checkincludes.pl
checkkconfigsymbols.py
checkpatch.pl Significant patch series in this pull request: 2025-08-03 16:23:09 -07:00
checkstack.pl
checksyscalls.sh
checktransupdate.py scripts: add origin commit identification based on specific patterns 2025-07-24 08:41:15 -06:00
checkversion.pl
cleanfile
cleanpatch
coccicheck
config
const_structs.checkpatch
decode_stacktrace.sh
decodecode
depmod.sh
dev-needs.sh
diffconfig
documentation-file-ref-check
extract_xc3028.pl
extract-fwblobs
extract-ikconfig
extract-module-sig.pl
extract-sys-certs.pl
extract-vmlinux scripts: add zboot support to extract-vmlinux 2025-07-26 15:31:30 +09:00
faddr2line
file-size.sh
find-unused-docs.sh
gen_packed_field_checks.c
gen-crc-consts.py
gen-randstruct-seed.sh
generate_builtin_ranges.awk
generate_initcall_order.pl
generate_rust_analyzer.py
generate_rust_target.rs
get_abi.py
get_dvb_firmware
get_feat.pl
get_maintainer.pl
gfp-translate
git-resolve.sh
git.orderFile
head-object-list.txt
headerdep.pl
headers_install.sh
insert-sys-cert.c
install.sh
integer-wrap-ignore.scl
jobserver-exec
kallsyms.c
Kbuild.include
Kconfig.include
kernel-doc
kernel-doc.pl
kernel-doc.py
ld-version.sh
leaking_addresses.pl
Lindent
link-vmlinux.sh
macro_checker.py
make_fit.py
Makefile
Makefile.asm-headers
Makefile.autofdo
Makefile.btf
Makefile.build Rust changes for v6.17 2025-08-03 13:49:10 -07:00
Makefile.clang
Makefile.clean
Makefile.compiler
Makefile.debug
Makefile.defconf
Makefile.dtbinst
Makefile.dtbs
Makefile.extrawarn
Makefile.gcc-plugins
Makefile.headersinst
Makefile.host
Makefile.kasan kasan: fix GCC mem-intrinsic prefix with sw tags 2025-08-27 22:45:43 -07:00
Makefile.kcov
Makefile.kcsan
Makefile.kmsan
Makefile.kstack_erase kstack_erase: Fix missed export of renamed KSTACK_ERASE_CFLAGS 2025-07-29 17:17:46 -07:00
Makefile.lib
Makefile.modfinal
Makefile.modinst
Makefile.modpost
Makefile.package
Makefile.propeller
Makefile.randstruct
Makefile.ubsan
Makefile.userprogs
Makefile.vdsoinst
Makefile.vmlinux
Makefile.vmlinux_o
makelst
markup_oops.pl
min-tool-version.sh
misc-check
mkcompile_h
mksysmap
mkuboot.sh
module-common.c
module.lds.S
modules-check.sh
nsdeps
objdiff
objdump-func
orc_hash.sh
pahole-version.sh
parse-maintainers.pl
patch-kernel
profile2linkerlist.pl
prune-kernel
recordmcount.c
recordmcount.h
recordmcount.pl
relocs_check.sh
remove-stale-files
rust_is_available_bindgen_0_66.h
rust_is_available_bindgen_libclang_concat.h
rust_is_available_bindgen_libclang.h
rust_is_available_test.py
rust_is_available.sh
rustc-llvm-version.sh
rustc-version.sh
rustdoc_test_builder.rs
rustdoc_test_gen.rs
setlocalversion
show_delta
sign-file.c
sorttable.c
spdxcheck-test.sh
spdxcheck.py
spdxexclude
spelling.txt scripts/spelling.txt: add notifer||notifier to spelling.txt 2025-08-02 12:01:40 -07:00
sphinx-pre-install
split-man.pl
ssl-common.h
stackdelta
stackusage
subarch.include
syscall.tbl
syscallhdr.sh
syscallnr.sh
syscalltbl.sh
tags.sh
test_doc_build.py
tools-support-relr.sh
unifdef.c
ver_linux
verify_builtin_ranges.awk
xen-hypercalls.sh
xz_wrap.sh