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: <20211105075646.GH174703@worktop.programming.kicks-ass.net>
Date:   Fri, 5 Nov 2021 08:56:46 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org, mark.rutland@....com,
        dvyukov@...gle.com, seanjc@...gle.com, pbonzini@...hat.com,
        mbenes@...e.cz
Subject: Re: [RFC][PATCH 11/22] x86,xen: Remove .fixup usage

On Thu, Nov 04, 2021 at 03:31:51PM -0700, Josh Poimboeuf wrote:
> On Thu, Nov 04, 2021 at 05:47:40PM +0100, Peter Zijlstra wrote:
> > Employ the fancy new EX_TYPE_IMM_REG to create EX_TYPE_NEG_REG to
> > store '-1' into the designated register and use this to remove some
> > Xen .fixup usage.
> > 
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > ---
> >  arch/x86/include/asm/extable_fixup_types.h |    1 +
> >  arch/x86/include/asm/xen/page.h            |   12 ++----------
> >  2 files changed, 3 insertions(+), 10 deletions(-)
> > 
> > --- a/arch/x86/include/asm/extable_fixup_types.h
> > +++ b/arch/x86/include/asm/extable_fixup_types.h
> > @@ -35,5 +35,6 @@
> >  
> >  #define	EX_TYPE_IMM_REG			17 /* reg := (long)imm */
> >  #define	EX_TYPE_EFAULT_REG		(EX_TYPE_IMM_REG | EX_TYPE_IMM(-EFAULT))
> > +#define	EX_TYPE_NEG_REG			(EX_TYPE_IMM_REG | EX_TYPE_IMM(-1))
> >  
> >  #endif
> > --- a/arch/x86/include/asm/xen/page.h
> > +++ b/arch/x86/include/asm/xen/page.h
> > @@ -96,11 +96,7 @@ static inline int xen_safe_write_ulong(u
> >  
> >  	asm volatile("1: mov %[val], %[ptr]\n"
> >  		     "2:\n"
> > -		     ".section .fixup, \"ax\"\n"
> > -		     "3: sub $1, %[ret]\n"
> > -		     "   jmp 2b\n"
> > -		     ".previous\n"
> > -		     _ASM_EXTABLE(1b, 3b)
> > +		     _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_NEG_REG, %[ret])
> >  		     : [ret] "+r" (ret), [ptr] "=m" (*addr)
> >  		     : [val] "r" (val));
> >  
> > @@ -115,11 +111,7 @@ static inline int xen_safe_read_ulong(co
> >  
> >  	asm volatile("1: mov %[ptr], %[rval]\n"
> >  		     "2:\n"
> > -		     ".section .fixup, \"ax\"\n"
> > -		     "3: sub $1, %[ret]\n"
> > -		     "   jmp 2b\n"
> > -		     ".previous\n"
> > -		     _ASM_EXTABLE(1b, 3b)
> > +		     _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_NEG_REG, %[ret])
> >  		     : [ret] "+r" (ret), [rval] "+r" (rval)
> >  		     : [ptr] "m" (*addr));
> >  	*val = rval;
> 
> -EFAULT is also negative, and presumably more appropriate than -1.

Possibly, means I'll have to go audit all it's users. I'll put it on the
todo list.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ