File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
tools/testing/selftests/x86 Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -465,7 +465,7 @@ static void test_ptrace_write_gsbase(void)
465
465
wait (& status );
466
466
467
467
if (WSTOPSIG (status ) == SIGTRAP ) {
468
- unsigned long gs ;
468
+ unsigned long gs , base ;
469
469
unsigned long gs_offset = USER_REGS_OFFSET (gs );
470
470
unsigned long base_offset = USER_REGS_OFFSET (gs_base );
471
471
@@ -481,6 +481,7 @@ static void test_ptrace_write_gsbase(void)
481
481
err (1 , "PTRACE_POKEUSER" );
482
482
483
483
gs = ptrace (PTRACE_PEEKUSER , child , gs_offset , NULL );
484
+ base = ptrace (PTRACE_PEEKUSER , child , base_offset , NULL );
484
485
485
486
/*
486
487
* In a non-FSGSBASE system, the nonzero selector will load
@@ -501,8 +502,14 @@ static void test_ptrace_write_gsbase(void)
501
502
*/
502
503
if (gs == 0 )
503
504
printf ("\tNote: this is expected behavior on older kernels.\n" );
505
+ } else if (have_fsgsbase && (base != 0xFF )) {
506
+ nerrs ++ ;
507
+ printf ("[FAIL]\tGSBASE changed to %lx\n" , base );
504
508
} else {
505
- printf ("[OK]\tGS remained 0x%hx\n" , * shared_scratch );
509
+ printf ("[OK]\tGS remained 0x%hx" , * shared_scratch );
510
+ if (have_fsgsbase )
511
+ printf (" and GSBASE changed to 0xFF" );
512
+ printf ("\n" );
506
513
}
507
514
}
508
515
You can’t perform that action at this time.
0 commit comments