Skip to content

xsk: remove internal DMA headers - #171

Closed
kernel-patches-bot wants to merge 2 commits into
bpf-nextfrom
series/359643=>bpf-next
Closed

kernel-patches-bot wants to merge 2 commits into
bpf-nextfrom
series/359643=>bpf-next

Conversation

@kernel-patches-bot

Copy link
Copy Markdown

Pull request for series with
subject: xsk: remove internal DMA headers
version: 1
url: https://patchwork.kernel.org/project/bpf/list/?series=359643

kernel-patches-bot and others added 2 commits October 5, 2020 02:09
Christoph Hellwig correctly pointed out [1] that the AF_XDP core was
pointlessly including internal headers. Let us remove those includes.

[1] https://lore.kernel.org/bpf/[email protected]/

Reported-by: Christoph Hellwig <[email protected]>
Fixes: 1c1efc2 ("xsk: Create and free buffer pool independently from umem")
Signed-off-by: Björn Töpel <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot

Copy link
Copy Markdown
Author

@kernel-patches-bot
kernel-patches-bot deleted the series/359643=>bpf-next branch October 7, 2020 01:45
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 7, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 7, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 8, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 8, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 9, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 9, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 10, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 10, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Dec 10, 2023
Currently, there are two test cases with same name
"ALU64_SMOD_X: -7 % 2 = -1", the first one is right,
the second one should be ALU64_SMOD_K because its
code is BPF_ALU64 | BPF_MOD | BPF_K.

Before:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS

After:
test_bpf: #170 ALU64_SMOD_X: -7 % 2 = -1 jited:1 4 PASS
test_bpf: #171 ALU64_SMOD_K: -7 % 2 = -1 jited:1 4 PASS

Fixes: daabb2b ("bpf/tests: add tests for cpuv4 instructions")
Signed-off-by: Tiezhu Yang <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request May 31, 2024
AudioMix BLK-CTRL on i.MX8MP encountered an accessing register issue
after power up.

[    2.181035] Kernel panic - not syncing: Asynchronous SError Interrupt
[    2.181038] CPU: 1 PID: 48 Comm: kworker/u16:2 Not tainted 6.9.0-rc5-next-20240424-00003-g21cec88845c6 #171
[    2.181047] Hardware name: NXP i.MX8MPlus EVK board (DT)
[    2.181050] Workqueue: events_unbound deferred_probe_work_func
[    2.181064] Call trace:
[...]
[    2.181142]  arm64_serror_panic+0x6c/0x78
[    2.181149]  do_serror+0x3c/0x70
[    2.181157]  el1h_64_error_handler+0x30/0x48
[    2.181164]  el1h_64_error+0x64/0x68
[    2.181171]  clk_imx8mp_audiomix_runtime_resume+0x34/0x44
[    2.181183]  __genpd_runtime_resume+0x30/0x80
[    2.181195]  genpd_runtime_resume+0x110/0x244
[    2.181205]  __rpm_callback+0x48/0x1d8
[    2.181213]  rpm_callback+0x68/0x74
[    2.181224]  rpm_resume+0x468/0x6c0
[    2.181234]  __pm_runtime_resume+0x50/0x94
[    2.181243]  pm_runtime_get_suppliers+0x60/0x8c
[    2.181258]  __driver_probe_device+0x48/0x12c
[    2.181268]  driver_probe_device+0xd8/0x15c
[    2.181278]  __device_attach_driver+0xb8/0x134
[    2.181290]  bus_for_each_drv+0x84/0xe0
[    2.181302]  __device_attach+0x9c/0x188
[    2.181312]  device_initial_probe+0x14/0x20
[    2.181323]  bus_probe_device+0xac/0xb0
[    2.181334]  deferred_probe_work_func+0x88/0xc0
[    2.181344]  process_one_work+0x150/0x290
[    2.181357]  worker_thread+0x2f8/0x408
[    2.181370]  kthread+0x110/0x114
[    2.181381]  ret_from_fork+0x10/0x20
[    2.181391] SMP: stopping secondary CPUs

According to comments in power up handshake:

	/* request the ADB400 to power up */
	if (domain->bits.hskreq) {
		regmap_update_bits(domain->regmap, domain->regs->hsk,
				   domain->bits.hskreq, domain->bits.hskreq);

		/*
		 * ret = regmap_read_poll_timeout(domain->regmap, domain->regs->hsk, reg_val,
		 *				  (reg_val & domain->bits.hskack), 0,
		 *				  USEC_PER_MSEC);
		 * Technically we need the commented code to wait handshake. But that needs
		 * the BLK-CTL module BUS clk-en bit being set.
		 *
		 * There is a separate BLK-CTL module and we will have such a driver for it,
		 * that driver will set the BUS clk-en bit and handshake will be triggered
		 * automatically there. Just add a delay and suppose the handshake finish
		 * after that.
		 */
	}

The BLK-CTL module needs to add delay to wait for a handshake request finished.
For some BLK-CTL module (eg. AudioMix on i.MX8MP) doesn't have BUS clk-en
bit, it is better to add delay in this driver, as the BLK-CTL module doesn't
need to care about how it is powered up.

regmap_read_bypassed() is to make sure the above write IO transaction already
reaches target before udelay().

Fixes: 1496dd4 ("clk: imx: imx8mp: Add pm_runtime support for power saving")
Reported-by: Francesco Dolcini <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Suggested-by: Frank Li <[email protected]>
Signed-off-by: Shengjiu Wang <[email protected]>
Tested-by: Adam Ford <[email protected]>
Tested-by: Alexander Stein <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Jan 14, 2026
When loading guest XSAVE state via KVM_SET_XSAVE, and when updating XFD in
response to a guest WRMSR, clear XFD-disabled features in the saved (or to
be restored) XSTATE_BV to ensure KVM doesn't attempt to load state for
features that are disabled via the guest's XFD.  Because the kernel
executes XRSTOR with the guest's XFD, saving XSTATE_BV[i]=1 with XFD[i]=1
will cause XRSTOR to #NM and panic the kernel.

E.g. if fpu_update_guest_xfd() sets XFD without clearing XSTATE_BV:

  ------------[ cut here ]------------
  WARNING: arch/x86/kernel/traps.c:1524 at exc_device_not_available+0x101/0x110, CPU#29: amx_test/848
  Modules linked in: kvm_intel kvm irqbypass
  CPU: 29 UID: 1000 PID: 848 Comm: amx_test Not tainted 6.19.0-rc2-ffa07f7fd437-x86_amx_nm_xfd_non_init-vm #171 NONE
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:exc_device_not_available+0x101/0x110
  Call Trace:
   <TASK>
   asm_exc_device_not_available+0x1a/0x20
  RIP: 0010:restore_fpregs_from_fpstate+0x36/0x90
   switch_fpu_return+0x4a/0xb0
   kvm_arch_vcpu_ioctl_run+0x1245/0x1e40 [kvm]
   kvm_vcpu_ioctl+0x2c3/0x8f0 [kvm]
   __x64_sys_ioctl+0x8f/0xd0
   do_syscall_64+0x62/0x940
   entry_SYSCALL_64_after_hwframe+0x4b/0x53
   </TASK>
  ---[ end trace 0000000000000000 ]---

This can happen if the guest executes WRMSR(MSR_IA32_XFD) to set XFD[18] = 1,
and a host IRQ triggers kernel_fpu_begin() prior to the vmexit handler's
call to fpu_update_guest_xfd().

and if userspace stuffs XSTATE_BV[i]=1 via KVM_SET_XSAVE:

  ------------[ cut here ]------------
  WARNING: arch/x86/kernel/traps.c:1524 at exc_device_not_available+0x101/0x110, CPU#14: amx_test/867
  Modules linked in: kvm_intel kvm irqbypass
  CPU: 14 UID: 1000 PID: 867 Comm: amx_test Not tainted 6.19.0-rc2-2dace9faccd6-x86_amx_nm_xfd_non_init-vm #168 NONE
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  RIP: 0010:exc_device_not_available+0x101/0x110
  Call Trace:
   <TASK>
   asm_exc_device_not_available+0x1a/0x20
  RIP: 0010:restore_fpregs_from_fpstate+0x36/0x90
   fpu_swap_kvm_fpstate+0x6b/0x120
   kvm_load_guest_fpu+0x30/0x80 [kvm]
   kvm_arch_vcpu_ioctl_run+0x85/0x1e40 [kvm]
   kvm_vcpu_ioctl+0x2c3/0x8f0 [kvm]
   __x64_sys_ioctl+0x8f/0xd0
   do_syscall_64+0x62/0x940
   entry_SYSCALL_64_after_hwframe+0x4b/0x53
   </TASK>
  ---[ end trace 0000000000000000 ]---

The new behavior is consistent with the AMX architecture.  Per Intel's SDM,
XSAVE saves XSTATE_BV as '0' for components that are disabled via XFD
(and non-compacted XSAVE saves the initial configuration of the state
component):

  If XSAVE, XSAVEC, XSAVEOPT, or XSAVES is saving the state component i,
  the instruction does not generate #NM when XCR0[i] = IA32_XFD[i] = 1;
  instead, it operates as if XINUSE[i] = 0 (and the state component was
  in its initial state): it saves bit i of XSTATE_BV field of the XSAVE
  header as 0; in addition, XSAVE saves the initial configuration of the
  state component (the other instructions do not save state component i).

Alternatively, KVM could always do XRSTOR with XFD=0, e.g. by using
a constant XFD based on the set of enabled features when XSAVEing for
a struct fpu_guest.  However, having XSTATE_BV[i]=1 for XFD-disabled
features can only happen in the above interrupt case, or in similar
scenarios involving preemption on preemptible kernels, because
fpu_swap_kvm_fpstate()'s call to save_fpregs_to_fpstate() saves the
outgoing FPU state with the current XFD; and that is (on all but the
first WRMSR to XFD) the guest XFD.

Therefore, XFD can only go out of sync with XSTATE_BV in the above
interrupt case, or in similar scenarios involving preemption on
preemptible kernels, and it we can consider it (de facto) part of KVM
ABI that KVM_GET_XSAVE returns XSTATE_BV[i]=0 for XFD-disabled features.

Reported-by: Paolo Bonzini <[email protected]>
Cc: [email protected]
Fixes: 820a6ee ("kvm: x86: Add emulation for IA32_XFD", 2022-01-14)
Signed-off-by: Sean Christopherson <[email protected]>
[Move clearing of XSTATE_BV from fpu_copy_uabi_to_guest_fpstate
 to kvm_vcpu_ioctl_x86_set_xsave. - Paolo]
Reviewed-by: Binbin Wu <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Tropicao added a commit to Tropicao/bpf that referenced this pull request Jul 23, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  kernel-patches#171/1   kasan/st_1_not_on_stack:OK
  kernel-patches#171/2   kasan/st_1_on_stack:OK
  kernel-patches#171/3   kasan/st_2_not_on_stack:OK
  kernel-patches#171/4   kasan/st_2_on_stack:OK
  kernel-patches#171/5   kasan/st_4_not_on_stack:OK
  kernel-patches#171/6   kasan/st_4_on_stack:OK
  kernel-patches#171/7   kasan/st_8_not_on_stack:OK
  kernel-patches#171/8   kasan/st_8_on_stack:OK
  kernel-patches#171/9   kasan/stx_1_not_on_stack:OK
  kernel-patches#171/10  kasan/stx_1_on_stack:OK
  kernel-patches#171/11  kasan/stx_2_not_on_stack:OK
  kernel-patches#171/12  kasan/stx_2_on_stack:OK
  kernel-patches#171/13  kasan/stx_4_not_on_stack:OK
  kernel-patches#171/14  kasan/stx_4_on_stack:OK
  kernel-patches#171/15  kasan/stx_8_not_on_stack:OK
  kernel-patches#171/16  kasan/stx_8_on_stack:OK
  kernel-patches#171/17  kasan/ldx_1_not_on_stack:OK
  kernel-patches#171/18  kasan/ldx_1_on_stack:OK
  kernel-patches#171/19  kasan/ldx_2_not_on_stack:OK
  kernel-patches#171/20  kasan/ldx_2_on_stack:OK
  kernel-patches#171/21  kasan/ldx_4_not_on_stack:OK
  kernel-patches#171/22  kasan/ldx_4_on_stack:OK
  kernel-patches#171/23  kasan/ldx_8_not_on_stack:OK
  kernel-patches#171/24  kasan/ldx_8_on_stack:OK
  kernel-patches#171/25  kasan/simple_atomic_4_not_on_stack:OK
  kernel-patches#171/26  kasan/simple_atomic_4_on_stack:OK
  kernel-patches#171/27  kasan/simple_atomic_8_not_on_stack:OK
  kernel-patches#171/28  kasan/simple_atomic_8_on_stack:OK
  kernel-patches#171/29  kasan/simple_atomic_fetch:OK
  kernel-patches#171/30  kasan/simple_atomic_fetch:OK
  kernel-patches#171/31  kasan/load_acquire_1_not_on_stack:SKIP
  kernel-patches#171/32  kasan/load_acquire_1_on_stack:SKIP
  kernel-patches#171/33  kasan/load_acquire_2_not_on_stack:SKIP
  kernel-patches#171/34  kasan/load_acquire_2_on_stack:SKIP
  kernel-patches#171/35  kasan/load_acquire_4_not_on_stack:SKIP
  kernel-patches#171/36  kasan/load_acquire_4_on_stack:SKIP
  kernel-patches#171/37  kasan/load_acquire_8_not_on_stack:SKIP
  kernel-patches#171/38  kasan/load_acquire_8_on_stack:SKIP
  kernel-patches#171/39  kasan/store_release_1_not_on_stack:SKIP
  kernel-patches#171/40  kasan/store_release_1_on_stack:SKIP
  kernel-patches#171/41  kasan/store_release_2_not_on_stack:SKIP
  kernel-patches#171/42  kasan/store_release_2_on_stack:SKIP
  kernel-patches#171/43  kasan/store_release_4_not_on_stack:SKIP
  kernel-patches#171/44  kasan/store_release_4_on_stack:SKIP
  kernel-patches#171/45  kasan/store_release_8_not_on_stack:SKIP
  kernel-patches#171/46  kasan/store_release_8_on_stack:SKIP
  kernel-patches#171/47  kasan/ldx_patched:OK
  kernel-patches#171/48  kasan/ldx_patched:OK
  kernel-patches#171/49  kasan/verifier_paths_stack_and_non_stack:OK
  kernel-patches#171/50  kasan/ldx_oob_1_not_on_stack:OK
  kernel-patches#171/51  kasan/ldx_oob_2_not_on_stack:OK
  kernel-patches#171/52  kasan/ldx_oob_4_not_on_stack:OK
  kernel-patches#171/53  kasan/ldx_oob_8_not_on_stack:OK
  kernel-patches#171/54  kasan/st_blinded:OK
  kernel-patches#171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
---
Changes in v6:
- rename test struct in kasan program
- add oob testing
- add atomic fetch tests
- refactor a bit the test runner so that ldx_patched tests are not
  treated as special cases

Changes in v5:
- check snprintf return codes when checking kernel logs
- skip tests in kasan_multi_shot is not enabled
- update simple atomic test expected access type (read -> write)

Changes in v4:
- prevent interleaved kernel logs from breaking kasan report search
- make new kfuncs in bpf_testmod depend on BPF_JIT_KASAN rather than
  KASAN_GENERIC
- initialize buffer passed to bpf_prog_test_run_opts

Changes in v3:
- increase kernel log buffer size
- fix comment style
- check bpf_program__fd return code
- document kasan_multi_shot
- fix copy-paste mistakes on poisoning/unpoisoning sequences
- add test for patch due to constant blinding

Changes in v2:
- simplify tests by just manually poisoning test areas with a dedicated
  kfunc
- introduce one prog per covered instruction family
- make sure that tests do not consume kernel logs (use /dev/kmgs rather
  than klogctl)
- add tests for stack accesses:
  - marking correctly set when there are diverging verifier states
    leading to different memory types
  - marking kept in sync with prog when it is patched
Tropicao added a commit to Tropicao/bpf that referenced this pull request Jul 23, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  kernel-patches#171/1   kasan/st_1_not_on_stack:OK
  kernel-patches#171/2   kasan/st_1_on_stack:OK
  kernel-patches#171/3   kasan/st_2_not_on_stack:OK
  kernel-patches#171/4   kasan/st_2_on_stack:OK
  kernel-patches#171/5   kasan/st_4_not_on_stack:OK
  kernel-patches#171/6   kasan/st_4_on_stack:OK
  kernel-patches#171/7   kasan/st_8_not_on_stack:OK
  kernel-patches#171/8   kasan/st_8_on_stack:OK
  kernel-patches#171/9   kasan/stx_1_not_on_stack:OK
  kernel-patches#171/10  kasan/stx_1_on_stack:OK
  kernel-patches#171/11  kasan/stx_2_not_on_stack:OK
  kernel-patches#171/12  kasan/stx_2_on_stack:OK
  kernel-patches#171/13  kasan/stx_4_not_on_stack:OK
  kernel-patches#171/14  kasan/stx_4_on_stack:OK
  kernel-patches#171/15  kasan/stx_8_not_on_stack:OK
  kernel-patches#171/16  kasan/stx_8_on_stack:OK
  kernel-patches#171/17  kasan/ldx_1_not_on_stack:OK
  kernel-patches#171/18  kasan/ldx_1_on_stack:OK
  kernel-patches#171/19  kasan/ldx_2_not_on_stack:OK
  kernel-patches#171/20  kasan/ldx_2_on_stack:OK
  kernel-patches#171/21  kasan/ldx_4_not_on_stack:OK
  kernel-patches#171/22  kasan/ldx_4_on_stack:OK
  kernel-patches#171/23  kasan/ldx_8_not_on_stack:OK
  kernel-patches#171/24  kasan/ldx_8_on_stack:OK
  kernel-patches#171/25  kasan/simple_atomic_4_not_on_stack:OK
  kernel-patches#171/26  kasan/simple_atomic_4_on_stack:OK
  kernel-patches#171/27  kasan/simple_atomic_8_not_on_stack:OK
  kernel-patches#171/28  kasan/simple_atomic_8_on_stack:OK
  kernel-patches#171/29  kasan/simple_atomic_fetch:OK
  kernel-patches#171/30  kasan/simple_atomic_fetch:OK
  kernel-patches#171/31  kasan/load_acquire_1_not_on_stack:SKIP
  kernel-patches#171/32  kasan/load_acquire_1_on_stack:SKIP
  kernel-patches#171/33  kasan/load_acquire_2_not_on_stack:SKIP
  kernel-patches#171/34  kasan/load_acquire_2_on_stack:SKIP
  kernel-patches#171/35  kasan/load_acquire_4_not_on_stack:SKIP
  kernel-patches#171/36  kasan/load_acquire_4_on_stack:SKIP
  kernel-patches#171/37  kasan/load_acquire_8_not_on_stack:SKIP
  kernel-patches#171/38  kasan/load_acquire_8_on_stack:SKIP
  kernel-patches#171/39  kasan/store_release_1_not_on_stack:SKIP
  kernel-patches#171/40  kasan/store_release_1_on_stack:SKIP
  kernel-patches#171/41  kasan/store_release_2_not_on_stack:SKIP
  kernel-patches#171/42  kasan/store_release_2_on_stack:SKIP
  kernel-patches#171/43  kasan/store_release_4_not_on_stack:SKIP
  kernel-patches#171/44  kasan/store_release_4_on_stack:SKIP
  kernel-patches#171/45  kasan/store_release_8_not_on_stack:SKIP
  kernel-patches#171/46  kasan/store_release_8_on_stack:SKIP
  kernel-patches#171/47  kasan/ldx_patched:OK
  kernel-patches#171/48  kasan/ldx_patched:OK
  kernel-patches#171/49  kasan/verifier_paths_stack_and_non_stack:OK
  kernel-patches#171/50  kasan/ldx_oob_1_not_on_stack:OK
  kernel-patches#171/51  kasan/ldx_oob_2_not_on_stack:OK
  kernel-patches#171/52  kasan/ldx_oob_4_not_on_stack:OK
  kernel-patches#171/53  kasan/ldx_oob_8_not_on_stack:OK
  kernel-patches#171/54  kasan/st_blinded:OK
  kernel-patches#171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
---
Changes in v6:
- rename test struct in kasan program
- add oob testing
- add atomic fetch tests
- refactor a bit the test runner so that ldx_patched tests are not
  treated as special cases

Changes in v5:
- check snprintf return codes when checking kernel logs
- skip tests in kasan_multi_shot is not enabled
- update simple atomic test expected access type (read -> write)

Changes in v4:
- prevent interleaved kernel logs from breaking kasan report search
- make new kfuncs in bpf_testmod depend on BPF_JIT_KASAN rather than
  KASAN_GENERIC
- initialize buffer passed to bpf_prog_test_run_opts

Changes in v3:
- increase kernel log buffer size
- fix comment style
- check bpf_program__fd return code
- document kasan_multi_shot
- fix copy-paste mistakes on poisoning/unpoisoning sequences
- add test for patch due to constant blinding

Changes in v2:
- simplify tests by just manually poisoning test areas with a dedicated
  kfunc
- introduce one prog per covered instruction family
- make sure that tests do not consume kernel logs (use /dev/kmgs rather
  than klogctl)
- add tests for stack accesses:
  - marking correctly set when there are diverging verifier states
    leading to different memory types
  - marking kept in sync with prog when it is patched
Tropicao added a commit to Tropicao/bpf that referenced this pull request Aug 4, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  kernel-patches#171/1   kasan/st_1_not_on_stack:OK
  kernel-patches#171/2   kasan/st_1_on_stack:OK
  kernel-patches#171/3   kasan/st_2_not_on_stack:OK
  kernel-patches#171/4   kasan/st_2_on_stack:OK
  kernel-patches#171/5   kasan/st_4_not_on_stack:OK
  kernel-patches#171/6   kasan/st_4_on_stack:OK
  kernel-patches#171/7   kasan/st_8_not_on_stack:OK
  kernel-patches#171/8   kasan/st_8_on_stack:OK
  kernel-patches#171/9   kasan/stx_1_not_on_stack:OK
  kernel-patches#171/10  kasan/stx_1_on_stack:OK
  kernel-patches#171/11  kasan/stx_2_not_on_stack:OK
  kernel-patches#171/12  kasan/stx_2_on_stack:OK
  kernel-patches#171/13  kasan/stx_4_not_on_stack:OK
  kernel-patches#171/14  kasan/stx_4_on_stack:OK
  kernel-patches#171/15  kasan/stx_8_not_on_stack:OK
  kernel-patches#171/16  kasan/stx_8_on_stack:OK
  kernel-patches#171/17  kasan/ldx_1_not_on_stack:OK
  kernel-patches#171/18  kasan/ldx_1_on_stack:OK
  kernel-patches#171/19  kasan/ldx_2_not_on_stack:OK
  kernel-patches#171/20  kasan/ldx_2_on_stack:OK
  kernel-patches#171/21  kasan/ldx_4_not_on_stack:OK
  kernel-patches#171/22  kasan/ldx_4_on_stack:OK
  kernel-patches#171/23  kasan/ldx_8_not_on_stack:OK
  kernel-patches#171/24  kasan/ldx_8_on_stack:OK
  kernel-patches#171/25  kasan/simple_atomic_4_not_on_stack:OK
  kernel-patches#171/26  kasan/simple_atomic_4_on_stack:OK
  kernel-patches#171/27  kasan/simple_atomic_8_not_on_stack:OK
  kernel-patches#171/28  kasan/simple_atomic_8_on_stack:OK
  kernel-patches#171/29  kasan/simple_atomic_fetch:OK
  kernel-patches#171/30  kasan/simple_atomic_fetch:OK
  kernel-patches#171/31  kasan/load_acquire_1_not_on_stack:SKIP
  kernel-patches#171/32  kasan/load_acquire_1_on_stack:SKIP
  kernel-patches#171/33  kasan/load_acquire_2_not_on_stack:SKIP
  kernel-patches#171/34  kasan/load_acquire_2_on_stack:SKIP
  kernel-patches#171/35  kasan/load_acquire_4_not_on_stack:SKIP
  kernel-patches#171/36  kasan/load_acquire_4_on_stack:SKIP
  kernel-patches#171/37  kasan/load_acquire_8_not_on_stack:SKIP
  kernel-patches#171/38  kasan/load_acquire_8_on_stack:SKIP
  kernel-patches#171/39  kasan/store_release_1_not_on_stack:SKIP
  kernel-patches#171/40  kasan/store_release_1_on_stack:SKIP
  kernel-patches#171/41  kasan/store_release_2_not_on_stack:SKIP
  kernel-patches#171/42  kasan/store_release_2_on_stack:SKIP
  kernel-patches#171/43  kasan/store_release_4_not_on_stack:SKIP
  kernel-patches#171/44  kasan/store_release_4_on_stack:SKIP
  kernel-patches#171/45  kasan/store_release_8_not_on_stack:SKIP
  kernel-patches#171/46  kasan/store_release_8_on_stack:SKIP
  kernel-patches#171/47  kasan/ldx_patched:OK
  kernel-patches#171/48  kasan/ldx_patched:OK
  kernel-patches#171/49  kasan/verifier_paths_stack_and_non_stack:OK
  kernel-patches#171/50  kasan/ldx_oob_1_not_on_stack:OK
  kernel-patches#171/51  kasan/ldx_oob_2_not_on_stack:OK
  kernel-patches#171/52  kasan/ldx_oob_4_not_on_stack:OK
  kernel-patches#171/53  kasan/ldx_oob_8_not_on_stack:OK
  kernel-patches#171/54  kasan/st_blinded:OK
  kernel-patches#171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
---
Changes in v6:
- rename test struct in kasan program
- add oob testing
- add atomic fetch tests
- refactor a bit the test runner so that ldx_patched tests are not
  treated as special cases
- break kernel log reading loop immediately if no bytes are read

Changes in v5:
- check snprintf return codes when checking kernel logs
- skip tests in kasan_multi_shot is not enabled
- update simple atomic test expected access type (read -> write)

Changes in v4:
- prevent interleaved kernel logs from breaking kasan report search
- make new kfuncs in bpf_testmod depend on BPF_JIT_KASAN rather than
  KASAN_GENERIC
- initialize buffer passed to bpf_prog_test_run_opts

Changes in v3:
- increase kernel log buffer size
- fix comment style
- check bpf_program__fd return code
- document kasan_multi_shot
- fix copy-paste mistakes on poisoning/unpoisoning sequences
- add test for patch due to constant blinding

Changes in v2:
- simplify tests by just manually poisoning test areas with a dedicated
  kfunc
- introduce one prog per covered instruction family
- make sure that tests do not consume kernel logs (use /dev/kmgs rather
  than klogctl)
- add tests for stack accesses:
  - marking correctly set when there are diverging verifier states
    leading to different memory types
  - marking kept in sync with prog when it is patched
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 4, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 4, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 5, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 5, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 5, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 5, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 6, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 6, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 6, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 7, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 7, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 7, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 7, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 23, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 23, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 23, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 25, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 25, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
kernel-patches-daemon-bpf Bot pushed a commit that referenced this pull request Aug 25, 2026
Add a basic KASAN test runner that loads and test-run programs that can
trigger memory management bugs. The test captures kernel logs and ensure
that the expected KASAN splat is emitted by searching for the
corresponding first lines in the report, hence validated that the needed
instrumentation has been inserted by the JIT compiler before the
relevant memory accesses. To allow each test to trigger the expected
report, the kernel must run with the kasan_multi_shot configuration.

The runner covers different cases and settings: in the nominal case, it
validates kasan reports on basic instructions (on all supported accesses
sizes) but also when report _should not_ be emitted (eg: for accesses on
program stack). The runner also comes with a few specialized tests that
are then not executed for all sizes/locations:
- specific atomic ops
- test for instructions involving different verifier states, with some
  states flagging memory as stack, and other states as non-stack memory
- tests that validate the stack marking shifting when a patch is emitted
  by the verifier (zext/rnd_hi32, constant blindind).
Most of those tests are able to trigger kasan reports by altering the
shadow memory (triggering faulty accesses is otherwise complex, because
of the verifier). A few tests trigger actual faulty accesses (eg
out-of-bound accesses)

A few of those tests depends on cpuv4 (load_acquire and store_release).

  # ./test_progs -a kasan
  #171/1   kasan/st_1_not_on_stack:OK
  #171/2   kasan/st_1_on_stack:OK
  #171/3   kasan/st_2_not_on_stack:OK
  #171/4   kasan/st_2_on_stack:OK
  #171/5   kasan/st_4_not_on_stack:OK
  #171/6   kasan/st_4_on_stack:OK
  #171/7   kasan/st_8_not_on_stack:OK
  #171/8   kasan/st_8_on_stack:OK
  #171/9   kasan/stx_1_not_on_stack:OK
  #171/10  kasan/stx_1_on_stack:OK
  #171/11  kasan/stx_2_not_on_stack:OK
  #171/12  kasan/stx_2_on_stack:OK
  #171/13  kasan/stx_4_not_on_stack:OK
  #171/14  kasan/stx_4_on_stack:OK
  #171/15  kasan/stx_8_not_on_stack:OK
  #171/16  kasan/stx_8_on_stack:OK
  #171/17  kasan/ldx_1_not_on_stack:OK
  #171/18  kasan/ldx_1_on_stack:OK
  #171/19  kasan/ldx_2_not_on_stack:OK
  #171/20  kasan/ldx_2_on_stack:OK
  #171/21  kasan/ldx_4_not_on_stack:OK
  #171/22  kasan/ldx_4_on_stack:OK
  #171/23  kasan/ldx_8_not_on_stack:OK
  #171/24  kasan/ldx_8_on_stack:OK
  #171/25  kasan/simple_atomic_4_not_on_stack:OK
  #171/26  kasan/simple_atomic_4_on_stack:OK
  #171/27  kasan/simple_atomic_8_not_on_stack:OK
  #171/28  kasan/simple_atomic_8_on_stack:OK
  #171/29  kasan/simple_atomic_fetch:OK
  #171/30  kasan/simple_atomic_fetch:OK
  #171/31  kasan/load_acquire_1_not_on_stack:SKIP
  #171/32  kasan/load_acquire_1_on_stack:SKIP
  #171/33  kasan/load_acquire_2_not_on_stack:SKIP
  #171/34  kasan/load_acquire_2_on_stack:SKIP
  #171/35  kasan/load_acquire_4_not_on_stack:SKIP
  #171/36  kasan/load_acquire_4_on_stack:SKIP
  #171/37  kasan/load_acquire_8_not_on_stack:SKIP
  #171/38  kasan/load_acquire_8_on_stack:SKIP
  #171/39  kasan/store_release_1_not_on_stack:SKIP
  #171/40  kasan/store_release_1_on_stack:SKIP
  #171/41  kasan/store_release_2_not_on_stack:SKIP
  #171/42  kasan/store_release_2_on_stack:SKIP
  #171/43  kasan/store_release_4_not_on_stack:SKIP
  #171/44  kasan/store_release_4_on_stack:SKIP
  #171/45  kasan/store_release_8_not_on_stack:SKIP
  #171/46  kasan/store_release_8_on_stack:SKIP
  #171/47  kasan/ldx_patched:OK
  #171/48  kasan/ldx_patched:OK
  #171/49  kasan/verifier_paths_stack_and_non_stack:OK
  #171/50  kasan/ldx_oob_1_not_on_stack:OK
  #171/51  kasan/ldx_oob_2_not_on_stack:OK
  #171/52  kasan/ldx_oob_4_not_on_stack:OK
  #171/53  kasan/ldx_oob_8_not_on_stack:OK
  #171/54  kasan/st_blinded:OK
  #171     kasan:OK (SKIP: 16/54)
  Summary: 1/38 PASSED, 16 SKIPPED, 0 FAILED

Signed-off-by: Alexis Lothoré (eBPF Foundation) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant