public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RFC bpf-next 6/8] selftests/bpf: do not run verifier JIT tests when BPF_JIT_KASAN is enabled
Date: Sat, 25 Apr 2026 06:21:42 +0000	[thread overview]
Message-ID: <20260425062143.81A9EC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260413-kasan-v1-6-1a5831230821@bootlin.com>

Sashiko AI review found 3 potential issue(s):
- [High] get_kasan_jit_enabled() unconditionally returns true, incorrectly skipping JIT verifier tests on all kernels.
- [Medium] Repeated, uncached parsing of the compressed kernel config file for every JIT test drastically degrades test execution performance.
- [Medium] Aborting the entire subtest when KASAN JIT is enabled unnecessarily drops unrelated test coverage.
--

commit a6c1eb256b8f5c1306ecd153f22c3c278b50ae23
Author: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>

selftests/bpf: do not run verifier JIT tests when BPF_JIT_KASAN is enabled

This commit aims to skip BPF verifier tests that check exact JIT instructions
when the kernel is built with KASAN and JIT enabled, since the inserted KASAN
instrumentation breaks exact instruction matching.

> diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c
> --- a/tools/testing/selftests/bpf/test_loader.c
> +++ b/tools/testing/selftests/bpf/test_loader.c
[ ... ]
> @@ -1175,6 +1175,11 @@ void run_subtest(struct test_loader *tester,
>  		return;
>  	}
>  
> +	if (is_jit_enabled() && subspec->jited.cnt && get_kasan_jit_enabled()) {
> +		test__skip();
> +		return;
> +	}
> +

By returning early here, does this code unnecessarily skip other valuable
validations? While KASAN breaks the exact JIT instruction check, skipping
the entire subtest drops coverage for program loading, verifier log checks,
and translated instruction validations. Could the skip logic bypass only the
later JIT verification block instead of aborting the whole subtest?

Also, does this repeated execution degrade test suite performance?
get_kasan_jit_enabled() is called here for every subtest with JIT assertions,
which will repeatedly open, decompress, and parse the kernel config file.
Could the config check result be cached in a static variable instead?

> diff --git a/tools/testing/selftests/bpf/unpriv_helpers.c b/tools/testing/selftests/bpf/unpriv_helpers.c
> --- a/tools/testing/selftests/bpf/unpriv_helpers.c
> +++ b/tools/testing/selftests/bpf/unpriv_helpers.c
[ ... ]
> @@ -142,3 +142,8 @@ bool get_unpriv_disabled(void)
>  	}
>  	return mitigations_off;
>  }
> +
> +bool get_kasan_jit_enabled(void)
> +{
> +	return config_contains("CONFIG_BPF_JIT_KASAN=y");
> +}

Does this code unconditionally evaluate to true on all kernels?

The config_contains() function returns 1 if the target string is found, and
-1 if the end of the file is reached without finding it. Since both non-zero
integer values evaluate to true when cast to bool, it appears this will
cause the framework to skip the tests even when KASAN is disabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260413-kasan-v1-0-1a5831230821@bootlin.com?part=6

  reply	other threads:[~2026-04-25  6:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 18:28 [PATCH RFC bpf-next 0/8] bpf: add support for KASAN checks in JITed programs Alexis Lothoré (eBPF Foundation)
2026-04-13 18:28 ` [PATCH RFC bpf-next 1/8] kasan: expose generic kasan helpers Alexis Lothoré (eBPF Foundation)
2026-04-13 22:19   ` Andrey Konovalov
2026-04-14 13:12     ` Alexis Lothoré
2026-04-14 14:36       ` Alexei Starovoitov
2026-04-14 15:10         ` Andrey Konovalov
2026-04-14 15:58           ` Alexei Starovoitov
2026-04-19 21:48             ` Andrey Konovalov
2026-04-19 22:51               ` Alexei Starovoitov
2026-04-20 14:27                 ` Alexis Lothoré
2026-04-24 23:31                 ` Ihor Solodrai
2026-04-14 18:41         ` Alexis Lothoré
2026-04-14 19:16           ` Alexei Starovoitov
2026-04-14 20:44             ` Alexis Lothoré
2026-04-25  3:13   ` sashiko-bot
2026-04-13 18:28 ` [PATCH RFC bpf-next 2/8] bpf: mark instructions accessing program stack Alexis Lothoré (eBPF Foundation)
2026-04-24 23:18   ` Ihor Solodrai
2026-04-25  5:05   ` sashiko-bot
2026-04-13 18:28 ` [PATCH RFC bpf-next 3/8] bpf: add BPF_JIT_KASAN for KASAN instrumentation of JITed programs Alexis Lothoré (eBPF Foundation)
2026-04-13 22:20   ` Andrey Konovalov
2026-04-14 13:24     ` Alexis Lothoré
2026-04-14 14:38       ` Alexei Starovoitov
2026-04-25  5:18   ` sashiko-bot
2026-04-13 18:28 ` [PATCH RFC bpf-next 4/8] bpf, x86: add helper to emit kasan checks in x86 " Alexis Lothoré (eBPF Foundation)
2026-04-25  5:46   ` sashiko-bot
2026-04-13 18:28 ` [PATCH RFC bpf-next 5/8] bpf, x86: emit KASAN checks into " Alexis Lothoré (eBPF Foundation)
2026-04-25  6:08   ` sashiko-bot
2026-04-13 18:28 ` [PATCH RFC bpf-next 6/8] selftests/bpf: do not run verifier JIT tests when BPF_JIT_KASAN is enabled Alexis Lothoré (eBPF Foundation)
2026-04-25  6:21   ` sashiko-bot [this message]
2026-04-13 18:28 ` [PATCH RFC bpf-next 7/8] bpf, x86: enable KASAN for JITed programs on x86 Alexis Lothoré (eBPF Foundation)
2026-04-25  6:33   ` sashiko-bot
2026-04-13 18:28 ` [PATCH RFC bpf-next 8/8] selftests/bpf: add tests to validate KASAN on JIT programs Alexis Lothoré (eBPF Foundation)
2026-04-13 22:20   ` Andrey Konovalov
2026-04-14 13:43     ` Alexis Lothoré
2026-04-25  6:50   ` sashiko-bot
2026-04-24 23:10 ` [PATCH RFC bpf-next 0/8] bpf: add support for KASAN checks in JITed programs Ihor Solodrai
2026-04-24 23:28   ` Alexei Starovoitov
2026-04-27  8:54     ` Alexis Lothoré
2026-04-27  8:45   ` 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=20260425062143.81A9EC2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexis.lothore@bootlin.com \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko@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