Commit c4340c38 authored by Jakub Sitnicki's avatar Jakub Sitnicki Committed by Zheng Zengkai
Browse files

selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads

stable inclusion
from stable-v5.10.136
commit 042fb1c281f357d58308366b5e2ddd8e5f1ad384
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5ZWNE

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=042fb1c281f357d58308366b5e2ddd8e5f1ad384



--------------------------------

commit 8f50f16f 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: default avatarJakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/r/20220130115518.213259-3-jakub@cloudflare.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
[OP: backport to 5.10: adjusted context in sock_fields.c]
Signed-off-by: default avatarOvidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
parent 8545bb11
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment