[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180118153131.GG2249@hirez.programming.kicks-ass.net>
Date: Thu, 18 Jan 2018 16:31:31 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: David Woodhouse <dwmw2@...radead.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
linux-kernel@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
Ashok Raj <ashok.raj@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
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>
Subject: Re: [PATCH v2 07/10] x86/jump_label: Implement arch_static_assert()
On Thu, Jan 18, 2018 at 02:33:22PM +0100, Borislav Petkov wrote:
> On Tue, Jan 16, 2018 at 03:28:32PM +0100, Peter Zijlstra wrote:
> > Implement the static (branch) assertion. It simply emits the address
> > of the next instruction into a special section which objtool will read
> > and validate against either __jump_table or .altinstructions.
> >
> > Use like:
> >
> > if (static_branch_likely(_key)) {
> > arch_static_assert();
> > /* do stuff */
> > }
> >
> > Or
> >
> > if (static_cpu_has(_feat)) {
> > arch_static_assert();
>
> It looks to me like the asserts can be moved into the macros and the
> assertion checking can happen by default ...?
Right until the point where someone writes:
if (static_cpu_has(_feat) || ponies)
at which point it, rightfully, unconditionally asserts.
Not sure someone does that with static_cpu_has(), but there's
static_branch*() users that do exactly that.
Powered by blists - more mailing lists