From: Greg Kroah-Hartman Date: Wed, 17 Jul 2024 06:22:11 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v4.19.318~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1bf3d28b318d050e256441f6a337ce36b2c32404;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: compiler-attributes-add-__uninitialized-macro.patch --- diff --git a/queue-6.1/compiler-attributes-add-__uninitialized-macro.patch b/queue-6.1/compiler-attributes-add-__uninitialized-macro.patch new file mode 100644 index 00000000000..279fd1ed337 --- /dev/null +++ b/queue-6.1/compiler-attributes-add-__uninitialized-macro.patch @@ -0,0 +1,50 @@ +From fd7eea27a3aed79b63b1726c00bde0d50cf207e2 Mon Sep 17 00:00:00 2001 +From: Heiko Carstens +Date: Mon, 5 Feb 2024 16:48:43 +0100 +Subject: Compiler Attributes: Add __uninitialized macro + +From: Heiko Carstens + +commit fd7eea27a3aed79b63b1726c00bde0d50cf207e2 upstream. + +With INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO enabled the kernel will +be compiled with -ftrivial-auto-var-init=<...> which causes initialization +of stack variables at function entry time. + +In order to avoid the performance impact that comes with this users can use +the "uninitialized" attribute to prevent such initialization. + +Therefore provide the __uninitialized macro which can be used for cases +where INIT_STACK_ALL_PATTERN or INIT_STACK_ALL_ZERO is enabled, but only +selected variables should not be initialized. + +Acked-by: Kees Cook +Reviewed-by: Nathan Chancellor +Link: https://lore.kernel.org/r/20240205154844.3757121-2-hca@linux.ibm.com +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/compiler_attributes.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/include/linux/compiler_attributes.h ++++ b/include/linux/compiler_attributes.h +@@ -322,6 +322,18 @@ + #define __section(section) __attribute__((__section__(section))) + + /* ++ * Optional: only supported since gcc >= 12 ++ * ++ * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-uninitialized-variable-attribute ++ * clang: https://clang.llvm.org/docs/AttributeReference.html#uninitialized ++ */ ++#if __has_attribute(__uninitialized__) ++# define __uninitialized __attribute__((__uninitialized__)) ++#else ++# define __uninitialized ++#endif ++ ++/* + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-unused-type-attribute + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-unused-variable-attribute diff --git a/queue-6.1/series b/queue-6.1/series index a0b4042fcb3..8af1e17845d 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -1,3 +1,4 @@ +compiler-attributes-add-__uninitialized-macro.patch mm-prevent-derefencing-null-ptr-in-pfn_section_valid.patch cachefiles-propagate-errors-from-vfs_getxattr-to-avo.patch cachefiles-narrow-the-scope-of-triggering-epollin-ev.patch