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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 12 May 2022 19:24:25 +0200
From:   Heiko Carstens <hca@...ux.ibm.com>
To:     Nathan Chancellor <nathan@...nel.org>
Cc:     Vasily Gorbik <gor@...ux.ibm.com>,
        Alexander Gordeev <agordeev@...ux.ibm.com>,
        Jonas Paulsson <paulsson@...ux.vnet.ibm.com>,
        Ulrich Weigand <ulrich.weigand@...ibm.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Alexander Egorenkov <egorenar@...ux.ibm.com>,
        Sven Schnelle <svens@...ux.ibm.com>,
        Andreas Krebbel <krebbel@...ux.ibm.com>,
        Nathan Chancellor <natechancellor@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org
Subject: Re: [PATCH 4/8] s390/entry: workaround llvm's IAS limitations

On Wed, May 11, 2022 at 10:30:05AM -0700, Nathan Chancellor wrote:
> Hi Heiko,
> 
> On Wed, May 11, 2022 at 02:05:28PM +0200, Heiko Carstens wrote:
> > llvm's integrated assembler cannot handle immediate values which are
> > calculated with two local labels:
> > 
> > <instantiation>:3:13: error: invalid operand for instruction
> >  clgfi %r14,.Lsie_done - .Lsie_gmap
> > 
> > Workaround this by adding clang specific code which reads the specific
> > value from memory. Since this code is within the hot paths of the kernel
> > and adds an additional memory reference, keep the original code, and add
> > ifdef'ed code.
> > 
> > Signed-off-by: Heiko Carstens <hca@...ux.ibm.com>
> > ---
> >  arch/s390/kernel/entry.S | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
> > index e1664b45090f..ff7a75078e93 100644
> > --- a/arch/s390/kernel/entry.S
> > +++ b/arch/s390/kernel/entry.S
> > @@ -171,8 +171,19 @@ _LPP_OFFSET	= __LC_LPP
> >  	.macro OUTSIDE reg,start,end,outside_label
> >  	larl	%r14,\start
> >  	slgrk	%r14,\reg,%r14
> > +#ifdef CONFIG_CC_IS_CLANG
> 
> I intend to put this series through my build and boot test matrix later
> today but one fly by comment in the meantime. Should this be
> CONFIG_AS_IS_LLVM if this is an integrated assembler limitation, rather
> than a clang one?

Yes, that makes a lot of sense. Considering that I will drop the
previous patch within this series, the new version looks like:

>From fe4fb0b014378d84ae517deaea338577b2ea6ae0 Mon Sep 17 00:00:00 2001
From: Heiko Carstens <hca@...ux.ibm.com>
Date: Sat, 7 May 2022 15:00:40 +0200
Subject: [PATCH 3/7] s390/entry: workaround llvm's IAS limitations

llvm's integrated assembler cannot handle immediate values which are
calculated with two local labels:

<instantiation>:3:13: error: invalid operand for instruction
 clgfi %r14,.Lsie_done - .Lsie_gmap

Workaround this by adding clang specific code which reads the specific
value from memory. Since this code is within the hot paths of the kernel
and adds an additional memory reference, keep the original code, and add
ifdef'ed code.

Signed-off-by: Heiko Carstens <hca@...ux.ibm.com>
---
 arch/s390/kernel/entry.S | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index a6b45eaa3450..f2f30bfba1e9 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -172,9 +172,19 @@ _LPP_OFFSET	= __LC_LPP
 	lgr	%r14,\reg
 	larl	%r13,\start
 	slgr	%r14,%r13
-	lghi	%r13,\end - \start
-	clgr	%r14,%r13
+#ifdef CONFIG_AS_IS_LLVM
+	clgfrl	%r14,.Lrange_size\@
+#else
+	clgfi	%r14,\end - \start
+#endif
 	jhe	\outside_label
+#ifdef CONFIG_CC_IS_CLANG
+	.section .rodata, "a"
+	.align 4
+.Lrange_size\@:
+	.long	\end - \start
+	.previous
+#endif
 	.endm
 
 	.macro SIEEXIT
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ