xref: /linux/tools/testing/selftests/riscv/cfi/shadowstack.h (revision 23b0f90ba871f096474e1c27c3d14f455189d2d9)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SELFTEST_SHADOWSTACK_TEST_H
4 #define SELFTEST_SHADOWSTACK_TEST_H
5 #include <stddef.h>
6 #include <linux/prctl.h>
7 
8 /*
9  * A CFI test returns true for success or false for fail.
10  * Takes a test number to index into array, and a void pointer.
11  */
12 typedef bool (*shstk_test_func)(unsigned long test_num, void *);
13 
14 struct shadow_stack_tests {
15 	char *name;
16 	shstk_test_func t_func;
17 };
18 
19 bool shadow_stack_fork_test(unsigned long test_num, void *ctx);
20 bool shadow_stack_map_test(unsigned long test_num, void *ctx);
21 bool shadow_stack_protection_test(unsigned long test_num, void *ctx);
22 bool shadow_stack_gup_tests(unsigned long test_num, void *ctx);
23 bool shadow_stack_signal_test(unsigned long test_num, void *ctx);
24 
25 int execute_shadow_stack_tests(void);
26 
27 #endif
28