Patch "selftests/bpf: Fix issues in setup_classid_environment()" has been added to the 6.6-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 issues in setup_classid_environment()

to the 6.6-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-issues-in-setup_classid_environmen.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 314a6a0a14c58d4edbe3cb3b22ba7a425c973414
Author: Yafang Shao <laoar.shao@xxxxxxxxx>
Date:   Sat Nov 11 09:00:30 2023 +0000

    selftests/bpf: Fix issues in setup_classid_environment()
    
    [ Upstream commit 4849775587844e44d215289c425bcd70f315efe7 ]
    
    If the net_cls subsystem is already mounted, attempting to mount it again
    in setup_classid_environment() will result in a failure with the error code
    EBUSY. Despite this, tmpfs will have been successfully mounted at
    /sys/fs/cgroup/net_cls. Consequently, the /sys/fs/cgroup/net_cls directory
    will be empty, causing subsequent setup operations to fail.
    
    Here's an error log excerpt illustrating the issue when net_cls has already
    been mounted at /sys/fs/cgroup/net_cls prior to running
    setup_classid_environment():
    
    - Before that change
    
      $ tools/testing/selftests/bpf/test_progs --name=cgroup_v1v2
      test_cgroup_v1v2:PASS:server_fd 0 nsec
      test_cgroup_v1v2:PASS:client_fd 0 nsec
      test_cgroup_v1v2:PASS:cgroup_fd 0 nsec
      test_cgroup_v1v2:PASS:server_fd 0 nsec
      run_test:PASS:skel_open 0 nsec
      run_test:PASS:prog_attach 0 nsec
      test_cgroup_v1v2:PASS:cgroup-v2-only 0 nsec
      (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup.procs
      (cgroup_helpers.c:540: errno: No such file or directory) Opening cgroup classid: /sys/fs/cgroup/net_cls/cgroup-test-work-dir/net_cls.classid
      run_test:PASS:skel_open 0 nsec
      run_test:PASS:prog_attach 0 nsec
      (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup-test-work-dir/cgroup.procs
      run_test:FAIL:join_classid unexpected error: 1 (errno 2)
      test_cgroup_v1v2:FAIL:cgroup-v1v2 unexpected error: -1 (errno 2)
      (cgroup_helpers.c:248: errno: No such file or directory) Opening Cgroup Procs: /sys/fs/cgroup/net_cls/cgroup.procs
      #44      cgroup_v1v2:FAIL
      Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED
    
    - After that change
      $ tools/testing/selftests/bpf/test_progs --name=cgroup_v1v2
      #44      cgroup_v1v2:OK
      Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
    
    Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20231111090034.4248-3-laoar.shao@xxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index 2caee8423ee0..f68fbc6c3f52 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -499,10 +499,20 @@ int setup_classid_environment(void)
 		return 1;
 	}
 
-	if (mount("net_cls", NETCLS_MOUNT_PATH, "cgroup", 0, "net_cls") &&
-	    errno != EBUSY) {
-		log_err("mount cgroup net_cls");
-		return 1;
+	if (mount("net_cls", NETCLS_MOUNT_PATH, "cgroup", 0, "net_cls")) {
+		if (errno != EBUSY) {
+			log_err("mount cgroup net_cls");
+			return 1;
+		}
+
+		if (rmdir(NETCLS_MOUNT_PATH)) {
+			log_err("rmdir cgroup net_cls");
+			return 1;
+		}
+		if (umount(CGROUP_MOUNT_DFLT)) {
+			log_err("umount cgroup base");
+			return 1;
+		}
 	}
 
 	cleanup_classid_environment();




[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