[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1516963534.30244.191.camel@infradead.org>
Date: Fri, 26 Jan 2018 10:45:34 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Josh Poimboeuf <jpoimboe@...hat.com>
Cc: linux-kernel@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg KH <gregkh@...uxfoundation.org>,
Andrea Arcangeli <aarcange@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Arjan Van De Ven <arjan.van.de.ven@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Jun Nakajima <jun.nakajima@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>,
Jason Baron <jbaron@...mai.com>, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH 13/24] objtool: Implement base jump_assert support
On Tue, 2018-01-23 at 16:25 +0100, Peter Zijlstra wrote:
> Implement a jump_label assertion that asserts that the code location
> is indeed only reachable through a static_branch. Because if GCC is
> absolutely retaded it could generate code like:
>
> xor rax,rax
> NOP/JMP 1f
> mov $1, rax
> 1:
> test rax,rax
> jz 2f
>
> 2:
>
> instead of the sensible:
>
> NOP/JMP 1f
>
> 1:
>
> This implements objtool infrastructure for ensuring the code ends up
> sane, since we'll rely on that for correctness and security.
>
> We tag the instructions after the static branch with static_jump_dest=true;
> that is the instruction after the NOP and the instruction at the
> JMP+disp site.
>
> Then, when we read the .discard.jump_assert section, we assert that
> each entry points to an instruction that has static_jump_dest set.
>
> With this we can assert that the code emitted for the if statement
> ends up at the static jump location and nothing untowards happened.
>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Josh Poimboeuf <jpoimboe@...hat.com>
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Thank you for pandering to my paranoia. I suspect that misspelling the
word 'retarded' isn't going to be sufficient to stop people from
objecting to the use of that word, but other than that,
Reviewed-by: David Woodhouse <dwmw@...zon.co.uk>
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (5213 bytes)
Powered by blists - more mailing lists