From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 66-220-144-179.mail-mxout.facebook.com (66-220-144-179.mail-mxout.facebook.com [66.220.144.179]) (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 5B79D3D5236 for ; Thu, 8 Oct 2026 07:52:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.220.144.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791445929; cv=none; b=bbcHd+CGSgg43Ct5sjL1KK5/EykGDNsHutGnkut1M5AGRp6XW2lq2Yrr3PDWTbOT2W5nvurSxeShtKfjzAMj8W7jOIlpEms4obOKy2tTHOT/4dzYDvdSKPaKcuTjiKa/bw5jfz1aCjTXcOce5fNGh4WhJlz8AgK/o8QaR8PRXc0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791445929; c=relaxed/simple; bh=ZbbFCxdWAOTqswtWkGonk/9nH3XFrthQ5f68rWvUynA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VtQ8OR2uHO2w8zf36FpSxDhGW24KqhBqWz1sCFSBlMYBhYhp+6bfveExyt08zkZQ4Ad4PPidnlFIYRpgNX7an57rJQ4Z6O9iWLMupMqR22g4p2Xg7YjzvTkDGv4d5YwlVoZJbHWfXCIhWdhFjIs5FvNj7HT0Bfs3/ESjnFFds1E= 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.144.179 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 623642FDA0CA6F; Thu, 8 Oct 2026 00:51:57 -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 v9 23/23] selftests/bpf: Load an exception cleanup program from a light skeleton Date: Thu, 8 Oct 2026 00:51:57 -0700 Message-ID: <20261008075157.3010759-1-yonghong.song@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261008074959.2993751-1-yonghong.song@linux.dev> References: <20261008074959.2993751-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 A light skeleton loads a program by a path of its own: its loader program builds the attr and resolves kfunc names when it runs. Build progs/exceptions_cleanup.c as a light skeleton too, and run the case in which every pad runs: a table that lost records or came out at the wrong offsets would fail to load, or run the wrong pads. Signed-off-by: Yonghong Song --- tools/testing/selftests/bpf/Makefile.skel | 2 +- .../bpf/prog_tests/exceptions_cleanup.c | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile.skel b/tools/testing/se= lftests/bpf/Makefile.skel index 06e297a17156..d9cbe8ac85b7 100644 --- a/tools/testing/selftests/bpf/Makefile.skel +++ b/tools/testing/selftests/bpf/Makefile.skel @@ -40,7 +40,7 @@ LSKELS_SIGNED :=3D fentry_test.c fexit_test.c atomics.c =20 # Generate both light skeleton and libbpf skeleton for these LSKELS_EXTRA :=3D test_ksyms_module.c test_ksyms_weak.c kfunc_call_test.= c \ - kfunc_call_test_subprog.c test_global_percpu_data.c + kfunc_call_test_subprog.c test_global_percpu_data.c exceptions_cleanup.= c SKEL_BLACKLIST +=3D $(LSKELS) $(LSKELS_SIGNED) =20 test_static_linked.skel.h-deps :=3D test_static_linked1.bpf.o test_stati= c_linked2.bpf.o diff --git a/tools/testing/selftests/bpf/prog_tests/exceptions_cleanup.c = b/tools/testing/selftests/bpf/prog_tests/exceptions_cleanup.c index 7c5dffd4b861..1493c3efa599 100644 --- a/tools/testing/selftests/bpf/prog_tests/exceptions_cleanup.c +++ b/tools/testing/selftests/bpf/prog_tests/exceptions_cleanup.c @@ -6,6 +6,7 @@ #include "exceptions_cleanup_fail.skel.h" #include "exceptions_cleanup_shapes.skel.h" #include "exceptions_cleanup_tracing.skel.h" +#include "exceptions_cleanup.lskel.h" =20 /* foo3 unwound: every frame that has a pad ran it. */ #define PADS_FOO3_UNWOUND \ @@ -63,6 +64,33 @@ static int load_tracer(struct exceptions_cleanup *tgt,= bool fexit) return err; } =20 +static void test_light_skeleton(void) +{ + struct exceptions_cleanup_lskel *skel; + __u64 ctx =3D 0; + int err; + + LIBBPF_OPTS(bpf_test_run_opts, topts, + .ctx_in =3D &ctx, + .ctx_size_in =3D sizeof(ctx), + ); + + skel =3D exceptions_cleanup_lskel__open_and_load(); + if (!ASSERT_OK_PTR(skel, "light open_and_load")) + return; + + /* foo3 unwinds, so every pad runs: the whole table has to arrive. */ + skel->bss->input =3D 101; + err =3D bpf_prog_test_run_opts(skel->progs.entry.prog_fd, &topts); + if (!ASSERT_OK(err, "run")) + goto out; + ASSERT_EQ(topts.retval, 0, "retval"); + ASSERT_EQ(skel->bss->pads_ran, PADS_FOO3_UNWOUND | RAN_BUMP, + "pads_ran"); +out: + exceptions_cleanup_lskel__destroy(skel); +} + void test_exceptions_cleanup(void) { char log[8192] =3D {}; @@ -113,6 +141,9 @@ void test_exceptions_cleanup(void) =20 exceptions_cleanup__destroy(skel); =20 + if (test__start_subtest("light_skeleton")) + test_light_skeleton(); + RUN_TESTS(exceptions_cleanup_fail); RUN_TESTS(exceptions_cleanup_shapes); } --=20 2.53.0-Meta