Patch "selftests/bpf: Fix rare segfault in sock_fields prog test" has been added to the 5.19-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 rare segfault in sock_fields prog test

to the 5.19-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-rare-segfault-in-sock_fields-prog-.patch
and it can be found in the queue-5.19 subdirectory.

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



commit b53e2f87f99dd4942c8991e7a873ecfd77ac0dd9
Author: Jörn-Thorben Hinz <jthinz@xxxxxxxxxxxxxxxxxxxx>
Date:   Tue Jun 21 09:01:16 2022 +0200

    selftests/bpf: Fix rare segfault in sock_fields prog test
    
    [ Upstream commit 6dc7a0baf1a70b7d22662d38481824c14ddd80c5 ]
    
    test_sock_fields__detach() got called with a null pointer here when one
    of the CHECKs or ASSERTs up to the test_sock_fields__open_and_load()
    call resulted in a jump to the "done" label.
    
    A skeletons *__detach() is not safe to call with a null pointer, though.
    This led to a segfault.
    
    Go the easy route and only call test_sock_fields__destroy() which is
    null-pointer safe and includes detaching.
    
    Came across this while looking[1] to introduce the usage of
    bpf_tcp_helpers.h (included in progs/test_sock_fields.c) together with
    vmlinux.h.
    
    [1] https://lore.kernel.org/bpf/629bc069dd807d7ac646f836e9dca28bbc1108e2.camel@xxxxxxxxxxxxxxxxxxxx/
    
    Fixes: 8f50f16ff39d ("selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads")
    Signed-off-by: Jörn-Thorben Hinz <jthinz@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Reviewed-by: Jakub Sitnicki <jakub@xxxxxxxxxxxxxx>
    Reviewed-by: Martin KaFai Lau <kafai@xxxxxx>
    Acked-by: John Fastabend <john.fastabend@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20220621070116.307221-1-jthinz@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/prog_tests/sock_fields.c b/tools/testing/selftests/bpf/prog_tests/sock_fields.c
index 9d211b5c22c4..7d23166c77af 100644
--- a/tools/testing/selftests/bpf/prog_tests/sock_fields.c
+++ b/tools/testing/selftests/bpf/prog_tests/sock_fields.c
@@ -394,7 +394,6 @@ void serial_test_sock_fields(void)
 	test();
 
 done:
-	test_sock_fields__detach(skel);
 	test_sock_fields__destroy(skel);
 	if (child_cg_fd >= 0)
 		close(child_cg_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