@@ -22,7 +22,7 @@ static size_t page_size = 65536;
2222static __attribute__((noinline )) void valid_gcs_function (void )
2323{
2424 /* Do something the compiler can't optimise out */
25- my_syscall1 (__NR_prctl , PR_SVE_GET_VL );
25+ syscall (__NR_prctl , PR_SVE_GET_VL );
2626}
2727
2828static inline int gcs_set_status (unsigned long mode )
@@ -36,20 +36,18 @@ static inline int gcs_set_status(unsigned long mode)
3636 * other 3 values passed in registers to the syscall are zero
3737 * since the kernel validates them.
3838 */
39- ret = my_syscall5 (__NR_prctl , PR_SET_SHADOW_STACK_STATUS , mode ,
40- 0 , 0 , 0 );
39+ ret = syscall (__NR_prctl , PR_SET_SHADOW_STACK_STATUS , mode , 0 , 0 , 0 );
4140
4241 if (ret == 0 ) {
43- ret = my_syscall5 (__NR_prctl , PR_GET_SHADOW_STACK_STATUS ,
44- & new_mode , 0 , 0 , 0 );
42+ ret = syscall (__NR_prctl , PR_GET_SHADOW_STACK_STATUS , & new_mode , 0 , 0 , 0 );
4543 if (ret == 0 ) {
4644 if (new_mode != mode ) {
4745 ksft_print_msg ("Mode set to %lx not %lx\n" ,
4846 new_mode , mode );
4947 ret = - EINVAL ;
5048 }
5149 } else {
52- ksft_print_msg ("Failed to validate mode: %d\n" , ret );
50+ ksft_print_msg ("Failed to validate mode: %d\n" , errno );
5351 }
5452
5553 if (enabling != chkfeat_gcs ()) {
@@ -69,10 +67,9 @@ static bool read_status(void)
6967 unsigned long state ;
7068 int ret ;
7169
72- ret = my_syscall5 (__NR_prctl , PR_GET_SHADOW_STACK_STATUS ,
73- & state , 0 , 0 , 0 );
70+ ret = syscall (__NR_prctl , PR_GET_SHADOW_STACK_STATUS , & state , 0 , 0 , 0 );
7471 if (ret != 0 ) {
75- ksft_print_msg ("Failed to read state: %d\n" , ret );
72+ ksft_print_msg ("Failed to read state: %d\n" , errno );
7673 return false;
7774 }
7875
@@ -188,9 +185,8 @@ static bool map_guarded_stack(void)
188185 int elem ;
189186 bool pass = true;
190187
191- buf = (void * )my_syscall3 (__NR_map_shadow_stack , 0 , page_size ,
192- SHADOW_STACK_SET_MARKER |
193- SHADOW_STACK_SET_TOKEN );
188+ buf = (void * )syscall (__NR_map_shadow_stack , 0 , page_size ,
189+ SHADOW_STACK_SET_MARKER | SHADOW_STACK_SET_TOKEN );
194190 if (buf == MAP_FAILED ) {
195191 ksft_print_msg ("Failed to map %lu byte GCS: %d\n" ,
196192 page_size , errno );
@@ -257,8 +253,7 @@ static bool test_fork(void)
257253 valid_gcs_function ();
258254 get_gcspr ();
259255
260- ret = my_syscall5 (__NR_prctl , PR_GET_SHADOW_STACK_STATUS ,
261- & child_mode , 0 , 0 , 0 );
256+ ret = syscall (__NR_prctl , PR_GET_SHADOW_STACK_STATUS , & child_mode , 0 , 0 , 0 );
262257 if (ret == 0 && !(child_mode & PR_SHADOW_STACK_ENABLE )) {
263258 ksft_print_msg ("GCS not enabled in child\n" );
264259 ret = - EINVAL ;
@@ -321,8 +316,7 @@ static bool test_vfork(void)
321316 valid_gcs_function ();
322317 get_gcspr ();
323318
324- ret = my_syscall5 (__NR_prctl , PR_GET_SHADOW_STACK_STATUS ,
325- & child_mode , 0 , 0 , 0 );
319+ ret = syscall (__NR_prctl , PR_GET_SHADOW_STACK_STATUS , & child_mode , 0 , 0 , 0 );
326320 if (ret == 0 && !(child_mode & PR_SHADOW_STACK_ENABLE )) {
327321 ksft_print_msg ("GCS not enabled in child\n" );
328322 ret = EXIT_FAILURE ;
@@ -390,17 +384,15 @@ int main(void)
390384 if (!(getauxval (AT_HWCAP ) & HWCAP_GCS ))
391385 ksft_exit_skip ("SKIP GCS not supported\n" );
392386
393- ret = my_syscall5 (__NR_prctl , PR_GET_SHADOW_STACK_STATUS ,
394- & gcs_mode , 0 , 0 , 0 );
387+ ret = syscall (__NR_prctl , PR_GET_SHADOW_STACK_STATUS , & gcs_mode , 0 , 0 , 0 );
395388 if (ret != 0 )
396- ksft_exit_fail_msg ("Failed to read GCS state: %d\n" , ret );
389+ ksft_exit_fail_msg ("Failed to read GCS state: %d\n" , errno );
397390
398391 if (!(gcs_mode & PR_SHADOW_STACK_ENABLE )) {
399392 gcs_mode = PR_SHADOW_STACK_ENABLE ;
400- ret = my_syscall5 (__NR_prctl , PR_SET_SHADOW_STACK_STATUS ,
401- gcs_mode , 0 , 0 , 0 );
393+ ret = syscall (__NR_prctl , PR_SET_SHADOW_STACK_STATUS , gcs_mode , 0 , 0 , 0 );
402394 if (ret != 0 )
403- ksft_exit_fail_msg ("Failed to enable GCS: %d\n" , ret );
395+ ksft_exit_fail_msg ("Failed to enable GCS: %d\n" , errno );
404396 }
405397
406398 ksft_set_plan (ARRAY_SIZE (tests ));
@@ -410,9 +402,9 @@ int main(void)
410402 }
411403
412404 /* One last test: disable GCS, we can do this one time */
413- ret = my_syscall5 (__NR_prctl , PR_SET_SHADOW_STACK_STATUS , 0 , 0 , 0 , 0 );
405+ ret = syscall (__NR_prctl , PR_SET_SHADOW_STACK_STATUS , 0 , 0 , 0 , 0 );
414406 if (ret != 0 )
415- ksft_print_msg ("Failed to disable GCS: %d\n" , ret );
407+ ksft_print_msg ("Failed to disable GCS: %d\n" , errno );
416408
417409 ksft_finished ();
418410
0 commit comments