diff options
author | Vineet Gupta <Vineet.Gupta1@synopsys.com> | 2014-04-30 05:56:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-30 11:21:43 -0400 |
commit | 8aa9e85adac609588eeec356e5a85059b3b819ba (patch) | |
tree | 446070ce57b0657a1236ea393c9bc301f9f5b5e8 | |
parent | 71dc96e39d0a81854303dd498b4eafa7d1d90f81 (diff) |
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 <vgupta@synopsys.com>
Cc: <stable@vger.kernel.org> #3.10, 3.12, 3.13, 3.14
Cc: Anton Kolesov <Anton.Kolesov@synopsys.com>
Cc: Francois Bedard <Francois.Bedard@synopsys.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/arc/kernel/entry.S | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 819dd5f7eb05..29b82adbf0b4 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S | |||
@@ -614,11 +614,13 @@ resume_user_mode_begin: | |||
614 | 614 | ||
615 | resume_kernel_mode: | 615 | resume_kernel_mode: |
616 | 616 | ||
617 | #ifdef CONFIG_PREEMPT | 617 | ; Disable Interrupts from this point on |
618 | 618 | ; CONFIG_PREEMPT: This is a must for preempt_schedule_irq() | |
619 | ; This is a must for preempt_schedule_irq() | 619 | ; !CONFIG_PREEMPT: To ensure restore_regs is intr safe |
620 | IRQ_DISABLE r9 | 620 | IRQ_DISABLE r9 |
621 | 621 | ||
622 | #ifdef CONFIG_PREEMPT | ||
623 | |||
622 | ; Can't preempt if preemption disabled | 624 | ; Can't preempt if preemption disabled |
623 | GET_CURR_THR_INFO_FROM_SP r10 | 625 | GET_CURR_THR_INFO_FROM_SP r10 |
624 | ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] | 626 | ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] |