summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_set_remove_xattr.c
AgeCommit message (Collapse)Author
2025-02-13selftests/bpf: Test kfuncs that set and remove xattr from BPF programsSong Liu
Two sets of tests are added to exercise the not _locked and _locked version of the kfuncs. For both tests, user space accesses xattr security.bpf.foo on a testfile. The BPF program is triggered by user space access (on LSM hook inode_[set|get]_xattr) and sets or removes xattr security.bpf.bar. Then user space then validates that xattr security.bpf.bar is set or removed as expected. Note that, in both tests, the BPF programs use the not _locked kfuncs. The verifier picks the proper kfuncs based on the calling context. Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20250130213549.3353349-6-song@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>