Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/bpf: Fix unmap bug in prog_tests/xdp_metadata.c

The function close_xsk() unmap via munmap() the wrong memory pointer.
The call xsk_umem__delete(xsk->umem) have already freed xsk->umem.
Thus the call to munmap(xsk->umem, UMEM_SIZE) will have unpredictable
behavior that can lead to Segmentation fault elsewhere, as man page
explain subsequent references to these pages will generate SIGSEGV.

Fixes: e2a46d54d7a1 ("selftests/bpf: Verify xdp_metadata xdp->af_xdp path")
Reported-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/167527517464.938135.13750760520577765269.stgit@firesoul

authored by

Jesper Dangaard Brouer and committed by
Daniel Borkmann
f2922f77 36b0fb13

+1 -1
+1 -1
tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
··· 121 121 xsk_umem__delete(xsk->umem); 122 122 if (xsk->socket) 123 123 xsk_socket__delete(xsk->socket); 124 - munmap(xsk->umem, UMEM_SIZE); 124 + munmap(xsk->umem_area, UMEM_SIZE); 125 125 } 126 126 127 127 static void ip_csum(struct iphdr *iph)