From: viktor.rosendahl@nokia.com (Viktor Rosendahl)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] kprobes/arm: fix emulation of LDR/STR instruction when Rn == PC
Date: Mon, 28 Mar 2011 19:27:59 +0300 [thread overview]
Message-ID: <4D90B70F.7050108@nokia.com> (raw)
In-Reply-To: <1301087944.2744.85.camel@computer2.home>
On 03/25/2011 11:19 PM, ext Tixy wrote:
>
>> Regarding the second point above, it would possibly be prudent to add some
>> checking to prep_emulate_ldr_str(), so that instructions with write back and
>> Rn == PC would be rejected.
>
> I don't think it is worth adding code to check for illegal instructions.
> The toolchain shouldn't generate them in the first place, and there are
> many places in the kprobe code which doesn't bother checking; there are
> even comments like "may be invalid, don't care".
I think those "may be invalid, don't care" comments mostly are about the
Rm value, which isn't valid for some fully legal variants of the
instruction, those instructions that have the immediate bit set. In that
case the Rm value, will actually be part of an immediate and thus bogus.
However, it will not impact the result of the emulation because the
instruction will not read from the r2 register. It's enough to check the
immediate bit in the prep_emulate_*() functions; if you check for
example the prep_emulate_ldr_str() function you will se that it actually
does it before adjusting Rm to r2.
To summarize, I think the "may be invalid, don't care" comments simply
mean "This value may be bogus but in that case it will not impact the
result of the emulation so we don't care".
>
> I'm currently working on implementing Thumb support in kprobes and am
> writing test code as part of that. I planned on adding test cases for
> ARM so hopefully will catch a few more instruction emulation bugs (if
> there are any to be found).
>
Nice.
next prev parent reply other threads:[~2011-03-28 16:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 17:01 [PATCH] kprobes/arm: fix emulation of LDR/STR instruction when Rn == PC Viktor Rosendahl
2011-03-25 21:19 ` Tixy
2011-03-28 15:56 ` [PATCH] Fix ldrd/strd emulation for kprobes/ARM Viktor Rosendahl
2011-03-28 22:39 ` Nicolas Pitre
2011-03-29 11:26 ` Viktor Rosendahl
2011-03-29 16:55 ` Nicolas Pitre
2011-03-29 18:31 ` Russell King - ARM Linux
2011-03-29 18:44 ` Nicolas Pitre
2011-03-30 13:42 ` [PATCH] Reject kprobes when Rn==15 and writeback is set Viktor Rosendahl
2011-03-30 15:52 ` Tixy
2011-03-30 16:46 ` Viktor Rosendahl
2011-03-30 17:20 ` Tixy
2011-03-30 17:59 ` Nicolas Pitre
2011-03-30 19:39 ` Tixy
2011-03-30 20:48 ` Nicolas Pitre
2011-03-30 14:09 ` [PATCH] Fix ldrd/strd emulation for kprobes/ARM Viktor Rosendahl
2011-03-29 12:55 ` Tixy
2011-03-29 13:46 ` Viktor Rosendahl
2011-03-29 14:03 ` Tixy
2011-03-29 17:07 ` Nicolas Pitre
2011-03-28 16:27 ` Viktor Rosendahl [this message]
2011-03-29 9:12 ` [PATCH] kprobes/arm: fix emulation of LDR/STR instruction when Rn == PC Tixy
2011-03-26 2:03 ` Nicolas Pitre
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=4D90B70F.7050108@nokia.com \
--to=viktor.rosendahl@nokia.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).