[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200407181325.GJ20730@hirez.programming.kicks-ass.net>
Date: Tue, 7 Apr 2020 20:13:25 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kees Cook <keescook@...omium.org>
Cc: tglx@...utronix.de, linux-kernel@...r.kernel.org,
hch@...radead.org, sean.j.christopherson@...el.com,
mingo@...hat.com, bp@...en8.de, hpa@...or.com, x86@...nel.org,
kenny@...ix.com, jeyu@...nel.org, rasmus.villemoes@...vas.dk,
pbonzini@...hat.com, fenghua.yu@...el.com, xiaoyao.li@...el.com,
nadav.amit@...il.com, thellstrom@...are.com, tony.luck@...el.com,
rostedt@...dmis.org, gregkh@...uxfoundation.org, jannh@...gle.com,
David.Laight@...lab.com, dcovelli@...are.com, mhiramat@...nel.org
Subject: Re: [PATCH 4/4] x86,module: Detect CRn and DRn manipulation
On Tue, Apr 07, 2020 at 10:01:04AM -0700, Kees Cook wrote:
> On Tue, Apr 07, 2020 at 01:02:40PM +0200, Peter Zijlstra wrote:
> > Since we now have infrastructure to analyze module text, disallow
> > modules that write to CRn and DRn registers.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > ---
> > arch/x86/kernel/module.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > --- a/arch/x86/kernel/module.c
> > +++ b/arch/x86/kernel/module.c
> > @@ -266,6 +266,22 @@ static bool insn_is_vmx(struct insn *ins
> > return false;
> > }
> >
> > +static bool insn_is_mov_CRn(struct insn *insn)
> > +{
> > + if (insn->opcode.bytes[0] == 0x0f && insn->opcode.bytes[1] == 0x22)
> > + return true;
>
> I always cringe at numeric literals. Would it be overkill to add defines
> for these (and the others that have comments next to them in 3/4)? It
> makes stuff easier to grep, etc. (e.g. we have register names in
> arch/x86/include/asm/asm.h, do we need instruction names somewhere else?
> I assume objtool has a bunch of this too...)
objtool does not, have a peek at tools/objtool/arch/x86/decode.c
I'm not sure what the best way is here, the x86 opcode map is a
disaster. Even the mnemonic doesn't help us here, as that's just MOV :/
Powered by blists - more mailing lists