[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170207175542.GC26173@leverpostej>
Date: Tue, 7 Feb 2017 17:55:42 +0000
From: Mark Rutland <mark.rutland@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Kees Cook <keescook@...omium.org>,
"Reshetova, Elena" <elena.reshetova@...el.com>,
Greg KH <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
"H. Peter Anvin" <h.peter.anvin@...el.com>,
Will Deacon <will.deacon@....com>,
David Windsor <dwindsor@...il.com>,
Hans Liljestrand <ishkamiel@...il.com>,
David Howells <dhowells@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
"kernel-hardening@...ts.openwall.com"
<kernel-hardening@...ts.openwall.com>
Subject: Re: [kernel-hardening] Re: [PATCH 4/4] refcount: Report failures
through CHECK_DATA_CORRUPTION
On Tue, Feb 07, 2017 at 06:30:36PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 07, 2017 at 04:03:01PM +0000, Mark Rutland wrote:
> > For x86 it's a little painful due to '%' in the register names, but it looks
> > possible. The below appears to do the mangling correctly (then screams due to
> > the mangled result being nonexistent).
>
> > asm(
> > " .macro reg_to_offset r\n"
> > " .irp rs,eax,ebx,ecx,edx\n"
> > " .ifc \\r, %\\rs\n"
> > " __offset_of_\\rs\n"
> > " .endif\n"
> > " .endr\n"
> > " .endm\n"
> > );
> >
> > #define asm_sym(var) asm volatile("reg_to_offset %0\n" : : "r" (var))
>
> Oh gawd that's a most gnarly hack.
:)
> Do we want to go do that for all archs or somehow cook a generic
> fallback that ends up doing a full function call or something?
Given the arch-specific reg->blah mapping is so "fun", I guess a generic
fallback would be a good start.
I haven't figured out all the plumbing details. It'd be nice to reuse
the bug infrastructure so that arches don't have to implement another
trap and callback pair, but I guess the reg details need to live in
another data structure.
Thanks,
Mark.
Powered by blists - more mailing lists