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  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:   Wed, 6 May 2020 18:28:48 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Sean Christopherson <sean.j.christopherson@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Andy Lutomirski <luto@...nel.org>,
        Alexandre Chartre <alexandre.chartre@...cle.com>,
        Frederic Weisbecker <frederic@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Joel Fernandes <joel@...lfernandes.org>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Juergen Gross <jgross@...e.com>,
        Brian Gerst <brgerst@...il.com>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Will Deacon <will@...nel.org>
Subject: Re: [patch V4 part 1 20/36] vmlinux.lds.h: Create section for
 protection against instrumentation

On Wed, May 06, 2020 at 09:08:31AM -0700, Sean Christopherson wrote:
> On Tue, May 05, 2020 at 03:16:22PM +0200, Thomas Gleixner wrote:
> > Provide also a set of markers: instr_begin()/end()
> > 
> > These are used to mark code inside a noinstr function which calls
> > into regular instrumentable text section as safe.
> 
> ...
> 
> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -120,10 +120,27 @@ void ftrace_likely_update(struct ftrace_
> >  /* Annotate a C jump table to allow objtool to follow the code flow */
> >  #define __annotate_jump_table __section(.rodata..c_jump_table)
> >  
> > +/* Begin/end of an instrumentation safe region */
> > +#define instr_begin() ({						\
> > +	asm volatile("%c0:\n\t"						\
> > +		     ".pushsection .discard.instr_begin\n\t"		\
> > +		     ".long %c0b - .\n\t"				\
> > +		     ".popsection\n\t" : : "i" (__COUNTER__));		\
> > +})
> > +
> > +#define instr_end() ({							\
> > +	asm volatile("%c0:\n\t"						\
> > +		     ".pushsection .discard.instr_end\n\t"		\
> > +		     ".long %c0b - .\n\t"				\
> > +		     ".popsection\n\t" : : "i" (__COUNTER__));		\
> > +})
> 
> Any chance we could spell these out, i.e. instrumentation_begin/end()?  I
> can't help but read these as "instruction_begin/end".  At a glance, the
> long names shouldn't cause any wrap/indentation issues.

The kernel naming convention is insn for instruction, not instr. That
said, you're not the first to be confused by this.

Powered by blists - more mailing lists