Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm64: kernel: Fix unmasked debug exceptions when restoring mdscr_el1

Changes to make the resume from cpu_suspend() code behave more like
secondary boot caused debug exceptions to be unmasked early by
__cpu_setup(). We then go on to restore mdscr_el1 in cpu_do_resume(),
potentially taking break or watch points based on uninitialised registers.

Mask debug exceptions in cpu_do_resume(), which is specific to resume
from cpu_suspend(). Debug exceptions will be restored to their original
state by local_dbg_restore() in cpu_suspend(), which runs after
hw_breakpoint_restore() has re-initialised the other registers.

Reported-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Fixes: cabe1c81ea5b ("arm64: Change cpu_resume() to enable mmu early then access sleep_sp by va")
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

James Morse and committed by
Catalin Marinas
744c6c37 63fb0a95

+9
+9
arch/arm64/mm/proc.S
··· 100 100 101 101 msr tcr_el1, x8 102 102 msr vbar_el1, x9 103 + 104 + /* 105 + * __cpu_setup() cleared MDSCR_EL1.MDE and friends, before unmasking 106 + * debug exceptions. By restoring MDSCR_EL1 here, we may take a debug 107 + * exception. Mask them until local_dbg_restore() in cpu_suspend() 108 + * resets them. 109 + */ 110 + disable_dbg 103 111 msr mdscr_el1, x10 112 + 104 113 msr sctlr_el1, x12 105 114 /* 106 115 * Restore oslsr_el1 by writing oslar_el1