Skip to content

Commit 8aa9e85

Browse files
Vineet Guptatorvalds
Vineet Gupta
authored andcommitted
ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe
There was a very small race window where resume to kernel mode from a Exception Path (or pure kernel mode which is true for most of ARC exceptions anyways), was not disabling interrupts in restore_regs, clobbering the exception regs Anton found the culprit call flow (after many sleepless nights) | 1. we got a Trap from user land | 2. started to service it. | 3. While doing some stuff on user-land memory (I think it is padzero()), | we got a DataTlbMiss | 4. On return from it we are taking "resume_kernel_mode" path | 5. NEED_RESHED is not set, so we go to "return from exception" path in | restore regs. | 6. there seems to be IRQ happening Signed-off-by: Vineet Gupta <[email protected]> Cc: <[email protected]> #3.10, 3.12, 3.13, 3.14 Cc: Anton Kolesov <[email protected]> Cc: Francois Bedard <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 71dc96e commit 8aa9e85

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

arch/arc/kernel/entry.S

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,13 @@ resume_user_mode_begin:
614614

615615
resume_kernel_mode:
616616

617-
#ifdef CONFIG_PREEMPT
618-
619-
; This is a must for preempt_schedule_irq()
617+
; Disable Interrupts from this point on
618+
; CONFIG_PREEMPT: This is a must for preempt_schedule_irq()
619+
; !CONFIG_PREEMPT: To ensure restore_regs is intr safe
620620
IRQ_DISABLE r9
621621

622+
#ifdef CONFIG_PREEMPT
623+
622624
; Can't preempt if preemption disabled
623625
GET_CURR_THR_INFO_FROM_SP r10
624626
ld r8, [r10, THREAD_INFO_PREEMPT_COUNT]

0 commit comments

Comments
 (0)