arm: Invalidate icache on prefetch abort outside of user mapping on Cortex-A57/72.
In order to prevent aliasing attacks on the branch predictor, invalidate the icache on Cortex-A57/72, which has the side effect of invalidating the BTB. This requires ACTLR[0] to be set to 1 (secure operation). Change-Id: Ief15d6693d2bff9111e127ea486a6e864f6b35ef Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org> Signed-off-by: Rajshekar Eashwarappa <reashw@codeaurora.org>
This commit is contained in:
parent
3a49aad871
commit
9d0f39c3a1
|
@ -59,6 +59,7 @@
|
|||
#define __write_sysreg(v, r, w, c, t) asm volatile(w " " c : : "r" ((t)(v)))
|
||||
#define write_sysreg(v, ...) __write_sysreg(v, __VA_ARGS__)
|
||||
#define BPIALL __ACCESS_CP15(c7, 0, c5, 6)
|
||||
#define ICIALLU __ACCESS_CP15(c7, 0, c5, 0)
|
||||
|
||||
extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
|
||||
extern unsigned long cr_alignment; /* defined in entry-armv.S */
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#define ARM_CPU_PART_CORTEX_A5 0xC050
|
||||
#define ARM_CPU_PART_CORTEX_A15 0xC0F0
|
||||
#define ARM_CPU_PART_CORTEX_A7 0xC070
|
||||
#define ARM_CPU_PART_CORTEX_A57 0xd070
|
||||
#define ARM_CPU_PART_CORTEX_A72 0xd080
|
||||
|
||||
#define ARM_CPU_XSCALE_ARCH_MASK 0xe000
|
||||
#define ARM_CPU_XSCALE_ARCH_V1 0x2000
|
||||
|
|
|
@ -421,6 +421,11 @@ do_pabt_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
|
|||
case ARM_CPU_PART_CORTEX_A8:
|
||||
write_sysreg(0, BPIALL);
|
||||
break;
|
||||
|
||||
case ARM_CPU_PART_CORTEX_A57:
|
||||
case ARM_CPU_PART_CORTEX_A72:
|
||||
write_sysreg(0, ICIALLU);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue