mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 04:12:04 -04:00
UPSTREAM: xdp: Clear grow memory in bpf_xdp_adjust_tail()
Clearing memory of tail when grow happens, because it is too easy to write a XDP_PASS program that extend the tail, which expose this memory to users that can run tcpdump. Change-Id: I9bec93c668c57dcd66104e1f1989f5036f46cec2 Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/158945349039.97035.5262100484553494.stgit@firesoul
This commit is contained in:
parent
14785b0d4d
commit
e9e42f55b9
1 changed files with 4 additions and 0 deletions
|
|
@ -3491,6 +3491,10 @@ BPF_CALL_2(bpf_xdp_adjust_tail, struct xdp_buff *, xdp, int, offset)
|
|||
if (unlikely(data_end < xdp->data + ETH_HLEN))
|
||||
return -EINVAL;
|
||||
|
||||
/* Clear memory area on grow, can contain uninit kernel memory */
|
||||
if (offset > 0)
|
||||
memset(xdp->data_end, 0, offset);
|
||||
|
||||
xdp->data_end = data_end;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue