diff --git a/ci/diffs/20260502-tools-headers-Regenerate-stddef.h-to-fix-BPF-selftes.patch b/ci/diffs/20260502-tools-headers-Regenerate-stddef.h-to-fix-BPF-selftes.patch new file mode 100644 index 00000000..f5ec7d31 --- /dev/null +++ b/ci/diffs/20260502-tools-headers-Regenerate-stddef.h-to-fix-BPF-selftes.patch @@ -0,0 +1,81 @@ +From 7b9f2a8d1761159b2ed87e2d0a162660555727a7 Mon Sep 17 00:00:00 2001 +From: Paul Chaignon +Date: Sat, 2 May 2026 12:12:40 +0200 +Subject: [PATCH] tools/headers: Regenerate stddef.h to fix BPF selftests +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With commit dacbfc167808 ("crypto: af_alg - Annotate struct af_alg_iv +with __counted_by"), two selftests, test_tag and crypto_sanity, now +indirectly rely on the __counted_by macro. On systems with commit +dacbfc167808 in the installed UAPI headers, the selftests build fails +with: + + In file included from tools/testing/selftests/bpf/prog_tests/crypto_sanity.c:7: + /usr/include/linux/if_alg.h:45:22: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘__counted_by’ + 45 | __u8 iv[] __counted_by(ivlen); + | ^~~~~~~~~~~~ + +This patch fixes it by regenerating stddef.h in tools/include using the +instructions from commit a778f5d46b62 ("tools/headers: Pull in stddef.h +to uapi to fix BPF selftests build in CI"). + +Fixes: dacbfc167808 ("crypto: af_alg - Annotate struct af_alg_iv with __counted_by") +Signed-off-by: Paul Chaignon +Reviewed-by: Alan Maguire +--- + tools/include/uapi/linux/stddef.h | 26 +++++++++++++++++++++++++- + 1 file changed, 25 insertions(+), 1 deletion(-) + +diff --git a/tools/include/uapi/linux/stddef.h b/tools/include/uapi/linux/stddef.h +index c53cde425406..457498259494 100644 +--- a/tools/include/uapi/linux/stddef.h ++++ b/tools/include/uapi/linux/stddef.h +@@ -3,7 +3,6 @@ + #define _LINUX_STDDEF_H + + +- + #ifndef __always_inline + #define __always_inline __inline__ + #endif +@@ -36,6 +35,11 @@ + struct __struct_group_tag(TAG) { MEMBERS } ATTRS NAME; \ + } ATTRS + ++#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 + * +@@ -52,3 +56,23 @@ + TYPE NAME[]; \ + } + #endif ++ ++#ifndef __counted_by ++#define __counted_by(m) ++#endif ++ ++#ifndef __counted_by_le ++#define __counted_by_le(m) ++#endif ++ ++#ifndef __counted_by_be ++#define __counted_by_be(m) ++#endif ++ ++#ifndef __counted_by_ptr ++#define __counted_by_ptr(m) ++#endif ++ ++#define __kernel_nonstring ++ ++#endif /* _LINUX_STDDEF_H */ +-- +2.54.0 +