Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51468ea9 authored by Jon Medhurst's avatar Jon Medhurst Committed by Nicolas Pitre
Browse files

ARM: kprobes: Reject probing MRS instructions which read SPSR



We need to reject probing of instructions which read SPSR because
we can't handle this as the value in SPSR is lost when the exception
handler for the probe breakpoint first runs.

This patch also fixes the bitmask for MRS instructions decoding to
include checking bits 5-7.

Signed-off-by: default avatarJon Medhurst <tixy@yxit.co.uk>
Signed-off-by: default avatarNicolas Pitre <nicolas.pitre@linaro.org>
parent 896a74e1
Loading
Loading
Loading
Loading
+7 −5
Original line number Original line Diff line number Diff line
@@ -1028,12 +1028,14 @@ space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)


		/* BXJ      : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */
		/* BXJ      : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */
		/* MSR      : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */
		/* MSR      : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */
		/* MRS spsr : cccc 0001 0100 xxxx xxxx xxxx 0000 xxxx */
		if ((insn & 0x0ff000f0) == 0x01200020 ||
		if ((insn & 0x0ff000f0) == 0x01200020 ||
		    (insn & 0x0fb000f0) == 0x01200000)
		    (insn & 0x0fb000f0) == 0x01200000 ||
		    (insn & 0x0ff000f0) == 0x01400000)
			return INSN_REJECTED;
			return INSN_REJECTED;


		/* MRS : cccc 0001 0x00 xxxx xxxx xxxx 0000 xxxx */
		/* MRS cpsr : cccc 0001 0000 xxxx xxxx xxxx 0000 xxxx */
		if ((insn & 0x0fb00010) == 0x01000000)
		if ((insn & 0x0ff000f0) == 0x01000000)
			return prep_emulate_rd12(insn, asi);
			return prep_emulate_rd12(insn, asi);


		/* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */
		/* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */