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: <20150702120932.GH4001@pd.tnic>
Date:	Thu, 2 Jul 2015 14:09:32 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Andy Lutomirski <luto@...nel.org>
Cc:	x86@...nel.org, linux-kernel@...r.kernel.org,
	Frédéric Weisbecker <fweisbec@...il.com>,
	Rik van Riel <riel@...hat.com>,
	Oleg Nesterov <oleg@...hat.com>,
	Denys Vlasenko <vda.linux@...glemail.com>,
	Kees Cook <keescook@...omium.org>,
	Brian Gerst <brgerst@...il.com>, paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH v4 14/17] x86/asm/entry/64: Migrate error and interrupt
 exit work to C

On Mon, Jun 29, 2015 at 12:33:46PM -0700, Andy Lutomirski wrote:
> Signed-off-by: Andy Lutomirski <luto@...nel.org>
> ---
>  arch/x86/entry/entry_64.S        | 63 +++++++++++-----------------------------
>  arch/x86/entry/entry_64_compat.S |  5 ++++
>  2 files changed, 22 insertions(+), 46 deletions(-)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index ce2c9049abef..08a37ec049f0 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -508,7 +508,16 @@ END(irq_entries_start)
>  
>  	testb	$3, CS(%rsp)
>  	jz	1f
> +
> +	/*
> +	 * IRQ from user mode.  Switch to kernel gsbase and inform context
> +	 * tracking that we're in kernel mode.
> +	 */
>  	SWAPGS
> +#ifdef CONFIG_CONTEXT_TRACKING
> +	call enter_from_user_mode
> +#endif

I think you can make this much cleaner by getting rid of the ifdeffery
and pushing it into the enter_from_user_mode() function:

__visible void enter_from_user_mode(void)
{
#ifdef CONFIG_CONTEXT_TRACKING

	...

#endif
}

The disadvantage of all that cleanliness is that we get one dumb

	call enter_from_user_mode

there to this abomination:

ffffffff810014f0 <enter_from_user_mode>:
ffffffff810014f0:       e8 db 97 67 00          callq  ffffffff8167acd0 <__fentry__>
ffffffff810014f5:       55                      push   %rbp
ffffffff810014f6:       48 89 e5                mov    %rsp,%rbp
ffffffff810014f9:       5d                      pop    %rbp
ffffffff810014fa:       c3                      retq   
ffffffff810014fb:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)

which sux.

We sure could use LTO here.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ