]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: test_progs: fix client/server race in tcp_rtt
authorStanislav Fomichev <sdf@google.com>
Mon, 23 Sep 2019 18:41:12 +0000 (11:41 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 25 Sep 2019 20:13:45 +0000 (22:13 +0200)
commit7753d9ee042733f2a4f5c00e868af4b0d85444bc
tree700c5bce7174eb03d2fab2c678216603ac985872
parent96a115661dd7f0675363ac4265cc70c4e4335a40
selftests/bpf: test_progs: fix client/server race in tcp_rtt

This is the same problem I found earlier in test_sockopt_inherit:
there is a race between server thread doing accept() and client
thread doing connect(). Let's explicitly synchronize them via
pthread conditional variable.

v2:
* don't exit from server_thread without signaling condvar,
  fixes possible issue where main() would wait forever (Andrii Nakryiko)

Fixes: 422531b33b66 ("selftests/bpf: test BPF_SOCK_OPS_RTT_CB")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/prog_tests/tcp_rtt.c