[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170714152503.GC16687@leverpostej>
Date: Fri, 14 Jul 2017 16:25:03 +0100
From: Mark Rutland <mark.rutland@....com>
To: Robin Murphy <robin.murphy@....com>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Kees Cook <keescook@...omium.org>,
Kernel Hardening <kernel-hardening@...ts.openwall.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
James Morse <james.morse@....com>,
Takahiro Akashi <akashi.takahiro@...aro.org>,
Dave Martin <dave.martin@....com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Laura Abbott <labbott@...oraproject.org>
Subject: Re: [kernel-hardening] Re: [RFC PATCH 6/6] arm64: add VMAP_STACK and
detect out-of-bounds SP
On Fri, Jul 14, 2017 at 04:03:51PM +0100, Robin Murphy wrote:
> On 14/07/17 15:39, Robin Murphy wrote:
> > On 14/07/17 15:06, Mark Rutland wrote:
> >> add sp, sp, x0 // sp = orig_sp + orig_x0
> >> sub x0, sp, x0 // x0 = orig_sp
> >> < check >
> >> sub x0, sp, x0 // x0 = orig_x0
> >
> > Haven't you now forcibly cleared the top bit of x0 thanks to overflow?
>
> ...or maybe not. I still can't quite see it, but I suppose it must
> cancel out somewhere, since Mr. Helpful C Program[1] has apparently
> proven me mistaken :(
>
> I guess that means I approve!
>
> Robin.
>
> [1]:
> #include <assert.h>
> #include <stdint.h>
>
> int main(void) {
> for (int i = 0; i < 256; i++) {
> for (int j = 0; j < 256; j++) {
> uint8_t x = i;
> uint8_t y = j;
> y = y + x;
> x = y - x;
> x = y - x;
> y = y - x;
> assert(x == i && y == j);
> }
> }
> }
I guess we have our first Tested-by for this series. :)
Thanks for taking a look!
Mark.
Powered by blists - more mailing lists