Patch "selftests/bpf: Fix bpf_nf failure upon test rerun" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests/bpf: Fix bpf_nf failure upon test rerun

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-bpf-fix-bpf_nf-failure-upon-test-rerun.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7aece2e310edf7e10cd820b9986bc76f1a88fd01
Author: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
Date:   Mon Jun 26 15:19:42 2023 +0200

    selftests/bpf: Fix bpf_nf failure upon test rerun
    
    [ Upstream commit 17e8e5d6e09adb4b4f4fb5c89b3ec3fcae2c64a6 ]
    
    Alexei reported:
    
      After fast forwarding bpf-next today bpf_nf test started to fail when
      run twice:
    
      $ ./test_progs -t bpf_nf
      #17      bpf_nf:OK
      Summary: 1/10 PASSED, 0 SKIPPED, 0 FAILED
    
      $ ./test_progs -t bpf_nf
      All error logs:
      test_bpf_nf_ct:PASS:test_bpf_nf__open_and_load 0 nsec
      test_bpf_nf_ct:PASS:iptables-legacy -t raw -A PREROUTING -j CONNMARK
      --set-mark 42/0 0 nsec
      (network_helpers.c:102: errno: Address already in use) Failed to bind socket
      test_bpf_nf_ct:FAIL:start_server unexpected start_server: actual -1 < expected 0
      #17/1    bpf_nf/xdp-ct:FAIL
      test_bpf_nf_ct:PASS:test_bpf_nf__open_and_load 0 nsec
      test_bpf_nf_ct:PASS:iptables-legacy -t raw -A PREROUTING -j CONNMARK
      --set-mark 42/0 0 nsec
      (network_helpers.c:102: errno: Address already in use) Failed to bind socket
      test_bpf_nf_ct:FAIL:start_server unexpected start_server: actual -1 < expected 0
      #17/2    bpf_nf/tc-bpf-ct:FAIL
      #17      bpf_nf:FAIL
      Summary: 0/8 PASSED, 0 SKIPPED, 1 FAILED
    
    I was able to locally reproduce as well. Rearrange the connection teardown
    so that the client closes its connection first so that we don't need to
    linger in TCP time-wait.
    
    Fixes: e81fbd4c1ba7 ("selftests/bpf: Add existing connection bpf_*_ct_lookup() test")
    Reported-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/CAADnVQ+0dnDq_v_vH1EfkacbfGnHANaon7zsw10pMb-D9FS0Pw@xxxxxxxxxxxxxx
    Link: https://lore.kernel.org/bpf/20230626131942.5100-1-daniel@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_nf.c b/tools/testing/selftests/bpf/prog_tests/bpf_nf.c
index 8a838ea8bdf3b..b2998896f9f7b 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_nf.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_nf.c
@@ -123,12 +123,13 @@ static void test_bpf_nf_ct(int mode)
 	ASSERT_EQ(skel->data->test_snat_addr, 0, "Test for source natting");
 	ASSERT_EQ(skel->data->test_dnat_addr, 0, "Test for destination natting");
 end:
-	if (srv_client_fd != -1)
-		close(srv_client_fd);
 	if (client_fd != -1)
 		close(client_fd);
+	if (srv_client_fd != -1)
+		close(srv_client_fd);
 	if (srv_fd != -1)
 		close(srv_fd);
+
 	snprintf(cmd, sizeof(cmd), iptables, "-D");
 	system(cmd);
 	test_bpf_nf__destroy(skel);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux