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]
Message-ID: <20180108104512.GG3040@hirez.programming.kicks-ass.net>
Date:   Mon, 8 Jan 2018 11:45:12 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     David Woodhouse <dwmw@...zon.co.uk>
Cc:     Andi Kleen <ak@...ux.intel.com>, Paul Turner <pjt@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...ux-foundation.org>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Dave Hansen <dave.hansen@...el.com>, tglx@...utronix.de,
        Kees Cook <keescook@...gle.com>,
        Rik van Riel <riel@...hat.com>,
        Andy Lutomirski <luto@...capital.net>,
        Jiri Kosina <jikos@...nel.org>, gnomes@...rguk.ukuu.org.uk
Subject: Re: [PATCH v6 01/10] x86/retpoline: Add initial retpoline support

On Sun, Jan 07, 2018 at 10:11:16PM +0000, David Woodhouse wrote:
> +#ifdef __ASSEMBLY__
> +
> +/*
> + * These are the bare retpoline primitives for indirect jmp and call.
> + * Do not use these directly; they only exist to make the ALTERNATIVE
> + * invocation below less ugly.
> + */
> +.macro RETPOLINE_JMP reg:req
> +	call	1112f
> +1111:	pause
> +	jmp	1111b
> +1112:	mov	\reg, (%_ASM_SP)
> +	ret
> +.endm

Should this not use local name labels instead?

.macro RETPOLINE_JMP reg:req
	call	.Ldo_rop_\@
.Lspec_trap_\@:
	pause
	jmp .Lspec_trap_\@
.Ldo_rop_\@:
	mov	\reg, (%_ASM_SP)
	ret
.endm

And I suppose it might be nice to put a little comment with them
explaining how they work.

> +/*
> + * For i386 we use the original ret-equivalent retpoline, because
> + * otherwise we'll run out of registers. We don't care about CET
> + * here, anyway.
> + */
> +# define NOSPEC_CALL ALTERNATIVE(				\
> +	"call	*%[thunk_target]\n",				\
> +	"       jmp    1113f; "					\
> +	"1110:  call   1112f; "					\
> +	"1111:	pause; "					\
> +	"       jmp    1111b; "					\
> +	"1112:	addl   $4, %%esp; "				\
> +	"       pushl  %[thunk_target]; "			\
> +	"       ret; "						\
> +	"1113:  call   1110b;\n",				\
> +	X86_FEATURE_RETPOLINE)

Ideally this would too, just not sure that works in inline asm.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ