lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 Jul 2020 11:53:42 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org, mhiramat@...nel.org,
        bristot@...hat.com, jbaron@...mai.com,
        torvalds@...ux-foundation.org, tglx@...utronix.de,
        mingo@...nel.org, namit@...are.com, hpa@...or.com, luto@...nel.org,
        ard.biesheuvel@...aro.org, jpoimboe@...hat.com,
        pbonzini@...hat.com, mathieu.desnoyers@...icios.com,
        linux@...musvillemoes.dk
Subject: Re: [PATCH v6 13/17] static_call: Add static_call_cond()

On Mon, Jul 13, 2020 at 04:32:39PM -0400, Steven Rostedt wrote:
> On Sat, 11 Jul 2020 12:49:30 +0200
> Peter Zijlstra <peterz@...radead.org> wrote:
> > 
> > Something like so (on top of the next patch) ?
> > 
> > I'm not convinced it actually helps much, but if it makes you feel
> > better :-)
> 
> After you have bricked a bunch of people's NICs, you would be paranoid
> about this too!
> 
> You work for Intel, next time you go to an office, see if you can find
> my picture on any dartboards in there ;-)

I'll tell em it was bad hardware for being able to get bricked like that
instead, how's that? ;-)

> > --- a/arch/x86/kernel/static_call.c
> > +++ b/arch/x86/kernel/static_call.c
> > @@ -56,15 +56,36 @@ static inline enum insn_type __sc_insn(b
> >  	return 2*tail + null;
> >  }
> >  
> > +static void __static_call_validate(void *insn, bool tail)
> > +{
> > +	u8 opcode = *(u8 *)insn;
> > +
> > +	if (tail) {
> > +		if (opcode == JMP32_INSN_OPCODE ||
> > +		    opcode == RET_INSN_OPCODE)
> > +			return;
> > +	} else {
> > +		if (opcode == CALL_INSN_OPCODE ||
> > +		    !memcmp(insn, ideal_nops[NOP_ATOMIC5], 5))
> > +			return;
> > +	}
> > +
> > +	WARN_ONCE(1, "unexpected static_call insn opcode 0x%x at %pS\n", opcode, insn);
> > +}
> > +
> >  void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
> >  {
> >  	mutex_lock(&text_mutex);
> >  
> > -	if (tramp)
> > +	if (tramp) {
> > +		__static_call_validate(tramp, true);
> >  		__static_call_transform(tramp, __sc_insn(!func, true), func);
> > +	}
> >  
> > -	if (IS_ENABLED(CONFIG_HAVE_STATIC_CALL_INLINE) && site)
> > +	if (IS_ENABLED(CONFIG_HAVE_STATIC_CALL_INLINE) && site) {
> > +		__static_call_validate(site, tail);
> 
> I'd feel even more better if the validate failed, we just don't do the
> update.

It is either this or BUG()/panic(), you pick ;-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ