From: Sasha Levin <sasha.levin@oracle.com>
To: "H. Peter Anvin" <hpa@zytor.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: vegard.nossum@oracle.com, penberg@kernel.org,
jamie.iles@oracle.com, mingo@redhat.com, tglx@linutronix.de,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] x86/insn: Extract more information about instructions
Date: Thu, 17 Apr 2014 13:31:36 -0400 [thread overview]
Message-ID: <53500FF8.8010804@oracle.com> (raw)
In-Reply-To: <534FF31E.1000104@zytor.com>
On 04/17/2014 11:28 AM, H. Peter Anvin wrote:
> On 04/17/2014 08:20 AM, Sasha Levin wrote:
>>
>> It's not like the instruction decoder is a generic piece of code right now anyways,
>> it only serves mostly [k,u]probes and was built around the their requirements, and
>> now everybody are surprised that kmemcheck has different requirements than kprobes.
>>
>
> What *ARE* kmemcheck's requirements? That's the real issue, I believe.
As far as kmemcheck is concerned, it needs to decode instructions so that
it could learn whether an instruction will access memory, and if it does -
the size of memory an instruction attempts to access.
Note that right now kmemcheck implements a dumb instruction decoder (see
arch/x86/mm/kmemcheck/opcode.c) which works for most cases, but breaks on
more than few. The first patch in this series adds a few cases where that
decoder will fail.
This is the main purpose of the patch series. We want to switch kmemcheck
to use the generic instruction decoder to avoid bugs found in the dumbed
down instruction decoder used by kmemcheck.
On top of that, there are several features which need to know more about
instructions:
1. kmemcheck wants to know if a given instruction may act on only part of
the memory it addresses, or all of it. This solves the problem of partially
initialized bitfields where uninitialized bits are never accessed.
For the above, kmemcheck needs to recognize whether an instruction is AND,
OR or XOR.
2. There are two sets of instructions, MOVS and CMPS which work a bit
differently than the rest. They take two memory addresses but will
generate only one page fault on access, which will make kmemcheck miss
a memory access.
kmemcheck needs to know if an instruction is a MOVS or CMPS to deal with
that corner case properly.
> I also have seen several attempts at using the generic instruction
> decoder which has resulted in more complexity, not less, because of
> excess generality, so it is not an obvious thing.
Let's split this patchset into two:
We have one part which moves kmemcheck to the generic instruction decoder
and adds memory access size to the instruction decoder. There seems to be
no objection to that part beyond technical issues regarding how we store
the new size value.
The other part is adding mnemonics to the instruction decoder. If my
explanation above makes sense, and kmemcheck does need to know about AND,
OR, XOR, MOVS and CMPS then let me know how to proceed about changing
the instruction decoder to add that functionality.
If I'm wrong about needing to know about those mnemonics, I'd be happy
to fix that issue in kmemcheck, but for that I need to know why I'm
wrong.
Thanks,
Sasha
next prev parent reply other threads:[~2014-04-17 17:32 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 17:44 [PATCH 1/4] kmemcheck: add additional selfchecks Sasha Levin
2014-04-14 17:44 ` [PATCH 2/4] x86: Move instruction decoder data into header Sasha Levin
2014-04-15 1:41 ` Masami Hiramatsu
2014-04-15 2:28 ` Sasha Levin
2014-04-15 3:10 ` Masami Hiramatsu
2014-04-15 14:24 ` Sasha Levin
2014-04-16 3:06 ` Masami Hiramatsu
2014-04-14 17:44 ` [PATCH 3/4] x86/insn: Extract more information about instructions Sasha Levin
2014-04-15 3:12 ` Masami Hiramatsu
2014-04-15 4:36 ` Masami Hiramatsu
2014-04-15 15:10 ` Sasha Levin
2014-04-16 3:26 ` H. Peter Anvin
2014-04-16 3:47 ` Sasha Levin
2014-04-16 3:54 ` H. Peter Anvin
2014-04-16 4:03 ` Sasha Levin
2014-04-16 4:31 ` H. Peter Anvin
2014-04-16 5:30 ` Masami Hiramatsu
2014-04-17 15:20 ` Sasha Levin
2014-04-17 15:28 ` H. Peter Anvin
2014-04-17 17:31 ` Sasha Levin [this message]
2014-04-18 3:40 ` Masami Hiramatsu
2014-04-18 3:45 ` H. Peter Anvin
2014-04-18 15:47 ` Sasha Levin
2014-04-18 16:48 ` H. Peter Anvin
2014-04-16 5:44 ` Masami Hiramatsu
2014-04-17 15:33 ` Sasha Levin
2014-04-18 3:25 ` Masami Hiramatsu
2014-04-14 17:44 ` [PATCH 4/4] kmemcheck: Switch to using kernel disassembler Sasha Levin
2014-04-15 8:17 ` Pekka Enberg
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=53500FF8.8010804@oracle.com \
--to=sasha.levin@oracle.com \
--cc=hpa@zytor.com \
--cc=jamie.iles@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@redhat.com \
--cc=penberg@kernel.org \
--cc=tglx@linutronix.de \
--cc=vegard.nossum@oracle.com \
--cc=x86@kernel.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).