Patch "selftests/bpf: fix test_spin_lock_fail.c's global vars usage" 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 test_spin_lock_fail.c's global vars usage

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-test_spin_lock_fail.c-s-global-var.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 8c7b757ee9e1cf92016382fd7681c4615b3e05f3
Author: Andrii Nakryiko <andrii@xxxxxxxxxx>
Date:   Tue Oct 22 21:39:06 2024 -0700

    selftests/bpf: fix test_spin_lock_fail.c's global vars usage
    
    [ Upstream commit 1b2bfc29695d273492c3dd8512775261f3272686 ]
    
    Global variables of special types (like `struct bpf_spin_lock`) make
    underlying ARRAY maps non-mmapable. To make this work with libbpf's
    mmaping logic, application is expected to declare such special variables
    as static, so libbpf doesn't even attempt to mmap() such ARRAYs.
    
    test_spin_lock_fail.c didn't follow this rule, but given it relied on
    this test to trigger failures, this went unnoticed, as we never got to
    the step of mmap()'ing these ARRAY maps.
    
    It is fragile and relies on specific sequence of libbpf steps, which are
    an internal implementation details.
    
    Fix the test by marking lockA and lockB as static.
    
    Fixes: c48748aea4f8 ("selftests/bpf: Add failure test cases for spin lock pairing")
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241023043908.3834423-2-andrii@xxxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/progs/test_spin_lock_fail.c b/tools/testing/selftests/bpf/progs/test_spin_lock_fail.c
index 86cd183ef6dc8..293ac1049d388 100644
--- a/tools/testing/selftests/bpf/progs/test_spin_lock_fail.c
+++ b/tools/testing/selftests/bpf/progs/test_spin_lock_fail.c
@@ -28,8 +28,8 @@ struct {
 	},
 };
 
-SEC(".data.A") struct bpf_spin_lock lockA;
-SEC(".data.B") struct bpf_spin_lock lockB;
+static struct bpf_spin_lock lockA SEC(".data.A");
+static struct bpf_spin_lock lockB SEC(".data.B");
 
 SEC("?tc")
 int lock_id_kptr_preserve(void *ctx)




[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