Re: [PATCH bpf-next v3 00/17] Exceptions - 1/2

Kumar Kartikeya Dwivedi
2023-09-12T23:38:15Z

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.