@@ -82,10 +82,11 @@ static noinstr void check_user_regs(struct pt_regs *regs)
82
82
* 2) Invoke context tracking if enabled to reactivate RCU
83
83
* 3) Trace interrupts off state
84
84
*/
85
- static noinstr void enter_from_user_mode (void )
85
+ static noinstr void enter_from_user_mode (struct pt_regs * regs )
86
86
{
87
87
enum ctx_state state = ct_state ();
88
88
89
+ check_user_regs (regs );
89
90
lockdep_hardirqs_off (CALLER_ADDR0 );
90
91
user_exit_irqoff ();
91
92
@@ -95,8 +96,9 @@ static noinstr void enter_from_user_mode(void)
95
96
instrumentation_end ();
96
97
}
97
98
#else
98
- static __always_inline void enter_from_user_mode (void )
99
+ static __always_inline void enter_from_user_mode (struct pt_regs * regs )
99
100
{
101
+ check_user_regs (regs );
100
102
lockdep_hardirqs_off (CALLER_ADDR0 );
101
103
instrumentation_begin ();
102
104
trace_hardirqs_off_finish ();
@@ -369,9 +371,7 @@ __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs)
369
371
{
370
372
struct thread_info * ti ;
371
373
372
- check_user_regs (regs );
373
-
374
- enter_from_user_mode ();
374
+ enter_from_user_mode (regs );
375
375
instrumentation_begin ();
376
376
377
377
local_irq_enable ();
@@ -434,9 +434,7 @@ static void do_syscall_32_irqs_on(struct pt_regs *regs)
434
434
/* Handles int $0x80 */
435
435
__visible noinstr void do_int80_syscall_32 (struct pt_regs * regs )
436
436
{
437
- check_user_regs (regs );
438
-
439
- enter_from_user_mode ();
437
+ enter_from_user_mode (regs );
440
438
instrumentation_begin ();
441
439
442
440
local_irq_enable ();
@@ -487,16 +485,14 @@ __visible noinstr long do_fast_syscall_32(struct pt_regs *regs)
487
485
vdso_image_32 .sym_int80_landing_pad ;
488
486
bool success ;
489
487
490
- check_user_regs (regs );
491
-
492
488
/*
493
489
* SYSENTER loses EIP, and even SYSCALL32 needs us to skip forward
494
490
* so that 'regs->ip -= 2' lands back on an int $0x80 instruction.
495
491
* Fix it up.
496
492
*/
497
493
regs -> ip = landing_pad ;
498
494
499
- enter_from_user_mode ();
495
+ enter_from_user_mode (regs );
500
496
instrumentation_begin ();
501
497
502
498
local_irq_enable ();
@@ -599,8 +595,7 @@ idtentry_state_t noinstr idtentry_enter(struct pt_regs *regs)
599
595
};
600
596
601
597
if (user_mode (regs )) {
602
- check_user_regs (regs );
603
- enter_from_user_mode ();
598
+ enter_from_user_mode (regs );
604
599
return ret ;
605
600
}
606
601
@@ -733,8 +728,7 @@ void noinstr idtentry_exit(struct pt_regs *regs, idtentry_state_t state)
733
728
*/
734
729
void noinstr idtentry_enter_user (struct pt_regs * regs )
735
730
{
736
- check_user_regs (regs );
737
- enter_from_user_mode ();
731
+ enter_from_user_mode (regs );
738
732
}
739
733
740
734
/**
0 commit comments