Commit d2a43e7f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull hardening fixes from Kees Cook:

 - fix required Clang version for CC_HAS_COUNTED_BY_PTR (Nathan
   Chancellor)

 - update Coccinelle script used for kmalloc_obj

* tag 'hardening-v7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  init/Kconfig: Require a release version of clang-22 for CC_HAS_COUNTED_BY_PTR
  coccinelle: kmalloc_obj: Remove default GFP_KERNEL arg
parents 51088b9d 7a618ca9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ config CC_HAS_COUNTED_BY
config CC_HAS_COUNTED_BY_PTR
	bool
	# supported since clang 22
	default y if CC_IS_CLANG && CLANG_VERSION >= 220000
	default y if CC_IS_CLANG && CLANG_VERSION >= 220100
	# supported since gcc 16.0.0
	default y if CC_IS_GCC && GCC_VERSION >= 160000

+11 −0
Original line number Diff line number Diff line
@@ -122,3 +122,14 @@ fresh identifier ALLOC_OBJS = script:python(ALLOC_ARRAY) { alloc_array(ALLOC_ARR
-	ALLOC(struct_size_t(TYPE, FLEX, COUNT), GFP)
+	ALLOC_FLEX(TYPE, FLEX, COUNT, GFP)
)

@drop_gfp_kernel depends on patch && !(file in "tools") && !(file in "samples")@
identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex,
		    kzalloc_obj,kzalloc_objs,kzalloc_flex,
		    kvmalloc_obj,kvmalloc_objs,kvmalloc_flex,
		    kvzalloc_obj,kvzalloc_objs,kvzalloc_flex};
@@

	ALLOC(...
-		 , GFP_KERNEL
	     )