Message ID | 20230912233214.1518551-1-memxor@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Exceptions - 1/2 | expand |
On Wed, 13 Sept 2023 at 01:32, Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote: > > This series implements the _first_ part of the runtime and verifier > support needed to enable BPF exceptions. Exceptions thrown from programs > are processed as an immediate exit from the program, which unwinds all > the active stack frames until the main stack frame, and returns to the > BPF program's caller. The ability to perform this unwinding safely > allows the program to test conditions that are always true at runtime > but which the verifier has no visibility into. > > [...] Hi everyone, just to make sure this is not missed, I had to revert back to the ASM approach as I found the C approach to be too fragile during testing. David asked whether we could move this facility into libbpf as well, but I think with the current state it is probably better to let things sit in bpf_experimental.h for a while. The problem with BTF info generation for such ksyms still remains, I tried and kept the (void)bpf_throw suggestion from Andrii but I'm not sure it helps in every case, atleast with clang 17 I can reduce the program to a simple case where it doesn't produce the BTF info needed for successful loading. For now, another no-overhead solution can be having a bpf_throw call that never executes in a static function that is never used. The libbpf loading process will never append this to the main program's instruction sequence (since unreferenced), it will just be there in the object.
Hi, On Wed, Sep 13, 2023 at 1:32 AM Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote: > > This series implements the _first_ part of the runtime and verifier > support needed to enable BPF exceptions. Exceptions thrown from programs > are processed as an immediate exit from the program, which unwinds all > the active stack frames until the main stack frame, and returns to the > BPF program's caller. The ability to perform this unwinding safely > allows the program to test conditions that are always true at runtime > but which the verifier has no visibility into. I am working with Kartikeya on enabling this on ARM64. Here is the patch: https://lore.kernel.org/bpf/20230912233942.6734-1-puranjay12@gmail.com/ Thanks, Puranjay
Hello: This series was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <ast@kernel.org>: On Wed, 13 Sep 2023 01:31:57 +0200 you wrote: > This series implements the _first_ part of the runtime and verifier > support needed to enable BPF exceptions. Exceptions thrown from programs > are processed as an immediate exit from the program, which unwinds all > the active stack frames until the main stack frame, and returns to the > BPF program's caller. The ability to perform this unwinding safely > allows the program to test conditions that are always true at runtime > but which the verifier has no visibility into. > > [...] Here is the summary with links: - [bpf-next,v3,01/17] bpf: Use bpf_is_subprog to check for subprogs https://git.kernel.org/bpf/bpf-next/c/9af27da6313c - [bpf-next,v3,02/17] arch/x86: Implement arch_bpf_stack_walk https://git.kernel.org/bpf/bpf-next/c/fd5d27b70188 - [bpf-next,v3,03/17] bpf: Implement support for adding hidden subprogs https://git.kernel.org/bpf/bpf-next/c/335d1c5b5452 - [bpf-next,v3,04/17] bpf: Implement BPF exceptions https://git.kernel.org/bpf/bpf-next/c/f18b03fabaa9 - [bpf-next,v3,05/17] bpf: Refactor check_btf_func and split into two phases https://git.kernel.org/bpf/bpf-next/c/aaa619ebccb2 - [bpf-next,v3,06/17] bpf: Add support for custom exception callbacks https://git.kernel.org/bpf/bpf-next/c/b9ae0c9dd0ac - [bpf-next,v3,07/17] bpf: Perform CFG walk for exception callback https://git.kernel.org/bpf/bpf-next/c/b62bf8a5e911 - [bpf-next,v3,08/17] bpf: Treat first argument as return value for bpf_throw https://git.kernel.org/bpf/bpf-next/c/a923819fb2c5 - [bpf-next,v3,09/17] mm: kasan: Declare kasan_unpoison_task_stack_below in kasan.h https://git.kernel.org/bpf/bpf-next/c/7ccb84f04cda - [bpf-next,v3,10/17] bpf: Prevent KASAN false positive with bpf_throw https://git.kernel.org/bpf/bpf-next/c/ec5290a178b7 - [bpf-next,v3,11/17] bpf: Detect IP == ksym.end as part of BPF program https://git.kernel.org/bpf/bpf-next/c/66d9111f3517 - [bpf-next,v3,12/17] bpf: Disallow fentry/fexit/freplace for exception callbacks https://git.kernel.org/bpf/bpf-next/c/fd548e1a4618 - [bpf-next,v3,13/17] bpf: Fix kfunc callback register type handling https://git.kernel.org/bpf/bpf-next/c/06d686f771dd - [bpf-next,v3,14/17] libbpf: Refactor bpf_object__reloc_code https://git.kernel.org/bpf/bpf-next/c/6c918709bd30 - [bpf-next,v3,15/17] libbpf: Add support for custom exception callbacks https://git.kernel.org/bpf/bpf-next/c/7e2925f67237 - [bpf-next,v3,16/17] selftests/bpf: Add BPF assertion macros https://git.kernel.org/bpf/bpf-next/c/d6ea06803212 - [bpf-next,v3,17/17] selftests/bpf: Add tests for BPF exceptions https://git.kernel.org/bpf/bpf-next/c/d2a93715bfb0 You are awesome, thank you!