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:   Tue, 28 Apr 2020 18:08:15 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Arnd Bergmann <arnd@...db.de>,
        the arch/x86 maintainers <x86@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>
Subject: Re: Remaining randconfig objtool warnings, linux-next-20200428

On Tue, Apr 28, 2020 at 05:48:38PM -0500, Josh Poimboeuf wrote:
> On Wed, Apr 29, 2020 at 12:33:27AM +0200, Peter Zijlstra wrote:
> > On Tue, Apr 28, 2020 at 05:03:53PM -0500, Josh Poimboeuf wrote:
> > > On Tue, Apr 28, 2020 at 11:55:54PM +0200, Peter Zijlstra wrote:
> > 
> > > > binutils.git/gas/configure/tc-i386.c:i386_generate_nops
> > > > 
> > > > When there's too many NOPs (as here) it generates a JMP across the NOPS.
> > > > It makes some sort of sense, at some point executing NOPs is going to be
> > > > more expensive than a branch.. But shees..
> > > 
> > > Urgh.  Even if I tell it specifically to pad with NOPs, it still does
> > > this "trick".  I have no idea how to deal with this in objtool.
> > 
> > This is horrible... but it _might_ just work.
> 
> HAHA, nice.
> 
> This seems to work:

More sophisticated version:

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3063aa9090f9..f9082673f84c 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -597,8 +597,22 @@ SYM_CODE_START_LOCAL(common_spurious)
 SYM_CODE_END(common_spurious)
 _ASM_NOKPROBE(common_spurious)
 
+/*
+ * For .p2align NOP padding with shift >= 7, if the gap is big enough, the GNU
+ * assembler decides to insert a JMP in the padding, which makes objtool sad.
+ * Force it to NOPs only, by splitting it into smaller alignments if necessary.
+ */
+.macro P2ALIGN shift
+	tmp=6
+	.rept \shift-6
+		.p2align tmp
+		tmp=tmp+1
+	.endr
+	.p2align \shift
+.endm
+
 /* common_interrupt is a hotpath. Align it */
-	.p2align CONFIG_X86_L1_CACHE_SHIFT
+P2ALIGN shift=CONFIG_X86_L1_CACHE_SHIFT
 SYM_CODE_START_LOCAL(common_interrupt)
 	addq	$-0x80, (%rsp)			/* Adjust vector to [-256, -1] range */
 	call	interrupt_entry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ