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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180116224955.zwfqr74agcy6qymw@treble>
Date:   Tue, 16 Jan 2018 16:49:55 -0600
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     David Woodhouse <dwmw2@...radead.org>,
        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>,
        Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH v2 03/10] x86: Add a type field to alt_instr

On Tue, Jan 16, 2018 at 03:28:28PM +0100, Peter Zijlstra wrote:
> Add a type field to the alternative description. For now this will be
> used to annotate static_cpu_has() but possible future uses include
> using it to implement alternative alignment and special NOP handling.
> 
> Suggested-by: Borislav Petkov <bp@...en8.de>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
>  arch/x86/include/asm/alternative-asm.h |    3 ++-
>  arch/x86/include/asm/alternative.h     |    6 +++++-
>  arch/x86/include/asm/cpufeature.h      |    2 ++
>  tools/objtool/special.c                |    2 +-
>  4 files changed, 10 insertions(+), 3 deletions(-)
> 
> --- a/arch/x86/include/asm/alternative-asm.h
> +++ b/arch/x86/include/asm/alternative-asm.h
> @@ -25,13 +25,14 @@
>   * enough information for the alternatives patching code to patch an
>   * instruction. See apply_alternatives().
>   */
> -.macro altinstruction_entry orig alt feature orig_len alt_len pad_len
> +.macro altinstruction_entry orig alt feature orig_len alt_len pad_len type=0
>  	.long \orig - .
>  	.long \alt - .
>  	.word \feature
>  	.byte \orig_len
>  	.byte \alt_len
>  	.byte \pad_len
> +	.byte \type
>  .endm
>  
>  /*
> --- a/arch/x86/include/asm/alternative.h
> +++ b/arch/x86/include/asm/alternative.h
> @@ -45,6 +45,8 @@
>  #define LOCK_PREFIX ""
>  #endif
>  
> +#define ALT_TYPE_DEFAULT	0
> +
>  struct alt_instr {
>  	s32 instr_offset;	/* original instruction */
>  	s32 repl_offset;	/* offset to replacement instruction */
> @@ -52,6 +54,7 @@ struct alt_instr {
>  	u8  instrlen;		/* length of original instruction */
>  	u8  replacementlen;	/* length of new instruction */
>  	u8  padlen;		/* length of build-time padding */
> +	u8  type;		/* type of alternative */
>  } __packed;

Should we put a comment above the struct with a reminder to also update
objtool ALT_ENTRY_SIZE (and possibly the ALT_*_OFFSET macros) when they
change the struct?

Unfortunately it's against policy to include kernel headers from the
tools subdirectory, so we generally have to either hard code things like
this, or have a duplicated header file which needs to be kept in sync.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ