]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
bpf: Add xdp.frame_sz in bpf_prog_test_run_xdp().
authorJesper Dangaard Brouer <brouer@redhat.com>
Thu, 14 May 2020 10:51:35 +0000 (12:51 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 15 May 2020 04:21:56 +0000 (21:21 -0700)
commitbc56c919fce782f616823b76fb70a788f4762cf5
treeeaeac8cc29065dac36ceda034db0a102dfd4605b
parentddb47d518ca10948d1f64a983cb9274720f691cd
bpf: Add xdp.frame_sz in bpf_prog_test_run_xdp().

Update the memory requirements, when adding xdp.frame_sz in BPF test_run
function bpf_prog_test_run_xdp() which e.g. is used by XDP selftests.

Specifically add the expected reserved tailroom, but also allocated a
larger memory area to reflect that XDP frames usually comes in this
format. Limit the provided packet data size to 4096 minus headroom +
tailroom, as this also reflect a common 3520 bytes MTU limit with XDP.

Note that bpf_test_init already use a memory allocation method that clears
memory.  Thus, this already guards against leaking uninit kernel memory.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/158945349549.97035.15316291762482444006.stgit@firesoul
net/bpf/test_run.c