Patch "selftests/bpf: Wait for receive in cg_storage_multi test" has been added to the 5.10-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: Wait for receive in cg_storage_multi test

to the 5.10-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-wait-for-receive-in-cg_storage_multi-t.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 18edd94a9c15e91ed2648722b2c3b163bf41bb00
Author: YiFei Zhu <zhuyifei@xxxxxxxxxx>
Date:   Wed Apr 5 19:33:54 2023 +0000

    selftests/bpf: Wait for receive in cg_storage_multi test
    
    [ Upstream commit 5af607a861d43ffff830fc1890033e579ec44799 ]
    
    In some cases the loopback latency might be large enough, causing
    the assertion on invocations to be run before ingress prog getting
    executed. The assertion would fail and the test would flake.
    
    This can be reliably reproduced by arbitrarily increasing the
    loopback latency (thanks to [1]):
      tc qdisc add dev lo root handle 1: htb default 12
      tc class add dev lo parent 1:1 classid 1:12 htb rate 20kbps ceil 20kbps
      tc qdisc add dev lo parent 1:12 netem delay 100ms
    
    Fix this by waiting on the receive end, instead of instantly
    returning to the assert. The call to read() will wait for the
    default SO_RCVTIMEO timeout of 3 seconds provided by
    start_server().
    
    [1] https://gist.github.com/kstevens715/4598301
    
    Reported-by: Martin KaFai Lau <martin.lau@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/9c5c8b7e-1d89-a3af-5400-14fde81f4429@xxxxxxxxx/
    Fixes: 3573f384014f ("selftests/bpf: Test CGROUP_STORAGE behavior on shared egress + ingress")
    Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxx>
    Signed-off-by: YiFei Zhu <zhuyifei@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230405193354.1956209-1-zhuyifei@xxxxxxxxxx
    Signed-off-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c b/tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c
index 643dfa35419c1..48dc5827daa7f 100644
--- a/tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c
+++ b/tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c
@@ -56,8 +56,9 @@ static bool assert_storage_noexist(struct bpf_map *map, const void *key)
 
 static bool connect_send(const char *cgroup_path)
 {
-	bool res = true;
 	int server_fd = -1, client_fd = -1;
+	char message[] = "message";
+	bool res = true;
 
 	if (join_cgroup(cgroup_path))
 		goto out_clean;
@@ -70,7 +71,10 @@ static bool connect_send(const char *cgroup_path)
 	if (client_fd < 0)
 		goto out_clean;
 
-	if (send(client_fd, "message", strlen("message"), 0) < 0)
+	if (send(client_fd, &message, sizeof(message), 0) < 0)
+		goto out_clean;
+
+	if (read(server_fd, &message, sizeof(message)) < 0)
 		goto out_clean;
 
 	res = false;



[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