Patch "selftests/bpf: Fix sockopt_sk selftest" 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 sockopt_sk selftest

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-sockopt_sk-selftest.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 3381b4d2a6a48ee347796d4b7e88744146c3cf7c
Author: Yonghong Song <yhs@xxxxxx>
Date:   Tue Jun 6 10:22:02 2023 -0700

    selftests/bpf: Fix sockopt_sk selftest
    
    [ Upstream commit 69844e335d8c22454746c7903776533d8b4ab8fa ]
    
    Commit f4e4534850a9 ("net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report")
    fixed NETLINK_LIST_MEMBERSHIPS length report which caused
    selftest sockopt_sk failure. The failure log looks like
    
      test_sockopt_sk:PASS:join_cgroup /sockopt_sk 0 nsec
      run_test:PASS:skel_load 0 nsec
      run_test:PASS:setsockopt_link 0 nsec
      run_test:PASS:getsockopt_link 0 nsec
      getsetsockopt:FAIL:Unexpected NETLINK_LIST_MEMBERSHIPS value unexpected Unexpected NETLINK_LIST_MEMBERSHIPS value: actual 8 != expected 4
      run_test:PASS:getsetsockopt 0 nsec
      #201     sockopt_sk:FAIL
    
    In net/netlink/af_netlink.c, function netlink_getsockopt(), for NETLINK_LIST_MEMBERSHIPS,
    nlk->ngroups equals to 36. Before Commit f4e4534850a9, the optlen is calculated as
      ALIGN(nlk->ngroups / 8, sizeof(u32)) = 4
    After that commit, the optlen is
      ALIGN(BITS_TO_BYTES(nlk->ngroups), sizeof(u32)) = 8
    
    Fix the test by setting the expected optlen to be 8.
    
    Fixes: f4e4534850a9 ("net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report")
    Signed-off-by: Yonghong Song <yhs@xxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20230606172202.1606249-1-yhs@xxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
index 4512dd808c335..05d0e07da3942 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
@@ -209,7 +209,7 @@ static int getsetsockopt(void)
 			err, errno);
 		goto err;
 	}
-	ASSERT_EQ(optlen, 4, "Unexpected NETLINK_LIST_MEMBERSHIPS value");
+	ASSERT_EQ(optlen, 8, "Unexpected NETLINK_LIST_MEMBERSHIPS value");
 
 	free(big_buf);
 	close(fd);



[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