The problem on 4.15 kernels is due to the backport of:
5028027844cf bpf: test_maps, only support ESTABLISHED socks
that only touches the test, without the respective fixes in the kernel.
Here is the list of Fixes for 1aa12bdf1bfb ("bpf: sockmap, add sock close() hook to remove socks"):
5028027844cf bpf: test_maps, only support ESTABLISHED socks
b05545e15e1f bpf: sockmap, fix transition through disconnect without close
5607fff30363 bpf: sockmap only allow ESTABLISHED sock state
90545cdc3f2b tcp, ulp: fix leftover icsk_ulp_ops preventing sock from reattach
7ebc14d507b4 bpf: sockmap, consume_skb in close path
952fad8e3239 bpf: fix sock_map_alloc() error path
Bionic has only backported the selftests one and the icsk_ulp one.
To make the test pass, I believe at least 5607fff30363 would be necessary.
But it seems worth to also investigate the need for the other 3 (they seem worthy from a first look).
The problem on 4.15 kernels is due to the backport of:
5028027844cf bpf: test_maps, only support ESTABLISHED socks
that only touches the test, without the respective fixes in the kernel.
Here is the list of Fixes for 1aa12bdf1bfb ("bpf: sockmap, add sock close() hook to remove socks"):
5028027844cf bpf: test_maps, only support ESTABLISHED socks
b05545e15e1f bpf: sockmap, fix transition through disconnect without close
5607fff30363 bpf: sockmap only allow ESTABLISHED sock state
90545cdc3f2b tcp, ulp: fix leftover icsk_ulp_ops preventing sock from reattach
7ebc14d507b4 bpf: sockmap, consume_skb in close path
952fad8e3239 bpf: fix sock_map_alloc() error path
Bionic has only backported the selftests one and the icsk_ulp one.
To make the test pass, I believe at least 5607fff30363 would be necessary.
But it seems worth to also investigate the need for the other 3 (they seem worthy from a first look).
Cascardo.