On Mon, Aug 01, 2022 at 05:57:02PM +0300, Ovidiu Panait wrote:
From: Jakub Sitnicki jakub@cloudflare.com
commit 8f50f16ff39dd4e2d43d1548ca66925652f8aff7 upstream.
Add coverage to the verifier tests and tests for reading bpf_sock fields to ensure that 32-bit, 16-bit, and 8-bit loads from dst_port field are allowed only at intended offsets and produce expected values.
While 16-bit and 8-bit access to dst_port field is straight-forward, 32-bit wide loads need be allowed and produce a zero-padded 16-bit value for backward compatibility.
Signed-off-by: Jakub Sitnicki jakub@cloudflare.com Link: https://lore.kernel.org/r/20220130115518.213259-3-jakub@cloudflare.com Signed-off-by: Alexei Starovoitov ast@kernel.org [OP: backport to 5.10: adjusted context in sock_fields.c] Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com
This series fixes the following bpf verfier selftest failures: root@intel-x86-64:~# ./test_verifier ... #908/u sk_fullsock(skb->sk): sk->dst_port [load 2nd byte] FAIL #908/p sk_fullsock(skb->sk): sk->dst_port [load 2nd byte] FAIL
All now queued up, thanks.
gre gk-h