Skip to content

Commit

Permalink
selftests/bpf: Add test for narrow spill into 64-bit spilled scalar
Browse files Browse the repository at this point in the history
Add a test case to verify that without CAP_PERFMON, the test now
succeeds instead of failing due to a verification error.

Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>
  • Loading branch information
kkdwivedi authored and Kernel Patches Daemon committed Nov 27, 2024
1 parent eed72bc commit 65ddea5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tools/testing/selftests/bpf/progs/verifier_stack_noperfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,18 @@ __naked void stack_noperfmon_rejecte_invalid_read(void)
exit; \
" ::: __clobber_all);
}

SEC("socket")
__description("stack_noperfmon: narrow spill onto 64-bit scalar spilled slots")
__success
__naked void stack_noperfmon_spill_32bit_onto_64bit_slot(void)
{
asm volatile(" \
*(u64*)(r10 - 8) = 1; \
*(u32*)(r10 - 8) = 1; \
r0 = 0; \
exit; \
" :
:
: __clobber_all);
}

0 comments on commit 65ddea5

Please sign in to comment.