Skip to content

bpf: Fix percpu address space issues#79

Closed
chantra wants to merge 1 commit intobpf-next_basefrom
series/876530=>bpf-next
Closed

bpf: Fix percpu address space issues#79
chantra wants to merge 1 commit intobpf-next_basefrom
series/876530=>bpf-next

Conversation

@chantra
Copy link
Owner

@chantra chantra commented Aug 13, 2024

Pull request for series with
subject: bpf: Fix percpu address space issues
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=878542

In arraymap.c:

In bpf_array_map_seq_start() and bpf_array_map_seq_next()
cast return values from the __percpu address space to
the generic address space via uintptr_t [1].

Correct the declaration of pptr pointer in __bpf_array_map_seq_show()
to void __percpu * and cast the value from the generic address
space to the __percpu address space via uintptr_t [1].

In hashtab.c:

Assign the return value from bpf_mem_cache_alloc() to void pointer
and cast the value to void __percpu ** (void pointer to percpu void
pointer) before dereferencing.

In memalloc.c:

Explicitly declare __percpu variables.

Cast obj to void __percpu **.

In helpers.c:

Cast ptr in BPF_CALL_1 and BPF_CALL_2 from generic address space
to __percpu address space via const uintptr_t [1].

Found by GCC's named address space checks.

There were no changes in the resulting object files.

[1] https://sparse.docs.kernel.org/en/latest/annotations.html#address-space-name

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Song Liu <song@kernel.org>
Cc: Yonghong Song <yonghong.song@linux.dev>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Stanislav Fomichev <sdf@fomichev.me>
Cc: Hao Luo <haoluo@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
@chantra
Copy link
Owner Author

chantra commented Aug 13, 2024

Upstream branch: 4a4c013
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=878542
version: 2

@chantra chantra closed this Aug 13, 2024
@chantra chantra deleted the series/876530=>bpf-next branch September 16, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants