From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796506822; b=zcrtQgXjtYcGrbdZsPB8u0hpkeE9T0zrBqALyGofvqbHPp8oh7pSqg2EY2hpdxCtiR2u GWXrWAO0ggHSgUniu1rzUZPQljLNihgLwZCuShe/12bvCjgyIw9bBJg+/6AUE2ismaMoM WiVkuVNgpirGAhkjzqxpgyLWowf5rvtCUvKyeGynflFbx/Z07KgqaO7KVGE6oVLRLH7Y0 g9fQISOzO4Tlrgd1GlCBUxL8FpARb/KAQjCTW3iovHNLoF96ekMFs3kd2sdI0qTlm9FcZ YgUE6KgMAH5nXvtghewvlykbtgerz5M1NtmA1zURcrZL/C2jG1bSmOlioIZG2ELJN0A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796506822; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=IGlsJcA35NEAu0cwW/+WaOWz2RDwzFwzBeFX/pi+yIg=; b=dZ0VW5RcPPEaeqNm58aPrwBvWDtPEIX3jvjyV2UDq/a0t4mf0kqH5I8e1P95CLtwrHtw N0KnS+2ZsYDiaZSFeHhiSKHkCHfy+FiF2FzJYKwT1Yhb8xdw14FogeUe1fEQ32WzFMtj4 rvYNGSmQAsZMjSstjMeHsjk2O9OsYX3ZoaPiwe5C6ZTg8I8zZuSaDUUp3qphtzuJF87sm aglsiv+xeWEwQH7Cpg051p8901GLXzAWimtF+n0N+MBPTNe+BGv6zzKwCrTVy2e4xjyo+ ptHfSTgVQnEJUxXcVpF72jz95xBy08sr1zaCqo+/3usv5asMTAtJGIdwt39Nn8Mc7Bg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eEcclRvQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F295F606A31F for ; Sat, 5 Dec 2026 21:40:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eEcclRvQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 771D61F0092B; Sat, 5 Dec 2026 21:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796506821; bh=IGlsJcA35NEAu0cwW/+WaOWz2RDwzFwzBeFX/pi+yIg=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=eEcclRvQqtrE9CK3JFeSXHjFH44VFAamkyz4q4Z3oluAJwZGJo3swFloyU0smkbzD wluMF8l5WBMlKt2l26rOaah/JEYVL4+YZDkOKZUHFzqSQ264iZJDXIoBVkf2XxCF5U Eu9nTWk7Q5SFafKRS/fvoTG4TFl0wl1U1c+A5pHmUmwdfCUAjje1ikxZBnH2Bdd7h5 KbzQ1lZJxu8fSbPcDwp/ryq+1t5/zInIWvyAWjEwHMr8stxs5LtF30yrw8t8tZXYp4 wT3OjhB8S/KT+FJCa/NypAJLN3uSGCnpnC6blQ6TJuEii8eHZaKXMv8Z1ll+KoQdTA jkm6XHkNJ8Ocg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH bpf-next 3/3] selftests/bpf: Test weak typed ksyms without vmlinux BTF Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?R2V5c2xhbiBHcmVnw7NyaW8=?= , bpf@vger.kernel.org In-Reply-To: <20261205-libbpf-weak-typed-ksyms-no-vmlinux-btf-v1-3-77cc642f7d4b@condado.dev> References: <20261205-libbpf-weak-typed-ksyms-no-vmlinux-btf-v1-0-77cc642f7d4b@condado.dev> <20261205-libbpf-weak-typed-ksyms-no-vmlinux-btf-v1-3-77cc642f7d4b@condado.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 21:40:21 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] selftests/bpf: multi-line comment style in weak_syms_no_vmlinux_btf() - [Low] selftests/bpf: weak_syms_no_vmlinux_btf() fails on missing /sys/kernel/btf - [Low] selftests/bpf: ineffective out__typeless check in weak_syms_no_vmlinux_btf() -- commit 5bb212acbecdd5b5802324ccf479855425cb6236 Author: Geyslan Greg=C3=B3rio selftests/bpf: Test weak typed ksyms without vmlinux BTF This commit adds a BPF selftest subtest that hides /sys/kernel/btf in a chi= ld mount namespace to verify that objects with only weak typed ksyms load and run using btf_custom_path, while an object with a strong typed ksym fails to load with -ESRCH. > diff --git a/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c b/tools/t= esting/selftests/bpf/prog_tests/ksyms_btf.c > index 1bc3089f10fca..d64bb2d7a3223 100644 > --- a/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c > +++ b/tools/testing/selftests/bpf/prog_tests/ksyms_btf.c [ ... ] > @@ -139,6 +145,135 @@ static void test_weak_syms_lskel(void) [ ... ] > +/* Runs in a child, in a mount namespace of its own: with /sys/kernel/btf > + * hidden, libbpf finds no kernel BTF, as on a kernel built without it. > + */ > +static int weak_syms_no_vmlinux_btf(const char *btf_file) [Severity: Low] BPF code uses the multi-line comment style with the opening /* on its own line and the text starting on the next line. The comment above bpf_prog_test_run_opts() in this same function uses the old style as well. [ ... ] > + if (unshare(CLONE_NEWNS) || > + mount("", "/", "", MS_REC | MS_PRIVATE, NULL) || > + mount("none", "/sys/kernel/btf", "tmpfs", 0, NULL)) > + return NO_BTF_SETUP; > + > + /* libbpf also takes kernel BTF from a vmlinux image, if it finds one */ > + btf =3D btf__load_vmlinux_btf(); > + if (!libbpf_get_error(btf)) { > + btf__free(btf); > + return NO_BTF_SKIP; > + } [Severity: Low] Can mount() fail with ENOENT here when /sys/kernel/btf is absent? When sysfs is not mounted, btf__load_vmlinux_btf() in the parent still succeeds if a fallback vmlinux image with BTF exists in /boot or /lib/modules. The child then returns NO_BTF_SETUP and fails the subtest instead of reaching the check below and skipping with NO_BTF_SKIP. Ignoring ENOENT on the /sys/kernel/btf mount would treat it as already hidd= en and let the subtest reach the skip check. [ ... ] > + if (skel->data->out__typed_var !=3D 0) > + ret =3D NO_BTF_TYPED_VAR; > + else if (skel->data->out__typeless =3D=3D -1) > + ret =3D NO_BTF_TYPELESS; [Severity: Low] Can the out__typeless =3D=3D -1 branch ever trigger? If handler() never ran, out__typed_var is still -1 and triggers first. Once handler() runs, it overwrites out__typeless with either the resolved address or 0 because bpf_prog_active is __weak in test_ksyms_weak_no_btf.c, so this passes even when /proc/kallsyms resolution fails. Comparing out__typeless against kallsyms_find("bpf_prog_active", &addr) as test_basic() does, or dropping __weak from bpf_prog_active, would check kallsyms resolution. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205-libbpf-wea= k-typed-ksyms-no-vmlinux-btf-v1-0-77cc642f7d4b@condado.dev?part=3D3