Linux real-time development
 help / color / mirror / Atom feed
From: Jiayuan Chen <jiayuan.chen@linux.dev>
To: sashiko-reviews@lists.linux.dev
Cc: linux-rt-devel@lists.linux.dev, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 4/4] selftests/bpf: Add a test for arena fault-in under memory.max
Date: Wed, 5 Aug 2026 19:18:59 +0800	[thread overview]
Message-ID: <74fddad1-fedf-4fc6-a2de-ba83a7190caa@linux.dev> (raw)
In-Reply-To: <20260805092944.5B0351F000E9@smtp.kernel.org>


On 8/5/26 5:29 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The test passes on unexpected crashes because it only asserts that the termination signal is not SIGSEGV, rather than strictly expecting SIGKILL from the memcg OOM killer.
> --
>
> --- Patch [4]: [PATCH bpf-next v2 4/4] selftests/bpf: Add a test for arena fault-in under memory.max ---
> commit d5e6a0b924679b20cf7f391518ec1a560ae725e3
> Author: Jiayuan Chen <jiayuan.chen@linux.dev>
>
> selftests/bpf: Add a test for arena fault-in under memory.max
>
> This commit adds a BPF selftest for arena fault-in under a constrained memory
> cgroup. It creates a child process to fault in an arena and verifies it is
> killed by the memcg OOM killer rather than incorrectly dying from SIGSEGV.
>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/arena_memcg.c b/tools/testing/selftests/bpf/prog_tests/arena_memcg.c
>> new file mode 100644
>> index 0000000000000..ca039ebd3d674
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/prog_tests/arena_memcg.c
> [ ... ]
>> +void serial_test_arena_memcg(void)
>> +{
> [ ... ]
>> +	/*
>> +	 * Faulting a valid arena address until memory.max is hit must not look
>> +	 * like an invalid access. Without the fix the fault path allocated with
>> +	 * the non-blocking allocator, turned its -ENOMEM into VM_FAULT_SIGSEGV,
>> +	 * and the child died with SIGSEGV on a valid address; now it is handled
>> +	 * by the memcg OOM path and the child is killed by SIGKILL instead.
>> +	 */
>> +	if (!ASSERT_TRUE(WIFSIGNALED(status), "child killed by signal"))
>> +		goto out;
>> +	if (!ASSERT_NEQ(WTERMSIG(status), SIGSEGV, "not killed by SIGSEGV"))
>> +		dump_memcg(read_cgroup_file);
> [Severity: Medium]
> Could this mask other failures by accepting any signal other than SIGSEGV?
>
> If the child process crashes due to an unrelated issue like a libbpf internal
> assertion (SIGABRT) or an invalid memory access (SIGBUS), this assertion would
> evaluate to true and the test would silently pass.
>
> Should this explicitly expect SIGKILL from the memcg OOM killer using
> ASSERT_EQ(WTERMSIG(status), SIGKILL)?


I think checking "oom_kill" in memory.events would be more accurate.


That said, I'm not sure patches 3 and 4 are necessary, they only 
exercise the memcg behavior,

so we could drop them when merging (if the series is accepted).


Both ok for me.


      reply	other threads:[~2026-08-05 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  9:15 [PATCH bpf-next v2 0/4] bpf: arena: handle memory.max on fault-in with reclaim/OOM Jiayuan Chen
2026-08-05  9:15 ` [PATCH bpf-next v2 1/4] bpf: Add a sleepable page allocator for map memory Jiayuan Chen
2026-08-05  9:32   ` sashiko-bot
2026-08-05 10:36     ` Jiayuan Chen
2026-08-05  9:15 ` [PATCH bpf-next v2 2/4] bpf: arena: allocate the fault-in page outside the lock Jiayuan Chen
2026-08-05  9:15 ` [PATCH bpf-next v2 3/4] selftests/bpf: Add read_cgroup_file() to cgroup_helpers Jiayuan Chen
2026-08-05  9:15 ` [PATCH bpf-next v2 4/4] selftests/bpf: Add a test for arena fault-in under memory.max Jiayuan Chen
2026-08-05  9:29   ` sashiko-bot
2026-08-05 11:18     ` Jiayuan Chen [this message]

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=74fddad1-fedf-4fc6-a2de-ba83a7190caa@linux.dev \
    --to=jiayuan.chen@linux.dev \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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