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:   Sun, 12 Jul 2020 23:57:23 -0400
From:   Arvind Sankar <nivedita@...m.mit.edu>
To:     Arvind Sankar <nivedita@...m.mit.edu>
Cc:     Jian Cai <caij2003@...il.com>, jiancai@...gle.com,
        ndesaulniers@...gle.com, manojgupta@...gle.com,
        sedat.dilek@...il.com, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Alexandre Chartre <alexandre.chartre@...cle.com>,
        linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH] x86/entry: add compatibility with IAS

On Sun, Jul 12, 2020 at 10:54:29PM -0400, Arvind Sankar wrote:
> On Sun, Jul 12, 2020 at 06:24:22PM -0700, Jian Cai wrote:
> > Clang's integrated assembler does not allow symbols with non-absolute
> > values to be reassigned. This patch allows the affected code to be
> > compatible with IAS.
> > 
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1043
> > Reported-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > Reported-by: Sedat Dilek <sedat.dilek@...il.com>
> > Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > Tested-by: Sedat Dilek <sedat.dilek@...il.com>
> > Signed-off-by: Jian Cai <caij2003@...il.com>
> > ---
> >  arch/x86/include/asm/idtentry.h | 22 ++++++++++------------
> >  1 file changed, 10 insertions(+), 12 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
> > index f3d70830bf2a..77beed2cd6d9 100644
> > --- a/arch/x86/include/asm/idtentry.h
> > +++ b/arch/x86/include/asm/idtentry.h
> > @@ -468,34 +468,32 @@ __visible noinstr void func(struct pt_regs *regs,			\
> >   */
> >  	.align 8
> >  SYM_CODE_START(irq_entries_start)
> > -    vector=FIRST_EXTERNAL_VECTOR
> > -    pos = .
> > +    i = 1
> > +    pos1 = .
> >      .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
> >  	UNWIND_HINT_IRET_REGS
> > -	.byte	0x6a, vector
> > +	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i - 1
> >  	jmp	asm_common_interrupt
> >  	nop
> >  	/* Ensure that the above is 8 bytes max */
> > -	. = pos + 8
> > -    pos=pos+8
> > -    vector=vector+1
> > +	. = pos1 + 8 * i
> > +	i = i + 1
> >      .endr
> >  SYM_CODE_END(irq_entries_start)
> 
> I think it would be a little cleaner to initialize i to 0, and drop pos.
> i.e. couldn't we do
> 	i = 0
> 	...
> 	.byte	0x6a, FIRST_EXTERNAL_VECTOR + i
> 	...
> 	i = i + 1
> 	. = irq_entries_start + 8 * i
> 

Or maybe just:

diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
index eeac6dc2adaa..c774039d130b 100644
--- a/arch/x86/include/asm/idtentry.h
+++ b/arch/x86/include/asm/idtentry.h
@@ -469,15 +469,14 @@ __visible noinstr void func(struct pt_regs *regs,			\
 	.align 8
 SYM_CODE_START(irq_entries_start)
     vector=FIRST_EXTERNAL_VECTOR
-    pos = .
     .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
+    0:
 	UNWIND_HINT_IRET_REGS
 	.byte	0x6a, vector
 	jmp	asm_common_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
+	. = 0b + 8
     vector=vector+1
     .endr
 SYM_CODE_END(irq_entries_start)
@@ -486,15 +485,14 @@ SYM_CODE_END(irq_entries_start)
 	.align 8
 SYM_CODE_START(spurious_entries_start)
     vector=FIRST_SYSTEM_VECTOR
-    pos = .
     .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
+    0:
 	UNWIND_HINT_IRET_REGS
 	.byte	0x6a, vector
 	jmp	asm_spurious_interrupt
 	nop
 	/* Ensure that the above is 8 bytes max */
-	. = pos + 8
-    pos=pos+8
+	. = 0b + 8
     vector=vector+1
     .endr
 SYM_CODE_END(spurious_entries_start)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ