public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/toolchain/linux-headers-patches:master commit in: 6.5/
@ 2023-08-28 20:48 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2023-08-28 20:48 UTC (permalink / raw
  To: gentoo-commits

commit:     4a3794848d36818420b373e82efa6ee67e71e6ef
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 28 19:53:18 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 28 19:53:18 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/linux-headers-patches.git/commit/?id=4a379484

6.5: new patchset, clone of 6.4

* 6.5/00_all_0001-unifdef-drop-unused-errno.h-include.patch
* 6.5/00_all_0002-x86-do-not-build-relocs-tool-when-installing-headers.patch

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ..._0001-unifdef-drop-unused-errno.h-include.patch | 32 +++++++++++++++++++++
 ...build-relocs-tool-when-installing-headers.patch | 33 ++++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/6.5/00_all_0001-unifdef-drop-unused-errno.h-include.patch b/6.5/00_all_0001-unifdef-drop-unused-errno.h-include.patch
new file mode 100644
index 0000000..617eb9a
--- /dev/null
+++ b/6.5/00_all_0001-unifdef-drop-unused-errno.h-include.patch
@@ -0,0 +1,32 @@
+From c4d1a109c5c0b1bd27d2b5448a1306a2f6005339 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 6 Dec 2011 17:22:42 -0500
+Subject: [PATCH] unifdef: drop unused errno.h include
+
+This is the only header on my system that ends up requiring kernel
+headers, so if the kernel headers aren't available, we end up being
+unable to install kernel headers :).
+
+Since this file doesn't actually use anything from errno.h, drop
+the include so it at least makes us a bit more robust on glibc.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ scripts/unifdef.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/scripts/unifdef.c b/scripts/unifdef.c
+index 7493c0ee51cc..c5dfae538b08 100644
+--- a/scripts/unifdef.c
++++ b/scripts/unifdef.c
+@@ -48,7 +48,6 @@
+ 
+ #include <ctype.h>
+ #include <err.h>
+-#include <errno.h>
+ #include <stdarg.h>
+ #include <stdbool.h>
+ #include <stdio.h>
+-- 
+2.16.1
+

diff --git a/6.5/00_all_0002-x86-do-not-build-relocs-tool-when-installing-headers.patch b/6.5/00_all_0002-x86-do-not-build-relocs-tool-when-installing-headers.patch
new file mode 100644
index 0000000..c1c7214
--- /dev/null
+++ b/6.5/00_all_0002-x86-do-not-build-relocs-tool-when-installing-headers.patch
@@ -0,0 +1,33 @@
+From 57875de37c5375ea95e1e949ec7c741d0038d3a1 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 15 Nov 2014 03:37:38 -0500
+Subject: [PATCH] x86: do not build relocs tool when installing headers
+
+This isn't needed to install headers, so don't bother building it.
+Otherwise we run into a chicken/egg issue where we need the kernel
+headers in order to install the kernel headers.  It's also a waste
+of time.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ arch/x86/Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile
+index 60135cbd905c..9b15b2daa77f 100644
+--- a/arch/x86/Makefile
++++ b/arch/x86/Makefile
+@@ -215,8 +215,10 @@
+ endif
+ 
+ 
++ifneq ($(filter-out headers_install,$(MAKECMDGOALS)),)
+ archscripts: scripts_basic
+ 	$(Q)$(MAKE) $(build)=arch/x86/tools relocs
++endif
+ 
+ ###
+ # Syscall table generation
+-- 
+2.16.1
+


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/toolchain/linux-headers-patches:master commit in: 6.5/
@ 2023-10-06 19:41 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2023-10-06 19:41 UTC (permalink / raw
  To: gentoo-commits

commit:     ae36ddf9ac48b52efa7fb9010830ade6be73d659
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  6 19:41:12 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  6 19:41:30 2023 +0000
URL:        https://gitweb.gentoo.org/proj/toolchain/linux-headers-patches.git/commit/?id=ae36ddf9

6.5: add patches

* 6.5/00_all_0003-Compiler-Attributes-counted_by-Adjust-name-and-ident.patch:
  cc17adeef726a0df7fe5df7585a07128cd0c6070 ('Compiler Attributes: counted_by: Adjust name and identifier expansion')
* 6.5/00_all_0004-uapi-stddef.h-Fix-header-guard-location.patch:
  721045f22e1a79cb04bfd4463cdf445108287666 ('uapi: stddef.h: Fix header guard location')
* 6.5/00_all_0005-uapi-stddef.h-Fix-__DECLARE_FLEX_ARRAY-for-C.patch:
  144ed54ed6ec4c099ff7c2b0064ed3ff89b73737 ('uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++')

Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...tributes-counted_by-Adjust-name-and-ident.patch | 87 ++++++++++++++++++++++
 ...4-uapi-stddef.h-Fix-header-guard-location.patch | 41 ++++++++++
 ...i-stddef.h-Fix-__DECLARE_FLEX_ARRAY-for-C.patch | 77 +++++++++++++++++++
 3 files changed, 205 insertions(+)

diff --git a/6.5/00_all_0003-Compiler-Attributes-counted_by-Adjust-name-and-ident.patch b/6.5/00_all_0003-Compiler-Attributes-counted_by-Adjust-name-and-ident.patch
new file mode 100644
index 0000000..7365e3e
--- /dev/null
+++ b/6.5/00_all_0003-Compiler-Attributes-counted_by-Adjust-name-and-ident.patch
@@ -0,0 +1,87 @@
+From 564e31793787789b226a6f4b7081f2647a515b58 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Thu, 17 Aug 2023 13:06:03 -0700
+Subject: [PATCH 3/5] Compiler Attributes: counted_by: Adjust name and
+ identifier expansion
+
+[ Upstream commit c8248faf3ca276ebdf60f003b3e04bf764daba91 ]
+
+GCC and Clang's current RFCs name this attribute "counted_by", and have
+moved away from using a string for the member name. Update the kernel's
+macros to match. Additionally provide a UAPI no-op macro for UAPI structs
+that will gain annotations.
+
+Cc: Miguel Ojeda <ojeda@kernel.org>
+Cc: Nick Desaulniers <ndesaulniers@google.com>
+Fixes: dd06e72e68bc ("Compiler Attributes: Add __counted_by macro")
+Acked-by: Miguel Ojeda <ojeda@kernel.org>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Link: https://lore.kernel.org/r/20230817200558.never.077-kees@kernel.org
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Stable-dep-of: 32a4ec211d41 ("uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+(cherry picked from commit cc17adeef726a0df7fe5df7585a07128cd0c6070)
+---
+ include/linux/compiler_attributes.h | 26 +++++++++++++-------------
+ include/uapi/linux/stddef.h         |  4 ++++
+ 2 files changed, 17 insertions(+), 13 deletions(-)
+
+diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h
+index 00efa35c350f..28566624f008 100644
+--- a/include/linux/compiler_attributes.h
++++ b/include/linux/compiler_attributes.h
+@@ -94,6 +94,19 @@
+ # define __copy(symbol)
+ #endif
+ 
++/*
++ * Optional: only supported since gcc >= 14
++ * Optional: only supported since clang >= 18
++ *
++ *   gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896
++ * clang: https://reviews.llvm.org/D148381
++ */
++#if __has_attribute(__counted_by__)
++# define __counted_by(member)		__attribute__((__counted_by__(member)))
++#else
++# define __counted_by(member)
++#endif
++
+ /*
+  * Optional: not supported by gcc
+  * Optional: only supported since clang >= 14.0
+@@ -129,19 +142,6 @@
+ # define __designated_init
+ #endif
+ 
+-/*
+- * Optional: only supported since gcc >= 14
+- * Optional: only supported since clang >= 17
+- *
+- *   gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896
+- * clang: https://reviews.llvm.org/D148381
+- */
+-#if __has_attribute(__element_count__)
+-# define __counted_by(member)		__attribute__((__element_count__(#member)))
+-#else
+-# define __counted_by(member)
+-#endif
+-
+ /*
+  * Optional: only supported since clang >= 14.0
+  *
+diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
+index 7837ba4fe728..7c3fc3980881 100644
+--- a/include/uapi/linux/stddef.h
++++ b/include/uapi/linux/stddef.h
+@@ -45,3 +45,7 @@
+ 		TYPE NAME[]; \
+ 	}
+ #endif
++
++#ifndef __counted_by
++#define __counted_by(m)
++#endif
+-- 
+2.42.0
+

diff --git a/6.5/00_all_0004-uapi-stddef.h-Fix-header-guard-location.patch b/6.5/00_all_0004-uapi-stddef.h-Fix-header-guard-location.patch
new file mode 100644
index 0000000..74fed6e
--- /dev/null
+++ b/6.5/00_all_0004-uapi-stddef.h-Fix-header-guard-location.patch
@@ -0,0 +1,41 @@
+From 4741f029c3eebaaaae560864d5442319ad1d7a02 Mon Sep 17 00:00:00 2001
+From: Alexey Dobriyan <adobriyan@gmail.com>
+Date: Tue, 12 Sep 2023 19:23:21 +0300
+Subject: [PATCH 4/5] uapi: stddef.h: Fix header guard location
+
+[ Upstream commit 531108ec5b5cd45ec6272a6115e73275baef7d22 ]
+
+The #endif for the header guard wasn't at the end of the header. This
+was harmless since the define that escaped was already testing for its
+own redefinition. Regardless, move the #endif to the correct place.
+
+Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
+Fixes: c8248faf3ca2 ("Compiler Attributes: counted_by: Adjust name and identifier expansion")
+Link: https://lore.kernel.org/r/b1f5081e-339d-421d-81b2-cbb94e1f6f5f@p183
+Co-developed-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Stable-dep-of: 32a4ec211d41 ("uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+(cherry picked from commit 721045f22e1a79cb04bfd4463cdf445108287666)
+---
+ include/uapi/linux/stddef.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
+index 7c3fc3980881..c027b2070d79 100644
+--- a/include/uapi/linux/stddef.h
++++ b/include/uapi/linux/stddef.h
+@@ -44,8 +44,9 @@
+ 		struct { } __empty_ ## NAME; \
+ 		TYPE NAME[]; \
+ 	}
+-#endif
+ 
+ #ifndef __counted_by
+ #define __counted_by(m)
+ #endif
++
++#endif /* _UAPI_LINUX_STDDEF_H */
+-- 
+2.42.0
+

diff --git a/6.5/00_all_0005-uapi-stddef.h-Fix-__DECLARE_FLEX_ARRAY-for-C.patch b/6.5/00_all_0005-uapi-stddef.h-Fix-__DECLARE_FLEX_ARRAY-for-C.patch
new file mode 100644
index 0000000..934774e
--- /dev/null
+++ b/6.5/00_all_0005-uapi-stddef.h-Fix-__DECLARE_FLEX_ARRAY-for-C.patch
@@ -0,0 +1,77 @@
+From 8ba6fb2fa507aec278bce9fec42b38be2231588e Mon Sep 17 00:00:00 2001
+From: Alexey Dobriyan <adobriyan@gmail.com>
+Date: Tue, 12 Sep 2023 19:22:24 +0300
+Subject: [PATCH 5/5] uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++
+
+[ Upstream commit 32a4ec211d4164e667d9d0b807fadf02053cd2e9 ]
+
+__DECLARE_FLEX_ARRAY(T, member) macro expands to
+
+	struct {
+		struct {} __empty_member;
+		T member[];
+	};
+
+which is subtly wrong in C++ because sizeof(struct{}) is 1 not 0,
+changing UAPI structures layouts.
+
+This can be fixed by expanding to
+
+	T member[];
+
+Now g++ doesn't like "T member[]" either, throwing errors on
+the following code:
+
+	struct S {
+		union {
+			T1 member1[];
+			T2 member2[];
+		};
+	};
+
+or
+
+	struct S {
+		T member[];
+	};
+
+Use "T member[0];" which seems to work and does the right thing wrt
+structure layout.
+
+Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
+Fixes: 3080ea5553cc ("stddef: Introduce DECLARE_FLEX_ARRAY() helper")
+Link: https://lore.kernel.org/r/97242381-f1ec-4a4a-9472-1a464f575657@p183
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+(cherry picked from commit 144ed54ed6ec4c099ff7c2b0064ed3ff89b73737)
+---
+ include/uapi/linux/stddef.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
+index c027b2070d79..5c6c4269f7ef 100644
+--- a/include/uapi/linux/stddef.h
++++ b/include/uapi/linux/stddef.h
+@@ -29,6 +29,11 @@
+ 		struct TAG { MEMBERS } ATTRS NAME; \
+ 	}
+ 
++#ifdef __cplusplus
++/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
++#define __DECLARE_FLEX_ARRAY(T, member)	\
++	T member[0]
++#else
+ /**
+  * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
+  *
+@@ -44,6 +49,7 @@
+ 		struct { } __empty_ ## NAME; \
+ 		TYPE NAME[]; \
+ 	}
++#endif
+ 
+ #ifndef __counted_by
+ #define __counted_by(m)
+-- 
+2.42.0
+


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-06 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-06 19:41 [gentoo-commits] proj/toolchain/linux-headers-patches:master commit in: 6.5/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2023-08-28 20:48 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox