Skip to content

Commit e5b83a0

Browse files
rmurphy-armgregkh
authored andcommitted
ARM: 8165/1: alignment: don't break misaligned NEON load/store
commit 5ca918e 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 <[email protected]> Signed-off-by: Robin Murphy <[email protected]> Signed-off-by: Russell King <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 32e8dec commit e5b83a0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm/mm/alignment.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* This code is not portable to processors with late data abort handling.
4242
*/
4343
#define CODING_BITS(i) (i & 0x0e000000)
44+
#define COND_BITS(i) (i & 0xf0000000)
4445

4546
#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
4647
#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
@@ -819,6 +820,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
819820
break;
820821

821822
case 0x04000000: /* ldr or str immediate */
823+
if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */
824+
goto bad;
822825
offset.un = OFFSET_BITS(instr);
823826
handler = do_alignment_ldrstr;
824827
break;

0 commit comments

Comments
 (0)