A compiler-emitted cleanup landing pad ends with a call to _Unwind_Resume(), which carries the unwind on once that frame's cleanups have run. The kernel provides the same terminator as a kfunc, named bpf_unwind_resume() to keep the 'bpf_' prefix kfunc convention; a later libbpf patch resolves the compiler's name to it. The kfunc is defined here but not registered with any program type yet. A call to it is only ever valid inside a landing pad, and the verifier cannot say that until it knows what a landing pad is, so registration waits for the patch that adds the rule. Signed-off-by: Yonghong Song --- kernel/bpf/helpers.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 301b35bd85c8..249418e60ee4 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -3445,6 +3445,19 @@ __bpf_kfunc void bpf_throw(u64 cookie) WARN(1, "A call to BPF exception callback should never return\n"); } +/* + * Terminator of a compiler-emitted cleanup landing pad. The compiler names + * this _Unwind_Resume, the base unwind ABI's entry point for carrying an + * unwind on once a frame's cleanups have run. To match kernel kfunc + * convention, the kernel calls it bpf_unwind_resume and libbpf maps the + * compiler's name onto it. + */ +__bpf_kfunc void bpf_unwind_resume(void) +{ + /* Never reached: a JIT emits the way out of a landing pad instead. */ + WARN_ONCE(1, "A JIT should have replaced the exception cleanup resume\n"); +} + __bpf_kfunc int bpf_wq_init(struct bpf_wq *wq, void *p__const_map, unsigned int flags) { struct bpf_async_kern *async = (struct bpf_async_kern *)wq; -- 2.53.0-Meta