From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 66-220-155-178.mail-mxout.facebook.com (66-220-155-178.mail-mxout.facebook.com [66.220.155.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C899F41443B for ; Thu, 17 Sep 2026 05:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.220.155.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789624682; cv=none; b=q1kwqMlRROn5MeXoDxhyIrJ6tID8IPmK3CTY3cR9i87Ds1ZPOUY8PzI5SDIWYl9hnKBS3Sc607+cFmvQJxqWXsoVe/3y7pJcTVLwCRSNeWgFdR90srWdEmL/5zu9ZANkjjdkzhlM573+GhcVPYHG/c4lTv++9ZiAXI9RcQuOCEA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789624682; c=relaxed/simple; bh=LDj9AKPprF5hOXcBZav1GP1bn+NMnWeEriKkfDiIuAk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hihQrxy05udewRHOVS5UHQbaU6b9gEJQrU4CVSNAqVngkwx2nOgS+zOibvf/i3HBd7GHKi3dj6hgCyIUqldaOSmoyQuOAmAGowuxnvOsnB8BkFic5clz3CL49I6STNTpqrmfspLNGW+7PDm50vcMe0VG/22Lq2pSxNnJhyCrHXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=fail smtp.mailfrom=linux.dev; arc=none smtp.client-ip=66.220.155.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=linux.dev Received: by devvm16039.vll0.facebook.com (Postfix, from userid 128203) id 69BDE2B48B27CA; Wed, 16 Sep 2026 22:57:52 -0700 (PDT) From: Yonghong Song To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Eduard Zingerman , kernel-team@fb.com Subject: [PATCH bpf-next 13/20] libbpf: Resolve the compiler's _Unwind_Resume to the kernel's kfunc Date: Wed, 16 Sep 2026 22:57:52 -0700 Message-ID: <20260917055752.3932718-1-yonghong.song@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917055645.3926444-1-yonghong.song@linux.dev> References: <20260917055645.3926444-1-yonghong.song@linux.dev> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable LLVM terminates a cleanup landing pad with a call to _Unwind_Resume: the base unwind ABI's entry point for carrying an unwind on once a frame's cleanups have run. The kernel provides that terminator as a kfunc, but not under that name: claiming _Unwind_Resume in the kernel's own symbol table, for a function whose body never runs, would be needlessly confusin= g, so it is called bpf_unwind_resume. Signed-off-by: Yonghong Song --- tools/lib/bpf/libbpf.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 613afae26519..ea1c09fa3793 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -8346,6 +8346,15 @@ static void fixup_verifier_log(struct bpf_program = *prog, char *buf, size_t buf_s } } =20 +/* LLVM terminates a cleanup landing pad with a call to _Unwind_Resume, = the + * base unwind ABI's entry point for carrying an unwind on once a frame'= s + * cleanups have run. The kernel knows it as bpf_unwind_resume. + */ +static const char *kern_extern_name(const char *name) +{ + return strcmp(name, "_Unwind_Resume") ? name : "bpf_unwind_resume"; +} + static int bpf_program_record_relos(struct bpf_program *prog) { struct bpf_object *obj =3D prog->obj; @@ -8807,17 +8816,19 @@ static int bpf_object__resolve_ksym_func_btf_id(s= truct bpf_object *obj, struct module_btf *mod_btf =3D NULL; const struct btf_type *kern_func; struct btf *kern_btf =3D NULL; + const char *kern_name; int ret; =20 local_func_proto_id =3D ext->ksym.type_id; =20 - kfunc_id =3D find_ksym_btf_id(obj, ext->essent_name ?: ext->name, BTF_K= IND_FUNC, &kern_btf, - &mod_btf); + kern_name =3D kern_extern_name(ext->essent_name ?: ext->name); + + kfunc_id =3D find_ksym_btf_id(obj, kern_name, BTF_KIND_FUNC, &kern_btf,= &mod_btf); if (kfunc_id < 0) { if (kfunc_id =3D=3D -ESRCH && ext->is_weak) return 0; pr_warn("extern (func ksym) '%s': not found in kernel or module BTFs\n= ", - ext->name); + strcmp(kern_name, "bpf_unwind_resume") ? ext->name : kern_name); return kfunc_id; } =20 --=20 2.53.0-Meta