Skip to content

Allow mmap of /sys/kernel/btf/vmlinux #8976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: Allow mmap of /sys/kernel/btf/vmlinux
version: 5
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: b615ce5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: b615ce5
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 25b6d5d
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 4e2e684
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: d90f0bc
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 5ead949
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6888a03
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the series/958810=>bpf-next branch from 8e4d231 to af5c8a1 Compare May 22, 2025 22:19
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6888a03
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

lmb added 2 commits May 22, 2025 16:25
User space needs access to kernel BTF for many modern features of BPF.
Right now each process needs to read the BTF blob either in pieces or
as a whole. Allow mmaping the sysfs file so that processes can directly
access the memory allocated for it in the kernel.

remap_pfn_range is used instead of vm_insert_page due to aarch64
compatibility issues.

Tested-by: Alan Maguire <[email protected]>
Signed-off-by: Lorenz Bauer <[email protected]>
Reviewed-by: Shakeel Butt <[email protected]>
Add a basic test for the ability to mmap /sys/kernel/btf/vmlinux.
Ensure that the data is valid BTF and that it is padded with zero.

Tested-by: Alan Maguire <[email protected]>
Signed-off-by: Lorenz Bauer <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 8259eb0
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=964584
version: 5

Teach libbpf to use mmap when parsing vmlinux BTF from /sys. We don't
apply this to fall-back paths on the regular file system because there
is no way to ensure that modifications underlying the MAP_PRIVATE
mapping are not visible to the process.

Acked-by: Andrii Nakryiko <[email protected]>
Tested-by: Alan Maguire <[email protected]>
Signed-off-by: Lorenz Bauer <[email protected]>
@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the series/958810=>bpf-next branch from e8d88cf to 27cbb96 Compare May 22, 2025 23:25
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.

1 participant