]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: Test invalid narrower ctx load
authorPaul Chaignon <paul.chaignon@gmail.com>
Tue, 22 Jul 2025 14:33:37 +0000 (16:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:18:51 +0000 (11:18 +0100)
commit2d402c6cc966e65e51f6ddc5e291daf38c76d4e4
treed34227f377c9690589c6b3d8afb65c95a518b650
parent058a0da4f6d916a79b693384111bb80a90d73763
selftests/bpf: Test invalid narrower ctx load

commit ba578b87fe2beef95b37264f8a98c0b505b93de9 upstream.

This patch adds selftests to cover invalid narrower loads on the
context. These used to cause kernel warnings before the previous patch.
To trigger the warning, the load had to be aligned, to read an affected
context field (ex., skb->sk), and not starting at the beginning of the
field.

The nine new cases all fail without the previous patch.

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://patch.msgid.link/44cd83ea9c6868079943f0a436c6efa850528cc1.1753194596.git.paul.chaignon@gmail.com
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/bpf/progs/verifier_ctx.c