diff options
| author | Alexei Starovoitov <ast@fb.com> | 2017-03-24 15:57:33 -0700 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2022-04-19 00:50:45 +0300 |
| commit | 2942b407cb3276ce74630480676854b19ebb619a (patch) | |
| tree | 7d42c2ca2d2b1ee48bfc4ba6ade33bf942c12e3f /kernel/fork.c | |
| parent | 82ee5b153fa544f475c2e00e330990ca1d94c4fc (diff) | |
bpf: improve verifier packet range checks
[ Upstream commit b1977682a3858b5584ffea7cfb7bd863f68db18d ]
llvm can optimize the 'if (ptr > data_end)' checks to be in the order
slightly different than the original C code which will confuse verifier.
Like:
if (ptr + 16 > data_end)
return TC_ACT_SHOT;
// may be followed by
if (ptr + 14 > data_end)
return TC_ACT_SHOT;
while llvm can see that 'ptr' is valid for all 16 bytes,
the verifier could not.
Fix verifier logic to account for such case and add a test.
Reported-by: Huapeng Zhou <hzhou@fb.com>
Fixes: 969bf05eb3ce ("bpf: direct packet access")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chatur27 <jasonbright2709@gmail.com>
Diffstat (limited to 'kernel/fork.c')
0 files changed, 0 insertions, 0 deletions
