summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRobin Murphy <robin.murphy@arm.com>2014-09-25 11:56:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-05 14:54:10 -0700
commitfc7e5dd63936d19bbe2bb002780c06dc1cdd20a1 (patch)
tree9df11abb9009e2df2f88c8906fa999a1cb5ba7df /arch
parent9b21d37838fca95c85b10abf48f3059236ad5d6c (diff)
downloadlinux-stable-fc7e5dd63936d19bbe2bb002780c06dc1cdd20a1.tar.gz
linux-stable-fc7e5dd63936d19bbe2bb002780c06dc1cdd20a1.tar.bz2
linux-stable-fc7e5dd63936d19bbe2bb002780c06dc1cdd20a1.zip
ARM: 8165/1: alignment: don't break misaligned NEON load/store
commit 5ca918e5e3f9df4634077c06585c42bc6a8d699a upstream. The alignment fixup incorrectly decodes faulting ARM VLDn/VSTn instructions (where the optional alignment hint is given but incorrect) as LDR/STR, leading to register corruption. Detect these and correctly treat them as unhandled, so that userspace gets the fault it expects. Reported-by: Simon Hosie <simon.hosie@arm.com> Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/alignment.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 6f4585b89078..1fe0bf5c7375 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -39,6 +39,7 @@
* This code is not portable to processors with late data abort handling.
*/
#define CODING_BITS(i) (i & 0x0e000000)
+#define COND_BITS(i) (i & 0xf0000000)
#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
@@ -812,6 +813,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
break;
case 0x04000000: /* ldr or str immediate */
+ if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */
+ goto bad;
offset.un = OFFSET_BITS(instr);
handler = do_alignment_ldrstr;
break;