From: Greg Kroah-Hartman Date: Thu, 1 Dec 2022 07:57:37 +0000 (+0100) Subject: 6.0-stable patches X-Git-Tag: v5.10.157~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52e68b6f6feeb6ece721ea52c163670a86708e5d;p=thirdparty%2Fkernel%2Fstable-queue.git 6.0-stable patches added patches: bpf-add-explicit-cast-to-void-for-__bpf_dispatcher_update.patch --- diff --git a/queue-6.0/bpf-add-explicit-cast-to-void-for-__bpf_dispatcher_update.patch b/queue-6.0/bpf-add-explicit-cast-to-void-for-__bpf_dispatcher_update.patch new file mode 100644 index 00000000000..0e5709a7fa6 --- /dev/null +++ b/queue-6.0/bpf-add-explicit-cast-to-void-for-__bpf_dispatcher_update.patch @@ -0,0 +1,55 @@ +From a679120edfcf3d63f066f53afd425d51b480e533 Mon Sep 17 00:00:00 2001 +From: Nathan Chancellor +Date: Mon, 7 Nov 2022 10:07:11 -0700 +Subject: bpf: Add explicit cast to 'void *' for __BPF_DISPATCHER_UPDATE() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nathan Chancellor + +commit a679120edfcf3d63f066f53afd425d51b480e533 upstream. + +When building with clang: + + kernel/bpf/dispatcher.c:126:33: error: pointer type mismatch ('void *' and 'unsigned int (*)(const void *, const struct bpf_insn *, bpf_func_t)' (aka 'unsigned int (*)(const void *, const struct bpf_insn *, unsigned int (*)(const void *, const struct bpf_insn *))')) [-Werror,-Wpointer-type-mismatch] + __BPF_DISPATCHER_UPDATE(d, new ?: &bpf_dispatcher_nop_func); + ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~ + ./include/linux/bpf.h:1045:54: note: expanded from macro '__BPF_DISPATCHER_UPDATE' + __static_call_update((_d)->sc_key, (_d)->sc_tramp, (_new)) + ^~~~ + 1 error generated. + +The warning is pointing out that the type of new ('void *') and +&bpf_dispatcher_nop_func are not compatible, which could have side +effects coming out of a conditional operator due to promotion rules. + +Add the explicit cast to 'void *' to make it clear that this is +expected, as __BPF_DISPATCHER_UPDATE() expands to a call to +__static_call_update(), which expects a 'void *' as its final argument. + +Fixes: c86df29d11df ("bpf: Convert BPF_DISPATCHER to use static_call() (not ftrace)") +Link: https://github.com/ClangBuiltLinux/linux/issues/1755 +Reported-by: kernel test robot +Reported-by: "kernelci.org bot" +Signed-off-by: Nathan Chancellor +Acked-by: Björn Töpel +Acked-by: Yonghong Song +Link: https://lore.kernel.org/r/20221107170711.42409-1-nathan@kernel.org +Signed-off-by: Martin KaFai Lau +Signed-off-by: Greg Kroah-Hartman +--- + kernel/bpf/dispatcher.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/bpf/dispatcher.c ++++ b/kernel/bpf/dispatcher.c +@@ -123,7 +123,7 @@ static void bpf_dispatcher_update(struct + return; + } + +- __BPF_DISPATCHER_UPDATE(d, new ?: &bpf_dispatcher_nop_func); ++ __BPF_DISPATCHER_UPDATE(d, new ?: (void *)&bpf_dispatcher_nop_func); + + if (new) + d->image_off = noff; diff --git a/queue-6.0/series b/queue-6.0/series index 16bf6980f02..6de6e1b7fa8 100644 --- a/queue-6.0/series +++ b/queue-6.0/series @@ -287,3 +287,4 @@ drm-amd-display-update-soc-bounding-box-for-dcn32-dcn321.patch drm-amdgpu-always-register-an-mmu-notifier-for-userptr.patch drm-amdgpu-partially-revert-drm-amdgpu-update-drm_display_info-correctly-when-the-edid-is-read.patch drm-i915-fix-tlb-invalidation-for-gen12-video-and-compute-engines.patch +bpf-add-explicit-cast-to-void-for-__bpf_dispatcher_update.patch