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:   Mon, 11 Jun 2018 09:50:35 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Nadav Amit <namit@...are.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kate Stewart <kstewart@...uxfoundation.org>,
        Philippe Ombredanne <pombredanne@...b.com>
Subject: Re: [PATCH v3 9/9] x86: jump-labels: use macros instead of inline
 assembly

On Sun, Jun 10, 2018 at 07:19:11AM -0700, Nadav Amit wrote:
>  static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
>  {
> +	asm_volatile_goto("STATIC_BRANCH_GOTO l_yes=\"%l[l_yes]\" key=\"%c0\" "
> +			  "branch=\"%c1\""
> +			: :  "i" (key), "i" (branch) : : l_yes);
>  
>  	return false;
>  l_yes:
> @@ -48,13 +44,8 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
>  
>  static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
>  {
> +	asm_volatile_goto("STATIC_BRANCH_JUMP_GOTO l_yes=\"%l[l_yes]\" key=\"%c0\" "
> +			  "branch=\"%c1\""
>  		: :  "i" (key), "i" (branch) : : l_yes);
>  
>  	return false;
> @@ -108,6 +99,26 @@ struct jump_entry {
>  	.popsection
>  .endm
>  
> +.macro STATIC_BRANCH_GOTO l_yes:req key:req branch:req

STATIC_BRANCH_NOP

> +1:
> +	.byte STATIC_KEY_INIT_NOP
> +	.pushsection __jump_table, "aw"
> +	_ASM_ALIGN
> +	_ASM_PTR 1b, \l_yes, \key + \branch
> +	.popsection
> +.endm
> +
> +.macro STATIC_BRANCH_JUMP_GOTO l_yes:req key:req branch:req

STATIC_BRANCH_JMP

> +1:
> +	.byte 0xe9
> +	.long \l_yes - 2f
> +2:
> +	.pushsection __jump_table, "aw"
> +	_ASM_ALIGN
> +	_ASM_PTR 1b, \l_yes, \key + \branch
> +	.popsection
> +.endm
> +
>  #endif	/* __ASSEMBLY__ */


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ