linux-stable/include
Arnd Bergmann 6a5a148aaf bpf: fix bpf_probe_read_kernel prototype mismatch
bpf_probe_read_kernel() has a __weak definition in core.c and another
definition with an incompatible prototype in kernel/trace/bpf_trace.c,
when CONFIG_BPF_EVENTS is enabled.

Since the two are incompatible, there cannot be a shared declaration in
a header file, but the lack of a prototype causes a W=1 warning:

kernel/bpf/core.c:1638:12: error: no previous prototype for 'bpf_probe_read_kernel' [-Werror=missing-prototypes]

On 32-bit architectures, the local prototype

u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)

passes arguments in other registers as the one in bpf_trace.c

BPF_CALL_3(bpf_probe_read_kernel, void *, dst, u32, size,
            const void *, unsafe_ptr)

which uses 64-bit arguments in pairs of registers.

As both versions of the function are fairly simple and only really
differ in one line, just move them into a header file as an inline
function that does not add any overhead for the bpf_trace.c callers
and actually avoids a function call for the other one.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/ac25cb0f-b804-1649-3afb-1dc6138c2716@iogearbox.net/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20230801111449.185301-1-arnd@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-08-02 14:14:17 -07:00
..
acpi More ACPI updates for 6.5-rc1 2023-07-06 22:25:06 -07:00
asm-generic vmlinux.lds.h: Remove a reference to no longer used sections .text..refcount 2023-07-11 14:29:43 -07:00
clocksource
crypto This update includes the following changes: 2023-06-30 21:27:13 -07:00
drm Linux 6.5-rc1 2023-07-11 09:23:20 +02:00
dt-bindings Another set of clk driver updates and fixes for the merge window. The 2023-07-04 11:07:45 -07:00
keys KEYS: Add forward declaration in asymmetric-parser.h 2023-06-23 16:15:37 +08:00
kunit
kvm Common KVM changes for 6.5: 2023-07-01 07:07:55 -04:00
linux bpf: fix bpf_probe_read_kernel prototype mismatch 2023-08-02 14:14:17 -07:00
math-emu
media media updates for v6.5-rc1 2023-07-05 10:42:32 -07:00
memory
misc
net bpf, net: Support SO_REUSEPORT sockets with bpf_sk_assign 2023-07-25 13:55:55 -07:00
pcmcia
ras
rdma rdma: fix INFINIBAND_USER_ACCESS dependency 2023-07-03 16:55:04 -07:00
rv
scsi SCSI misc on 20230629 2023-06-30 11:57:07 -07:00
soc net: dsa: felix: make vsc9959_tas_guard_bands_update() visible to ocelot->ops 2023-07-06 19:10:22 -07:00
sound ASoC: Updates for v6.5 2023-06-26 15:38:02 +02:00
target SCSI misc on 20230629 2023-06-30 11:57:07 -07:00
trace Including fixes from bluetooth, bpf and wireguard. 2023-07-05 15:44:45 -07:00
uapi netfilter: bpf: Support BPF_F_NETFILTER_IP_DEFRAG in netfilter link 2023-07-28 16:52:08 -07:00
ufs Merge branch '6.5/scsi-staging' into 6.5/scsi-fixes 2023-07-11 12:15:15 -04:00
vdso
video sticon/parisc: Fix STI console on 64-bit only machines 2023-06-30 17:14:14 +02:00
xen x86: xen: add missing prototypes 2023-06-26 07:47:11 +02:00