Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "Alexis Lothoré" <alexis.lothore@bootlin.com>
To: "Ihor Solodrai" <ihor.solodrai@linux.dev>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Shuah Khan" <shuah@kernel.org>, "Ingo Molnar" <mingo@redhat.com>,
	"Andrey Konovalov" <andreyknvl@gmail.com>,
	"Emil Tsalapatis" <emil@etsalapatis.com>,
	"Yafang Shao" <laoar.shao@gmail.com>
Cc: <ebpf@linuxfoundation.org>,
	"Bastien Curutchet" <bastien.curutchet@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next v7 0/9] bpf: add support for KASAN checks in JITed programs
Date: Thu, 27 Aug 2026 09:01:42 +0200	[thread overview]
Message-ID: <DKZJ7GFLAU12.1WHACTBREQQV2@bootlin.com> (raw)
In-Reply-To: <1c34603a-9170-4074-b826-e98d9871e2d8@linux.dev>

Hi Ihor,

On Wed Aug 26, 2026 at 11:00 PM CEST, Ihor Solodrai wrote:
> On 2026-08-23 3:53 p.m., Kumar Kartikeya Dwivedi wrote:
>> On Sat Aug 22, 2026 at 12:39 AM CEST, Alexis Lothoré (eBPF Foundation) wrote:
>>> Hello,
>>> this is v7 of the series aiming to bring basic support for KASAN checks
>>> to BPF JITed programs. This new revision just makes the series rebased
>>> on top of current bpf-next_base.
>>>
>>> Please note that with the recent kernel splat detector introduced in
>>> kernel-patches/vmtest through commit 8109e5928cd0 ("ci: own the kernel
>>> splat matching (#509)"), CI runs on this series will fail with the
>>> following error.
>>>
>>>     Error: kernel splat detected: [  100.689549] BUG: KASAN: \
>>>     slab-use-after-free in \
>>>     bpf_prog_eba69524d1d949b1_st_not_on_stack+0x12f/0x17a \
>>>
>>> which is pretty normal, as the new selftests introduced by this series
>>> are expected to trigger KASAN splats (the test_progs part will pass,
>>> only the kernel_splats part will trigger errors). The right fix may be
>>> to just put a list of regex matching all the kasan subtests progs in the
>>> relevant SPLAT_ALLOWLIST file; something like:
>>>
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_(st|ld)(x)?(_not)?_on_stack\+
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_simple_atomic(_fetch)?(_not)_on_stack\+
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_ldx_patched(_not)?_on_stack\+
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_verifier_paths_stack_and_non_stack\+
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_ldx_oob\+
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_st_blinded\+
>>> BUG: KASAN: slab-(out-of-bounds|use-after-free) in bpf_prog_([a-f0-9]){16}_(load_acquire|store_release)(_not)?_on_stack\+
>>>
>>> I can take care of opening the relevant PR in kernel-patches/vmtest with
>>> this if it ends up being the correct solution, but it will make sense to
>>> do so only once the selftests list is validated (but before merging the
>>> series).
>> 
>> We need to resolve this before landing the set. To me it looks inevitable, esp.
>> if we exercise the support and produce such warnings. That said I'll let Ihor
>> respond and provide guidance for this. We should probably land the vmtest PR
>> before v8 is posted, so that v8 can go through CI and be processed without
>> failures.
>
> This is a tricky one.
>
> IIUC the suggested allowlist regex will also mask the real splats, which
> the whole KASAN-in-JIT project was supposed to catch.

Not really: the proposed list of regex above just discards the splat
emitted by the progs used by the tests related to the KASAN feature (so
any prog in tools/testing/selftests/bpf/prog/{kasan.c,kasan_harden.c},
which anyway generate "fake" KASAN splat for most of them, since we are
manually poisoning some valid memory to trigger the splats. Any other
program that generate a splat will be caught by the splat detector.
>
> I think a good way to resolve this is to teach the kasan splat
> detection script about these tests, and drop/skip them from the dmesg
> log it inspects. For example, match begin / end of the test set.
> Might require special log anchors printed by the test itself, but
> you get the idea.
>
> Alexis, do you mind trying this?

If despite the comment above, teaching check-kernel-splat.sh how to
ignore the kasan selftests specific splats remains a better solution,
sure, I can work on this.

Thanks,

Alexis

-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  reply	other threads:[~2026-08-27  7:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21 22:39 [PATCH bpf-next v7 0/9] bpf: add support for KASAN checks in JITed programs Alexis Lothoré (eBPF Foundation)
2026-08-21 22:39 ` [PATCH bpf-next v7 1/9] bpf: mark instructions accessing program stack Alexis Lothoré (eBPF Foundation)
2026-08-21 23:24   ` bot+bpf-ci
2026-08-23 22:33     ` Kumar Kartikeya Dwivedi
2026-08-26 15:19       ` Alexis Lothoré
2026-08-21 22:39 ` [PATCH bpf-next v7 2/9] bpf: add BPF_JIT_KASAN for KASAN instrumentation of JITed programs Alexis Lothoré (eBPF Foundation)
2026-08-21 22:39 ` [PATCH bpf-next v7 3/9] bpf, x86: refactor BPF_ST management in do_jit Alexis Lothoré (eBPF Foundation)
2026-08-21 22:39 ` [PATCH bpf-next v7 4/9] bpf, x86: emit KASAN checks in x86 JITed programs Alexis Lothoré (eBPF Foundation)
2026-08-21 23:24   ` bot+bpf-ci
2026-08-21 22:39 ` [PATCH bpf-next v7 5/9] bpf, x86: enable KASAN for JITed programs on x86 Alexis Lothoré (eBPF Foundation)
2026-08-21 22:39 ` [PATCH bpf-next v7 6/9] selftests/bpf: make cmdline_contains stricter Alexis Lothoré (eBPF Foundation)
2026-08-21 22:39 ` [PATCH bpf-next v7 7/9] selftests/bpf: add helpers for KASAN in JIT testing Alexis Lothoré (eBPF Foundation)
2026-08-21 22:39 ` [PATCH bpf-next v7 8/9] selftests/bpf: move bpf_jit_harden helper into testing_helpers Alexis Lothoré (eBPF Foundation)
2026-08-21 23:13   ` bot+bpf-ci
2026-08-21 22:39 ` [PATCH bpf-next v7 9/9] selftests/bpf: add tests to validate KASAN on JIT programs Alexis Lothoré (eBPF Foundation)
2026-08-21 23:36   ` bot+bpf-ci
2026-08-23 22:40   ` Kumar Kartikeya Dwivedi
2026-08-23 22:53     ` Kumar Kartikeya Dwivedi
2026-08-26 18:19       ` Alexis Lothoré
2026-08-23 22:53 ` [PATCH bpf-next v7 0/9] bpf: add support for KASAN checks in JITed programs Kumar Kartikeya Dwivedi
2026-08-26 21:00   ` Ihor Solodrai
2026-08-27  7:01     ` Alexis Lothoré [this message]
2026-08-27 16:56       ` Ihor Solodrai
2026-08-27 16:59         ` Ihor Solodrai
2026-08-27 20:18           ` Alexis Lothoré

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=DKZJ7GFLAU12.1WHACTBREQQV2@bootlin.com \
    --to=alexis.lothore@bootlin.com \
    --cc=andreyknvl@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bastien.curutchet@bootlin.com \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=ebpf@linuxfoundation.org \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=hpa@zytor.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=mingo@redhat.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tglx@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=x86@kernel.org \
    --cc=yonghong.song@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