-
Notifications
You must be signed in to change notification settings - Fork 5
bpf: Report arena faults to BPF streams #5838
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
bpf: Report arena faults to BPF streams #5838
Conversation
|
Upstream branch: 2465bb8 |
8f9c214 to
c9c941d
Compare
|
Upstream branch: 2660b9d |
3e7a972 to
7bcd435
Compare
c9c941d to
c640618
Compare
|
Upstream branch: d3abefe |
7bcd435 to
7d3e900
Compare
c640618 to
721f1da
Compare
|
Upstream branch: 4c229f3 |
7d3e900 to
82a14f8
Compare
721f1da to
c2e9835
Compare
|
Upstream branch: bd27626 |
82a14f8 to
310f70d
Compare
BPF loads with BPF_PROBE_MEM(SX) can load from unsafe pointers and the JIT adds an exception table entry for the JITed instruction which allows the exeption handler to set the destination register of the load to zero and continue execution from the next instruction. As all arm64 instructions are AARCH64_INSN_SIZE size, the exception handler can just increment the pc by AARCH64_INSN_SIZE without needing the exact address of the instruction following the the faulting instruction. Simplify the exception table usage in arm64 JIT by only saving the destination register in ex->fixup and drop everything related to the fixup_offset. The fault handler is modified to add AARCH64_INSN_SIZE to the pc. Signed-off-by: Puranjay Mohan <[email protected]> Acked-by: Yonghong Song <[email protected]> Acked-by: Kumar Kartikeya Dwivedi <[email protected]>
Begin reporting arena page faults and the faulting address to BPF program's stderr, this patch adds support in the arm64 and x86-64 JITs, support for other archs can be added later. The fault handlers receive the 32 bit address in the arena region so the upper 32 bits of user_vm_start is added to it before printing the address. This is what the user would expect to see as this is what is printed by bpf_printk() is you pass it an address returned by bpf_arena_alloc_pages(); Signed-off-by: Puranjay Mohan <[email protected]> Acked-by: Yonghong Song <[email protected]>
Add selftests for testing the reporting of arena page faults through BPF streams. Two new bpf programs are added that read and write to an unmapped arena address and the fault reporting is verified in the userspace through streams. Signed-off-by: Puranjay Mohan <[email protected]>
|
Upstream branch: bd27626 |
310f70d to
7abfc91
Compare
c2e9835 to
83124e1
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=996118 expired. Closing PR. |
Pull request for series with
subject: bpf: Report arena faults to BPF streams
version: 4
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=996118