From: sashiko-bot@kernel.org
To: "Ben Gardon" <bgardon@google.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Hocko" <mhocko@kernel.org>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Tejun Heo" <tj@kernel.org>
Cc: "JP Kobryn" <jp.kobryn@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"David Rientjes" <rientjes@google.com>,
"Suren Baghdasaryan" <surenb@google.com>,
"Josh Don" <joshdon@google.com>,
"Sweet Tea Dorminy" <sweettea-kernel@dorminy.me>,
"Chuyi Zhou" <zhouchuyi@bytedance.com>,
"Yafang Shao" <laoar.shao@gmail.com>,
benbwgardon@gmail.com, bpf@vger.kernel.org, linux-mm@kvack.org,
"Shuah Khan" <shuah@kernel.org>,
mkoutny@suse.com
Subject: Re: [PATCH bpf-next v4 14/17] selftests/bpf: Add negative and verifier tests for BPF OOM kfuncs
Date: Wed, 02 Dec 2026 21:15:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-246633@kernel.org> (raw)
In-Reply-To: <20261202210415.517651-15-bgardon@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/bpf: duplicate harness in serial_test_oom_kfunc_neg()
--
commit 4efe5c8fa9501edb24e804de6187524dc373a747
Author: Ben Gardon <bgardon@google.com>
selftests/bpf: Add negative and verifier tests for BPF OOM kfuncs
This commit adds BPF selftests covering verifier context restrictions and
runtime checks for BPF OOM kfuncs.
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_oom_kfunc_neg.c b/tools/testing/selftests/bpf/prog_tests/test_oom_kfunc_neg.c
> new file mode 100644
> index 0000000000000..8cfe9e3e85bbc
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/test_oom_kfunc_neg.c
> @@ -0,0 +1,79 @@
[ ... ]
> +void serial_test_oom_kfunc_neg(void)
> +{
> + struct test_oom_proactive_kill *skel = NULL;
> + struct proactive_kill_args args = {};
> + struct memory_holder worker;
> + int prog_fd, status = 0;
> + LIBBPF_OPTS(bpf_test_run_opts, topts,
> + .ctx_in = &args,
> + .ctx_size_in = sizeof(args),
> + );
> +
> + memory_holder_init(&worker);
> +
> + /* Verifier rejection checks for kfunc context restrictions */
> + RUN_TESTS(test_oom_fail_syscall);
> + RUN_TESTS(test_oom_fail_ops_oom);
> + RUN_TESTS(test_oom_fail_ops_proactive);
> +
> + skel = test_oom_proactive_kill__open_and_load();
> + if (!ASSERT_OK_PTR(skel, "open_and_load"))
> + return;
[Severity: Low]
Could these test cases be folded into serial_test_oom_proactive_kill() in
tools/testing/selftests/bpf/prog_tests/test_oom_proactive_kill.c and
wrapped in test__start_subtest()?
serial_test_oom_proactive_kill() already loads test_oom_proactive_kill and
sets up the memory_holder and bpf_prog_test_run_opts() harness to test
proactive_kill_prog. Also, because RUN_TESTS() registers subtests while
the runtime checks below run at the top level outside
test__start_subtest(), running test_progs -t oom_kfunc_neg/<subtest> still
executes the runtime checks and invokes the global OOM killer under
oom_lock, and those runtime checks cannot be selected or skipped
individually.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202210415.517651-1-bgardon@google.com?part=14
next prev parent reply other threads:[~2026-12-02 21:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 21:03 [PATCH bpf-next v4 00/17] mm: BPF OOM Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 01/17] bpf: mark struct oom_control's memcg field as TRUSTED_OR_NULL Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 02/17] mm, bpf: introduce BPF OOM struct ops Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 03/17] mm, bpf: introduce bpf_oom_kill_process() BPF kfunc Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 04/17] mm, bpf: introduce bpf_out_of_memory() " Ben Gardon
2026-12-02 21:18 ` sashiko-bot
2026-12-02 21:03 ` [PATCH bpf-next v4 05/17] selftests/bpf: Add BPF OOM struct ops test Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 06/17] sched/psi: add a tracepoint to psi_avgs_work() Ben Gardon
2026-12-02 21:15 ` sashiko-bot
2026-12-02 21:03 ` [PATCH bpf-next v4 07/17] sched/psi: add cgroup_id field to psi_group structure Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 08/17] mm, bpf: allow calling bpf_out_of_memory() from a PSI tracepoint Ben Gardon
2026-12-02 21:03 ` [PATCH bpf-next v4 09/17] selftests/bpf: Enable CONFIG_PSI Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 10/17] selftests/bpf: Add PSI tracepoint OOM test Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 11/17] selftests/bpf: Add systemd-oomd style OOM policy test Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 12/17] mm, bpf: introduce bpf_oom_proactive_kill() for proactive OOM prevention Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 13/17] selftests/bpf: Add bpf_oom_proactive_kill() proactive OOM test Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 14/17] selftests/bpf: Add negative and verifier tests for BPF OOM kfuncs Ben Gardon
2026-12-02 21:15 ` sashiko-bot [this message]
2026-12-02 21:04 ` [PATCH bpf-next v4 15/17] mm, bpf: introduce bpf_mem_cgroup_raise_max() kfunc Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 16/17] selftests/bpf: Add bpf_mem_cgroup_raise_max() OOM test Ben Gardon
2026-12-02 21:04 ` [PATCH bpf-next v4 17/17] Documentation/bpf: Document BPF OOM handling and kfuncs Ben Gardon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-246633@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=benbwgardon@gmail.com \
--cc=bgardon@google.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=hannes@cmpxchg.org \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=joshdon@google.com \
--cc=jp.kobryn@linux.dev \
--cc=laoar.shao@gmail.com \
--cc=linux-mm@kvack.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mhocko@kernel.org \
--cc=mkoutny@suse.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=surenb@google.com \
--cc=sweettea-kernel@dorminy.me \
--cc=tj@kernel.org \
--cc=yonghong.song@linux.dev \
--cc=zhouchuyi@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox