All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>,
	Sean Christopherson <seanjc@google.com>,
	kernel test robot <oliver.sang@intel.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	x86@kernel.org, lkp@lists.01.org, lkp@intel.com
Subject: Re: [PATCH] x86/entry_32: Fix segment exceptions
Date: Thu, 13 Jan 2022 20:55:37 +0100	[thread overview]
Message-ID: <YeCDudla868Ipf++@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <73020277-d49f-7aae-22db-945e040a31a2@kernel.org>

On Thu, Jan 13, 2022 at 10:54:39AM -0800, Andy Lutomirski wrote:
> On 1/12/22 07:42, Borislav Petkov wrote:
> > On Wed, Jan 12, 2022 at 11:55:41AM +0100, Peter Zijlstra wrote:
> > > Full and proper patch below. Boris, if you could merge in x86/core that
> > > branch should then be ready for a pull req.
> > 
> > I've got this as the final version. Scream if something's wrong.
> 
> AAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!

:-)

> > +	/*
> > +	 * There is no _ASM_EXTABLE_TYPE_REG() for ASM, however since this is
> > +	 * ASM the registers are known and we can trivially hard-code them.
> > +	 */
> > +	_ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_POP_ZERO|EX_REG_DS)
> > +	_ASM_EXTABLE_TYPE(2b, 3b, EX_TYPE_POP_ZERO|EX_REG_ES)
> > +	_ASM_EXTABLE_TYPE(3b, 4b, EX_TYPE_POP_ZERO|EX_REG_FS)
> 
> Aside from POP_ZERO being a bit mystifying to a naive reader...
> 
> >   .endm
> >   .macro RESTORE_ALL_NMI cr3_reg:req pop=0
> > diff --git a/arch/x86/include/asm/extable_fixup_types.h b/arch/x86/include/asm/extable_fixup_types.h
> > index b5ab333e064a..503622627400 100644
> > --- a/arch/x86/include/asm/extable_fixup_types.h
> > +++ b/arch/x86/include/asm/extable_fixup_types.h
> > @@ -16,9 +16,16 @@
> >   #define EX_DATA_FLAG_SHIFT		12
> >   #define EX_DATA_IMM_SHIFT		16
> > +#define EX_DATA_REG(reg)		((reg) << EX_DATA_REG_SHIFT)
> >   #define EX_DATA_FLAG(flag)		((flag) << EX_DATA_FLAG_SHIFT)
> >   #define EX_DATA_IMM(imm)		((imm) << EX_DATA_IMM_SHIFT)
> > +/* segment regs */
> > +#define EX_REG_DS			EX_DATA_REG(8)
> > +#define EX_REG_ES			EX_DATA_REG(9)
> > +#define EX_REG_FS			EX_DATA_REG(10)
> 
> These three seem likely to work

On IRC Andrew also noted that these EX_REG_* things should be __i386__
only. Previosly when they lived as open-coded EX_DATA_REG() usage in
entry_32.S that was implied, but now ...

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: lkp@lists.01.org
Subject: Re: [PATCH] x86/entry_32: Fix segment exceptions
Date: Thu, 13 Jan 2022 20:55:37 +0100	[thread overview]
Message-ID: <YeCDudla868Ipf++@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <73020277-d49f-7aae-22db-945e040a31a2@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

On Thu, Jan 13, 2022 at 10:54:39AM -0800, Andy Lutomirski wrote:
> On 1/12/22 07:42, Borislav Petkov wrote:
> > On Wed, Jan 12, 2022 at 11:55:41AM +0100, Peter Zijlstra wrote:
> > > Full and proper patch below. Boris, if you could merge in x86/core that
> > > branch should then be ready for a pull req.
> > 
> > I've got this as the final version. Scream if something's wrong.
> 
> AAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!

:-)

> > +	/*
> > +	 * There is no _ASM_EXTABLE_TYPE_REG() for ASM, however since this is
> > +	 * ASM the registers are known and we can trivially hard-code them.
> > +	 */
> > +	_ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_POP_ZERO|EX_REG_DS)
> > +	_ASM_EXTABLE_TYPE(2b, 3b, EX_TYPE_POP_ZERO|EX_REG_ES)
> > +	_ASM_EXTABLE_TYPE(3b, 4b, EX_TYPE_POP_ZERO|EX_REG_FS)
> 
> Aside from POP_ZERO being a bit mystifying to a naive reader...
> 
> >   .endm
> >   .macro RESTORE_ALL_NMI cr3_reg:req pop=0
> > diff --git a/arch/x86/include/asm/extable_fixup_types.h b/arch/x86/include/asm/extable_fixup_types.h
> > index b5ab333e064a..503622627400 100644
> > --- a/arch/x86/include/asm/extable_fixup_types.h
> > +++ b/arch/x86/include/asm/extable_fixup_types.h
> > @@ -16,9 +16,16 @@
> >   #define EX_DATA_FLAG_SHIFT		12
> >   #define EX_DATA_IMM_SHIFT		16
> > +#define EX_DATA_REG(reg)		((reg) << EX_DATA_REG_SHIFT)
> >   #define EX_DATA_FLAG(flag)		((flag) << EX_DATA_FLAG_SHIFT)
> >   #define EX_DATA_IMM(imm)		((imm) << EX_DATA_IMM_SHIFT)
> > +/* segment regs */
> > +#define EX_REG_DS			EX_DATA_REG(8)
> > +#define EX_REG_ES			EX_DATA_REG(9)
> > +#define EX_REG_FS			EX_DATA_REG(10)
> 
> These three seem likely to work

On IRC Andrew also noted that these EX_REG_* things should be __i386__
only. Previosly when they lived as open-coded EX_DATA_REG() usage in
entry_32.S that was implied, but now ...

  reply	other threads:[~2022-01-13 19:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  8:35 [x86/entry_32] aa93e2ad74: BUG:soft_lockup-CPU##stuck_for#s![systemd-logind:#] kernel test robot
2022-01-06  8:35 ` kernel test robot
2022-01-11 11:11 ` Peter Zijlstra
2022-01-11 11:11   ` Peter Zijlstra
2022-01-12  1:28   ` Sean Christopherson
2022-01-12  1:28     ` Sean Christopherson
2022-01-12 10:25     ` Peter Zijlstra
2022-01-12 10:25       ` Peter Zijlstra
2022-01-12 16:14       ` Sean Christopherson
2022-01-12 16:14         ` Sean Christopherson
2022-01-12 10:55     ` [PATCH] x86/entry_32: Fix segment exceptions Peter Zijlstra
2022-01-12 10:55       ` Peter Zijlstra
2022-01-12 15:42       ` Borislav Petkov
2022-01-12 15:42         ` Borislav Petkov
2022-01-13 18:54         ` Andy Lutomirski
2022-01-13 18:54           ` Andy Lutomirski
2022-01-13 19:55           ` Peter Zijlstra [this message]
2022-01-13 19:55             ` Peter Zijlstra
2022-01-14 11:24             ` Borislav Petkov
2022-01-14 11:24               ` Borislav Petkov
2022-01-14 23:48               ` Andy Lutomirski
2022-01-14 23:48                 ` Andy Lutomirski
2022-01-15  8:13                 ` Borislav Petkov
2022-01-15  8:13                   ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YeCDudla868Ipf++@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=luto@kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=seanjc@google.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.