mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wang Nan <wangnan0@huawei.com>
To: "David A. Long" <dave.long@linaro.org>,
	Russell King <linux@arm.linux.org.uk>,
	Jon Medhurst <tixy@linaro.org>,
	Taras Kondratiuk <taras.kondratiuk@linaro.org>,
	Ben Dooks <ben.dooks@codethink.co.uk>
Cc: Wang Nan <wangnan0@huawei.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <peifeiyue@huawei.com>
Subject: [PATCH] ARM: probes: return directly when emulate not set
Date: Wed, 27 Aug 2014 13:08:29 +0800	[thread overview]
Message-ID: <1409116109-67330-1-git-send-email-wangnan0@huawei.com> (raw)

When kprobe decoding instruction, original code calls instruction
specific decoder if emulate is set to false.  However, instructions with
DECODE_TYPE_EMULATE are in fact don't have their decoder. What in the
action table are in fact handlers.  For example:

	/* LDRD (immediate)	cccc 000x x1x0 xxxx xxxx xxxx 1101 xxxx */
	/* STRD (immediate)	cccc 000x x1x0 xxxx xxxx xxxx 1111 xxxx */
	DECODE_EMULATEX	(0x0e5000d0, 0x004000d0, PROBES_LDRSTRD,
						 REGS(NOPCWB, NOPCX, 0, 0, 0)),

	and

const union decode_action kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = {
	...
	[PROBES_LDRSTRD] = {.handler = emulate_ldrdstrd},
	...

In this situation, original code calls 'emulate_ldrdstrd' as a decoder,
which is obviously incorrect.

This patch makes it returns INSN_GOOD directly when 'emulate' is not
true.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: "David A. Long" <dave.long@linaro.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Taras Kondratiuk <taras.kondratiuk@linaro.org>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/kernel/probes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/kernel/probes.c b/arch/arm/kernel/probes.c
index a8ab540..1c77b8d 100644
--- a/arch/arm/kernel/probes.c
+++ b/arch/arm/kernel/probes.c
@@ -436,8 +436,7 @@ probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
 			struct decode_emulate *d = (struct decode_emulate *)h;
 
 			if (!emulate)
-				return actions[d->handler.action].decoder(insn,
-					asi, h);
+				return INSN_GOOD;
 
 			asi->insn_handler = actions[d->handler.action].handler;
 			set_emulated_insn(insn, asi, thumb);
-- 
1.8.4


             reply	other threads:[~2014-08-27  5:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-27  5:08 Wang Nan [this message]
2014-09-01 15:26 ` Jon Medhurst (Tixy)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409116109-67330-1-git-send-email-wangnan0@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=dave.long@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=peifeiyue@huawei.com \
    --cc=taras.kondratiuk@linaro.org \
    --cc=tixy@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®