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: <Yv3sha0zujQxW1X8@xpf.sh.intel.com>
Date:   Thu, 18 Aug 2022 15:38:45 +0800
From:   Pengfei Xu <pengfei.xu@...el.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     Josh Poimboeuf <jpoimboe@...nel.org>,
        "Yang, Weijiang" <weijiang.yang@...el.com>,
        "Su, Heng" <heng.su@...el.com>, <linux-kernel@...r.kernel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>, <pbonzini@...hat.com>,
        <x86@...nel.org>
Subject: Re: [PATCH] x86/kvm, objtool: Avoid fastop ENDBR from being sealed

Hi Poimboeuf and Peter,

  I installed the new patch based on v5.19 mainline kernel.

  And this "Missing ENDBR: andw_ax_dx+0x0/0x10 [kvm]" issue was
  reproduced again after ran syzkaller 5min on ADL-P.

  I'm not sure is there something missed for attached patch.

  Patch, kvm.ko and dmesg are in attached.

  Thanks!
  BR.

On 2022-08-18 at 09:28:28 +0200, Peter Zijlstra wrote:
> On Wed, Aug 17, 2022 at 06:10:45PM -0700, Josh Poimboeuf wrote:
> > On Wed, Aug 17, 2022 at 12:56:15PM +0200, Peter Zijlstra wrote:
> > > Add (yet another) annotation to inhibit objtool from sealing a specific
> > > ENDBR instance.
> > 
> > Nah, just add a throwaway reference to the function.  Then no objtool
> > change is needed:
> 
> Nice!, should I 'borrow' this and respin the patch or you want to make a
> real patch out of it?
> 
> > diff --git a/arch/x86/include/asm/ibt.h b/arch/x86/include/asm/ibt.h
> > index 689880eca9ba..3ae795150374 100644
> > --- a/arch/x86/include/asm/ibt.h
> > +++ b/arch/x86/include/asm/ibt.h
> > @@ -31,6 +31,16 @@
> >  
> >  #define __noendbr	__attribute__((nocf_check))
> >  
> > +/*
> > + * Create a dummy function pointer reference to prevent objtool from marking
> > + * the function as needing to be "sealed" (i.e. ENDBR converted to NOP by
> > + * apply_ibt_endbr()).
> > + */
> > +#define IBT_NOSEAL(fname)				\
> > +	".pushsection .discard.endbr.noseal\n\t"	\
> > +	_ASM_PTR fname "\n\t"				\
> > +	".popsection\n\t"
> > +
> >  static inline __attribute_const__ u32 gen_endbr(void)
> >  {
> >  	u32 endbr;
> > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> > index f8382abe22ff..88623add0db4 100644
> > --- a/arch/x86/kvm/emulate.c
> > +++ b/arch/x86/kvm/emulate.c
> > @@ -316,7 +316,8 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
> >  	".align " __stringify(FASTOP_SIZE) " \n\t" \
> >  	".type " name ", @function \n\t" \
> >  	name ":\n\t" \
> > -	ASM_ENDBR
> > +	ASM_ENDBR \
> > +	IBT_NOSEAL(name)
> >  
> >  #define FOP_FUNC(name) \
> >  	__FOP_FUNC(#name)

View attachment "0001-x86-kvm-objtool-Avoid-fastop-ENDBR-from-being-sealed.patch" of type "text/plain" (1686 bytes)

View attachment "adlp_fix2nd_patch_still_Missing_ENDBR.txt" of type "text/plain" (296212 bytes)

Download attachment "kvm.ko" of type "application/octet-stream" (1620032 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ