From ead7cdcd98fbcd531bcbfeace4773f63cf4f9342 Mon Sep 17 00:00:00 2001 From: fossdd Date: Tue, 29 Jul 2025 12:01:58 +0200 Subject: [PATCH] community/linux-tools: patch gcc15 --- community/linux-tools/APKBUILD | 2 ++ community/linux-tools/gcc15.patch | 59 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 community/linux-tools/gcc15.patch diff --git a/community/linux-tools/APKBUILD b/community/linux-tools/APKBUILD index ba00416e69f..2d4d978dbd4 100644 --- a/community/linux-tools/APKBUILD +++ b/community/linux-tools/APKBUILD @@ -72,6 +72,7 @@ source="https://kernel.org/pub/linux/kernel/v6.x/linux-$_kernver.tar.xz cpupower.confd usbip.initd usbip.confd + gcc15.patch " # append patch for non .0 case $pkgver in @@ -293,4 +294,5 @@ ea04b71c828df423e55ce22058015fe3cf13f58a1adbddefa61a8df26b343d22596d16737c592ead 63cd12a4d8782198c71662e9205e346e064b65bae5e3e175b5bc43bdf7ec6ddf675b60349750afe3c37c8a925f9ae9a93530671821342581bd282a69e0773b8c cpupower.confd fcbd64d844c9bc187d08cef5995e91a46c0df78deb24e96ac9210c0e2c730eca0301970d9b8ffbf003df274682d05072431a26b59d8c491f396618268a12ec92 usbip.initd eb8de617e27c4d5fdfee9c442e8f74b0afb4d0fe7b59eca3a19629eb70fea7e09b3c125bc968aa8810d845ce661c829bd0f3fdb2288664f2cccf423bc0ae6ae8 usbip.confd +26c3f5fcf48cae17a618443df323e51553044286dc9365382c7bd3d2c9a3094930823e155017fbc838f8571449b543596b3febe943118068cfa1b4ee12721698 gcc15.patch " diff --git a/community/linux-tools/gcc15.patch b/community/linux-tools/gcc15.patch new file mode 100644 index 00000000000..17686b82d32 --- /dev/null +++ b/community/linux-tools/gcc15.patch @@ -0,0 +1,59 @@ +From 00f61be94dfdc94e2cb60e0620af9c529531680d Mon Sep 17 00:00:00 2001 +From: Achill Gilgenast +Date: Sat, 26 Jul 2025 20:27:24 +0200 +Subject: [PATCH] FROMLIST: libbpf: avoid possible use of uninitialized mod_len + +If not fn_name, mod_len does never get initialized which fails now with +gcc15 on Alpine Linux edge: + + libbpf.c: In function 'find_kernel_btf_id.constprop': + libbpf.c:10100:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized] + 10100 | if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + libbpf.c:10070:21: note: 'mod_len' was declared here + 10070 | int ret, i, mod_len; + | ^~~~~~~ + +Link: https://lore.kernel.org/lkml/20250729094611.2065713-1-fossdd@pwned.life/ +Fixes: 8f8a024272f3 ("libbpf: support "module: Function" syntax for tracing programs") +Signed-off-by: Achill Gilgenast +--- + tools/lib/bpf/libbpf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c +index c8e29c52d28c..cdef24c31d11 100644 +--- a/tools/lib/bpf/libbpf.c ++++ b/tools/lib/bpf/libbpf.c +@@ -10057,27 +10057,27 @@ static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd, int t + btf__free(btf); + if (err <= 0) { + pr_warn("%s is not found in prog's BTF\n", name); + goto out; + } + out: + return err; + } + + static int find_kernel_btf_id(struct bpf_object *obj, const char *attach_name, + enum bpf_attach_type attach_type, + int *btf_obj_fd, int *btf_type_id) + { +- int ret, i, mod_len; ++ int ret, i, mod_len = 0; + const char *fn_name, *mod_name = NULL; + + fn_name = strchr(attach_name, ':'); + if (fn_name) { + mod_name = attach_name; + mod_len = fn_name - mod_name; + fn_name++; + } + + if (!mod_name || strncmp(mod_name, "vmlinux", mod_len) == 0) { + ret = find_attach_btf_id(obj->btf_vmlinux, + mod_name ? fn_name : attach_name, + attach_type); +-- +2.50.1 +