lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <350cf38eb8b9008d14a51ef7e0f8099644c8b97f.1434598237.git.panand@redhat.com>
Date:	Thu, 18 Jun 2015 09:28:57 +0530
From:	Pratyush Anand <panand@...hat.com>
To:	linux-arm-kernel@...ts.infradead.org, linux@....linux.org.uk,
	catalin.marinas@....com, will.deacon@....com
Cc:	linux-kernel@...r.kernel.org, wcohen@...hat.com, oleg@...hat.com,
	dave.long@...aro.org, steve.capper@...aro.org,
	srikar@...ux.vnet.ibm.com, vijaya.kumar@...iumnetworks.com
Subject: [RFC PATCH V2 10/10] arm64: uprobes: check conditions before simulating instructions

From: Steve Capper <steve.capper@...aro.org>

Currently uprobes just simulates any instruction that it can't in
place execute. This can lead to unpredictable behaviour if the
execution condition fails and the instruction wouldn't otherwise
have been executed.

This patch adds the condition check

Signed-off-by: Steve Capper <steve.capper@...aro.org>
---
 arch/arm64/kernel/uprobes.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/uprobes.c b/arch/arm64/kernel/uprobes.c
index 2cc9114deac2..a6d12b81e9ae 100644
--- a/arch/arm64/kernel/uprobes.c
+++ b/arch/arm64/kernel/uprobes.c
@@ -119,15 +119,22 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
 {
 	kprobe_opcode_t insn;
 	unsigned long addr;
+	struct arch_specific_insn *ainsn;
 
 	if (!auprobe->simulate)
 		return false;
 
 	insn = *(kprobe_opcode_t *)(&auprobe->insn[0]);
 	addr = instruction_pointer(regs);
+	ainsn = &auprobe->ainsn;
+
+	if (ainsn->handler) {
+		if (!ainsn->check_condn || ainsn->check_condn(insn, ainsn, regs))
+			ainsn->handler(insn, addr, regs);
+		else
+			instruction_pointer_set(regs, instruction_pointer(regs) + 4);
+	}
 
-	if (auprobe->ainsn.handler)
-		auprobe->ainsn.handler(insn, addr, regs);
 
 	return true;
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ