diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2019-08-20 17:50:25 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-21 07:18:34 +0200 |
commit | f1b6d7c8de4ca31e2d1ae6d4a5a766d940048089 (patch) | |
tree | ebd571eb0b978945e9af791c77385624e17fbfd4 /COPYING | |
parent | 5e0251d82954b488c652befe3f330bacfe0fadce (diff) | |
download | linux-stable-f1b6d7c8de4ca31e2d1ae6d4a5a766d940048089.tar.gz linux-stable-f1b6d7c8de4ca31e2d1ae6d4a5a766d940048089.tar.bz2 linux-stable-f1b6d7c8de4ca31e2d1ae6d4a5a766d940048089.zip |
bpf: allow narrow loads of some sk_reuseport_md fields with offset > 0
[ Upstream commit 2c238177bd7f4b14bdf7447cc1cd9bb791f147e6 ]
test_select_reuseport fails on s390 due to verifier rejecting
test_select_reuseport_kern.o with the following message:
; data_check.eth_protocol = reuse_md->eth_protocol;
18: (69) r1 = *(u16 *)(r6 +22)
invalid bpf_context access off=22 size=2
This is because on big-endian machines casts from __u32 to __u16 are
generated by referencing the respective variable as __u16 with an offset
of 2 (as opposed to 0 on little-endian machines).
The verifier already has all the infrastructure in place to allow such
accesses, it's just that they are not explicitly enabled for
eth_protocol field. Enable them for eth_protocol field by using
bpf_ctx_range instead of offsetof.
Ditto for ip_protocol, bind_inany and len, since they already allow
narrowing, and the same problem can arise when working with them.
Fixes: 2dbb9b9e6df6 ("bpf: Introduce BPF_PROG_TYPE_SK_REUSEPORT")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions