]> Gentwo Git Trees - linux/.git/commit
selftests/bpf: Test basic task local data operations
authorAmery Hung <ameryhung@gmail.com>
Wed, 30 Jul 2025 18:58:54 +0000 (11:58 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 2 Aug 2025 01:00:46 +0000 (18:00 -0700)
commit120f1a950e495d9751fdb5c8b7852d94546dcd03
tree5e961f140b939d5d4264eaef02af0180e55d8daf
parent31e838e1cdf4c4088fee8154ce8c12713ebfb2da
selftests/bpf: Test basic task local data operations

Test basic operations of task local data with valid and invalid
tld_create_key().

For invalid calls, make sure they return the right error code and check
that the TLDs are not inserted by running tld_get_data("
value_not_exists") on the bpf side. The call should a null pointer.

For valid calls, first make sure the TLDs are created by calling
tld_get_data() on the bpf side. The call should return a valid pointer.

Finally, verify that the TLDs are indeed task-specific (i.e., their
addresses do not overlap) with multiple user threads. This done by
writing values unique to each thread, reading them from both user space
and bpf, and checking if the value read back matches the value written.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20250730185903.3574598-4-ameryhung@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_task_local_data.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_task_local_data.c [new file with mode: 0644]