diff options
author | Julien Thierry <julien.thierry@arm.com> | 2018-08-28 11:51:15 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2018-10-03 11:12:21 -0400 |
commit | 9a0c032825e073e002ee80cf2577431d7296a7f7 (patch) | |
tree | 25254503623e42c0689570c1a59f3f71d12a4dbd | |
parent | f05692919bdd44ad2a1a1fe85222dec16fec7e80 (diff) |
arm64: Use daifflag_restore after bp_hardening
For EL0 entries requiring bp_hardening, daif status is kept at
DAIF_PROCCTX_NOIRQ until after hardening has been done. Then interrupts
are enabled through local_irq_enable().
Before using local_irq_* functions, daifflags should be properly restored
to a state where IRQs are enabled.
Enable IRQs by restoring DAIF_PROCCTX state after bp hardening.
Acked-by: James Morse <james.morse@arm.com>
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/mm/fault.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 1aa487a37a0a..d0e638ef3af6 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/cmpxchg.h> | 37 | #include <asm/cmpxchg.h> |
38 | #include <asm/cpufeature.h> | 38 | #include <asm/cpufeature.h> |
39 | #include <asm/exception.h> | 39 | #include <asm/exception.h> |
40 | #include <asm/daifflags.h> | ||
40 | #include <asm/debug-monitors.h> | 41 | #include <asm/debug-monitors.h> |
41 | #include <asm/esr.h> | 42 | #include <asm/esr.h> |
42 | #include <asm/sysreg.h> | 43 | #include <asm/sysreg.h> |
@@ -776,7 +777,7 @@ asmlinkage void __exception do_el0_ia_bp_hardening(unsigned long addr, | |||
776 | if (addr > TASK_SIZE) | 777 | if (addr > TASK_SIZE) |
777 | arm64_apply_bp_hardening(); | 778 | arm64_apply_bp_hardening(); |
778 | 779 | ||
779 | local_irq_enable(); | 780 | local_daif_restore(DAIF_PROCCTX); |
780 | do_mem_abort(addr, esr, regs); | 781 | do_mem_abort(addr, esr, regs); |
781 | } | 782 | } |
782 | 783 | ||
@@ -790,7 +791,7 @@ asmlinkage void __exception do_sp_pc_abort(unsigned long addr, | |||
790 | if (user_mode(regs)) { | 791 | if (user_mode(regs)) { |
791 | if (instruction_pointer(regs) > TASK_SIZE) | 792 | if (instruction_pointer(regs) > TASK_SIZE) |
792 | arm64_apply_bp_hardening(); | 793 | arm64_apply_bp_hardening(); |
793 | local_irq_enable(); | 794 | local_daif_restore(DAIF_PROCCTX); |
794 | } | 795 | } |
795 | 796 | ||
796 | clear_siginfo(&info); | 797 | clear_siginfo(&info); |