Skip to content

Commit 36b1ecd

Browse files
jsitnickiNobody
authored andcommitted
selftests/bpf: Fix error reporting from sock_fields programs
The helper macro that records an error in BPF programs that exercise sock fields access has been indavertedly broken by adaptation work that happened in commit b18c1f0 ("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: b18c1f0 ("bpf: selftest: Adapt sock_fields test to use skel and global variables") Signed-off-by: Jakub Sitnicki <[email protected]>
1 parent 7c5caf5 commit 36b1ecd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/progs/test_sock_fields.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static void tpcpy(struct bpf_tcp_sock *dst,
114114

115115
#define RET_LOG() ({ \
116116
linum = __LINE__; \
117-
bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \
117+
bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \
118118
return CG_OK; \
119119
})
120120

0 commit comments

Comments
 (0)