]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
selftests/bpf: Test freeing sockmap/sockhash with a socket in it
authorJakub Sitnicki <jakub@cloudflare.com>
Thu, 6 Feb 2020 11:16:52 +0000 (12:16 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Mon, 17 Feb 2020 11:36:59 +0000 (12:36 +0100)
commitef138203214c6767927e69e1243d19aeafeee753
tree7e3ac83b46de187b50da2a2085b06b6b729ef696
parent6ad0406a107745894643154009cbd99428310296
selftests/bpf: Test freeing sockmap/sockhash with a socket in it

BugLink: https://bugs.launchpad.net/bugs/1863589
commit 5d3919a953c3c96c02fc7a337f8376cde43ae31f upstream.

Commit 7e81a3530206 ("bpf: Sockmap, ensure sock lock held during tear
down") introduced sleeping issues inside RCU critical sections and while
holding a spinlock on sockmap/sockhash tear-down. There has to be at least
one socket in the map for the problem to surface.

This adds a test that triggers the warnings for broken locking rules. Not a
fix per se, but rather tooling to verify the accompanying fixes. Run on a
VM with 1 vCPU to reproduce the warnings.

Fixes: 7e81a3530206 ("bpf: Sockmap, ensure sock lock held during tear down")
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20200206111652.694507-4-jakub@cloudflare.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c [new file with mode: 0644]