static __attribute__((noinline)) void valid_gcs_function(void)
{
/* Do something the compiler can't optimise out */
- my_syscall1(__NR_prctl, PR_SVE_GET_VL);
+ syscall(__NR_prctl, PR_SVE_GET_VL);
}
static inline int gcs_set_status(unsigned long mode)
* other 3 values passed in registers to the syscall are zero
* since the kernel validates them.
*/
- ret = my_syscall5(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, mode,
- 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, mode, 0, 0, 0);
if (ret == 0) {
- ret = my_syscall5(__NR_prctl, PR_GET_SHADOW_STACK_STATUS,
- &new_mode, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &new_mode, 0, 0, 0);
if (ret == 0) {
if (new_mode != mode) {
ksft_print_msg("Mode set to %lx not %lx\n",
ret = -EINVAL;
}
} else {
- ksft_print_msg("Failed to validate mode: %d\n", ret);
+ ksft_print_msg("Failed to validate mode: %d\n", errno);
}
if (enabling != chkfeat_gcs()) {
unsigned long state;
int ret;
- ret = my_syscall5(__NR_prctl, PR_GET_SHADOW_STACK_STATUS,
- &state, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &state, 0, 0, 0);
if (ret != 0) {
- ksft_print_msg("Failed to read state: %d\n", ret);
+ ksft_print_msg("Failed to read state: %d\n", errno);
return false;
}
int elem;
bool pass = true;
- buf = (void *)my_syscall3(__NR_map_shadow_stack, 0, page_size,
- SHADOW_STACK_SET_MARKER |
- SHADOW_STACK_SET_TOKEN);
+ buf = (void *)syscall(__NR_map_shadow_stack, 0, page_size,
+ SHADOW_STACK_SET_MARKER | SHADOW_STACK_SET_TOKEN);
if (buf == MAP_FAILED) {
ksft_print_msg("Failed to map %lu byte GCS: %d\n",
page_size, errno);
valid_gcs_function();
get_gcspr();
- ret = my_syscall5(__NR_prctl, PR_GET_SHADOW_STACK_STATUS,
- &child_mode, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &child_mode, 0, 0, 0);
if (ret == 0 && !(child_mode & PR_SHADOW_STACK_ENABLE)) {
ksft_print_msg("GCS not enabled in child\n");
ret = -EINVAL;
valid_gcs_function();
get_gcspr();
- ret = my_syscall5(__NR_prctl, PR_GET_SHADOW_STACK_STATUS,
- &child_mode, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &child_mode, 0, 0, 0);
if (ret == 0 && !(child_mode & PR_SHADOW_STACK_ENABLE)) {
ksft_print_msg("GCS not enabled in child\n");
ret = EXIT_FAILURE;
if (!(getauxval(AT_HWCAP) & HWCAP_GCS))
ksft_exit_skip("SKIP GCS not supported\n");
- ret = my_syscall5(__NR_prctl, PR_GET_SHADOW_STACK_STATUS,
- &gcs_mode, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_GET_SHADOW_STACK_STATUS, &gcs_mode, 0, 0, 0);
if (ret != 0)
- ksft_exit_fail_msg("Failed to read GCS state: %d\n", ret);
+ ksft_exit_fail_msg("Failed to read GCS state: %d\n", errno);
if (!(gcs_mode & PR_SHADOW_STACK_ENABLE)) {
gcs_mode = PR_SHADOW_STACK_ENABLE;
- ret = my_syscall5(__NR_prctl, PR_SET_SHADOW_STACK_STATUS,
- gcs_mode, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, gcs_mode, 0, 0, 0);
if (ret != 0)
- ksft_exit_fail_msg("Failed to enable GCS: %d\n", ret);
+ ksft_exit_fail_msg("Failed to enable GCS: %d\n", errno);
}
ksft_set_plan(ARRAY_SIZE(tests));
}
/* One last test: disable GCS, we can do this one time */
- ret = my_syscall5(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, 0, 0, 0, 0);
+ ret = syscall(__NR_prctl, PR_SET_SHADOW_STACK_STATUS, 0, 0, 0, 0);
if (ret != 0)
- ksft_print_msg("Failed to disable GCS: %d\n", ret);
+ ksft_print_msg("Failed to disable GCS: %d\n", errno);
ksft_finished();