linux/scripts/gcc-plugins
Kees Cook b9f13e51ad randstruct: report bad casts as warnings rather than notes
find_bad_casts() reports a cast between two randomized structure pointer
types with inform(), which renders as a "note:". It has done so since
the plugin was originally added, while using error() freely for attribute
misuse, UAPI structs, and version mismatches.

Clang's implementation of the same check has always been stricter:
it rejects such a cast as a full error. There is no reason for the GCC
side to be effectively silent about the same problem.

Build tested ARCH=x86_64 with CONFIG_RANDSTRUCT_FULL=y and GCC 14.2.0:
allmodconfig clean, and defconfig clean under three different random
seeds. A deliberate bad cast is still reported, now as a warning, at the
correct line and column.

Link: https://patch.msgid.link/20260903232438.60394-2-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
2026-09-21 21:26:11 -07:00
..
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
gcc-common.h gcc-plugins: Always define CONST_CAST_GIMPLE and CONST_CAST_TREE 2026-05-14 09:24:32 -07:00
gcc-generate-gimple-pass.h gcc-plugins: remove support for GCC 4.9 and older 2021-10-04 10:58:08 -07:00
gcc-generate-ipa-pass.h gcc-plugins: remove support for GCC 4.9 and older 2021-10-04 10:58:08 -07:00
gcc-generate-rtl-pass.h gcc-plugins: remove support for GCC 4.9 and older 2021-10-04 10:58:08 -07:00
gcc-generate-simple_ipa-pass.h gcc-plugins: remove support for GCC 4.9 and older 2021-10-04 10:58:08 -07:00
Kconfig require gcc-8 and binutils-2.30 2025-05-31 08:16:52 -07:00
latent_entropy_plugin.c gcc-plugins: latent_entropy: Fix typo (args -> argc) in plugin description 2023-11-14 09:32:47 -08:00
Makefile gcc-plugins: Force full rebuild when plugins change 2025-05-08 09:42:06 -07:00
randomize_layout_plugin.c randstruct: report bad casts as warnings rather than notes 2026-09-21 21:26:11 -07:00
stackleak_plugin.c stackleak: Rename stackleak_track_stack to __sanitizer_cov_stack_depth 2025-07-21 21:40:39 -07:00