-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/bpf: add destructive kfunc test
Add a test checking that programs calling destructive kfuncs can only do so if they have CAP_SYS_BOOT capabilities. Signed-off-by: Artem Savkov <asavkov@redhat.com> Link: https://lore.kernel.org/r/20220810065905.475418-4-asavkov@redhat.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
- Loading branch information
Artem Savkov
authored and
Alexei Starovoitov
committed
Aug 10, 2022
1 parent
1337905
commit e338945
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tools/testing/selftests/bpf/progs/kfunc_call_destructive.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
#include <vmlinux.h> | ||
#include <bpf/bpf_helpers.h> | ||
|
||
extern void bpf_kfunc_call_test_destructive(void) __ksym; | ||
|
||
SEC("tc") | ||
int kfunc_destructive_test(void) | ||
{ | ||
bpf_kfunc_call_test_destructive(); | ||
return 0; | ||
} | ||
|
||
char _license[] SEC("license") = "GPL"; |