]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/bpf: Add update_elem failure test for task storage uptr
authorMartin KaFai Lau <martin.lau@kernel.org>
Wed, 23 Oct 2024 23:47:57 +0000 (16:47 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 24 Oct 2024 17:25:59 +0000 (10:25 -0700)
commitcbf9f849a3e86f1b7c041dfbeeae1c1fff0ddc8d
treec51c8edf494b053946be46ee1a167aac04d813b8
parent51fff4083372381e680724dde7ac3e859f9e3a0a
selftests/bpf: Add update_elem failure test for task storage uptr

This patch test the following failures in syscall update_elem
1. The first update_elem(BPF_F_LOCK) should be EOPNOTSUPP. syscall.c takes
   care of unpinning the uptr.
2. The second update_elem(BPF_EXIST) fails. syscall.c takes care of
   unpinning the uptr.
3. The forth update_elem(BPF_NOEXIST) fails. bpf_local_storage_update
   takes care of unpinning the uptr.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20241023234759.860539-11-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/task_local_storage.c
tools/testing/selftests/bpf/progs/uptr_update_failure.c [new file with mode: 0644]
tools/testing/selftests/bpf/uptr_test_common.h