lkml.org 
[lkml]   [2022]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.16 0616/1017] selftests/bpf: Fix error reporting from sock_fields programs
    Date
    From: Jakub Sitnicki <jakub@cloudflare.com>

    [ Upstream commit a4c9fe0ed4a13e25e43fcd44d9f89bc19ba8fbb7 ]

    The helper macro that records an error in BPF programs that exercise sock
    fields access has been inadvertently broken by adaptation work that
    happened in commit b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to
    use skel and global variables").

    BPF_NOEXIST flag cannot be used to update BPF_MAP_TYPE_ARRAY. The operation
    always fails with -EEXIST, which in turn means the error never gets
    recorded, and the checks for errors always pass.

    Revert the change in update flags.

    Fixes: b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to use skel and global variables")
    Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Martin KaFai Lau <kafai@fb.com>
    Link: https://lore.kernel.org/bpf/20220317113920.1068535-2-jakub@cloudflare.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    tools/testing/selftests/bpf/progs/test_sock_fields.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/tools/testing/selftests/bpf/progs/test_sock_fields.c b/tools/testing/selftests/bpf/progs/test_sock_fields.c
    index 81b57b9aaaea..7967348b11af 100644
    --- a/tools/testing/selftests/bpf/progs/test_sock_fields.c
    +++ b/tools/testing/selftests/bpf/progs/test_sock_fields.c
    @@ -113,7 +113,7 @@ static void tpcpy(struct bpf_tcp_sock *dst,

    #define RET_LOG() ({ \
    linum = __LINE__; \
    - bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \
    + bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \
    return CG_OK; \
    })

    --
    2.34.1


    \
     
     \ /
      Last update: 2022-04-05 15:26    [W:4.031 / U:2.340 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site