[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW4cCkWGnJfxJvBd498iTd3-hMXLg=s7S68vdgPVhdtqCA@mail.gmail.com>
Date: Mon, 10 Mar 2025 16:07:03 -0700
From: Song Liu <song@...nel.org>
To: Blaise Boscaccy <bboscaccy@...ux.microsoft.com>
Cc: Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Yonghong Song <yonghong.song@...ux.dev>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Stephen Smalley <stephen.smalley.work@...il.com>,
Ondrej Mosnacek <omosnace@...hat.com>, Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Kumar Kartikeya Dwivedi <memxor@...il.com>, Matt Bobrowski <mattbobrowski@...gle.com>,
Xu Kuohai <xukuohai@...wei.com>, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org, bpf@...r.kernel.org,
selinux@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v7 bpf-next 2/2] selftests/bpf: Add a kernel flag test for
LSM bpf hook
On Mon, Mar 10, 2025 at 3:18 PM Blaise Boscaccy
<bboscaccy@...ux.microsoft.com> wrote:
>
> This test exercises the kernel flag added to security_bpf by
> effectively blocking light-skeletons from loading while allowing
> normal skeletons to function as-is. Since this should work with any
> arbitrary BPF program, an existing program from LSKELS_EXTRA was
> used as a test payload.
>
> Signed-off-by: Blaise Boscaccy <bboscaccy@...ux.microsoft.com>
[...]
> +
> + /* Test with skel. This should pass the gatekeeper */
> + skel = kfunc_call_test__open_and_load();
> + if (!ASSERT_OK_PTR(skel, "skel"))
> + goto close_prog;
> +
> + /* Test with lskel. This should fail due to blocking kernel-based bpf() invocations */
> + lskel = kfunc_call_test_lskel__open_and_load();
> + if (!ASSERT_ERR_PTR(lskel, "lskel"))
> + goto close_prog;
This goto is not necessary. But I don't think we need v8 just for this.
Acked-by: Song Liu <song@...nel.org>
> +
> +close_prog:
> + if (skel)
> + kfunc_call_test__destroy(skel);
> + if (lskel)
> + kfunc_call_test_lskel__destroy(lskel);
[...]
Powered by blists - more mailing lists