linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jürgen Groß" <jgross@suse.com>
To: Michal Kubecek <mkubecek@suse.cz>, Andy Lutomirski <luto@kernel.org>
Cc: x86@kernel.org, Andrew Cooper <andrew.cooper3@citrix.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH entry v2 3/6] x86/entry/xen: Route #DB correctly on Xen PV
Date: Mon, 6 Jul 2020 10:57:07 +0200	[thread overview]
Message-ID: <9432d30a-e1eb-2b5e-beff-e24768c09aad@suse.com> (raw)
In-Reply-To: <20200706084155.ndltt24ipognh67e@lion.mk-sys.cz>

On 06.07.20 10:41, Michal Kubecek wrote:
> On Fri, Jul 03, 2020 at 10:02:55AM -0700, Andy Lutomirski wrote:
>> On Xen PV, #DB doesn't use IST.  We still need to correctly route it
>> depending on whether it came from user or kernel mode.
>>
>> This patch gets rid of DECLARE/DEFINE_IDTENTRY_XEN -- it was too
>> hard to follow the logic.  Instead, route #DB and NMI through
>> DECLARE/DEFINE_IDTENTRY_RAW on Xen, and do the right thing for #DB.
>> Also add more warnings to the exc_debug* handlers to make this type
>> of failure more obvious.
>>
>> This fixes various forms of corruption that happen when usermode
>> triggers #DB on Xen PV.
>>
>> Fixes: 4c0dcd8350a0 ("x86/entry: Implement user mode C entry points for #DB and #MCE")
>> Signed-off-by: Andy Lutomirski <luto@kernel.org>
>> ---
>>   arch/x86/include/asm/idtentry.h | 24 ++++++------------------
>>   arch/x86/kernel/traps.c         | 12 ++++++++++++
>>   arch/x86/xen/enlighten_pv.c     | 28 ++++++++++++++++++++++++----
>>   arch/x86/xen/xen-asm_64.S       |  5 ++---
>>   4 files changed, 44 insertions(+), 25 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
>> index cf51c50eb356..94333ac3092b 100644
>> --- a/arch/x86/include/asm/idtentry.h
>> +++ b/arch/x86/include/asm/idtentry.h
> [...]
>> @@ -570,11 +554,15 @@ DECLARE_IDTENTRY_MCE(X86_TRAP_MC,	exc_machine_check);
>>   
>>   /* NMI */
>>   DECLARE_IDTENTRY_NMI(X86_TRAP_NMI,	exc_nmi);
>> -DECLARE_IDTENTRY_XEN(X86_TRAP_NMI,	nmi);
>> +#ifdef CONFIG_XEN_PV
>> +DECLARE_IDTENTRY_RAW(X86_TRAP_NMI,	xenpv_exc_nmi);
>> +#endif
>>   
>>   /* #DB */
>>   DECLARE_IDTENTRY_DEBUG(X86_TRAP_DB,	exc_debug);
>> -DECLARE_IDTENTRY_XEN(X86_TRAP_DB,	debug);
>> +#ifdef CONFIG_XEN_PV
>> +DECLARE_IDTENTRY_RAW(X86_TRAP_DB,	xenpv_exc_debug);
>> +#endif
>>   
>>   /* #DF */
>>   DECLARE_IDTENTRY_DF(X86_TRAP_DF,	exc_double_fault);
> 
> Hello,
> 
> this patch - now in mainline as commit 13cbc0cd4a30 ("x86/entry/32: Fix
> #MC and #DB wiring on x86_32") - seems to break i586 builds with
> CONFIG_XEN_PV=y as xenpv_exc_nmi and xenpv_exc_debug are only defined
> with CONFIG_X86_64:
> 
> [ 1279s] ld: arch/x86/entry/entry_32.o: in function `asm_xenpv_exc_nmi':
> [ 1279s] /home/abuild/rpmbuild/BUILD/kernel-pae-5.8.rc4/linux-5.8-rc4/linux-obj/../arch/x86/include/asm/idtentry.h:557: undefined reference to `xenpv_exc_nmi'
> [ 1279s] ld: arch/x86/entry/entry_32.o: in function `asm_xenpv_exc_debug':
> [ 1279s] /home/abuild/rpmbuild/BUILD/kernel-pae-5.8.rc4/linux-5.8-rc4/linux-obj/../arch/x86/include/asm/idtentry.h:567: undefined reference to `xenpv_exc_debug'

Fix is already queued in tip/tip.git x86/urgent


Juergen


  reply	other threads:[~2020-07-06  8:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 17:02 [PATCH entry v2 0/6] x86/entry: Fixes and cleanups Andy Lutomirski
2020-07-03 17:02 ` [PATCH entry v2 1/6] x86/entry/compat: Clear RAX high bits on Xen PV SYSENTER Andy Lutomirski
2020-07-04 17:49   ` [tip: x86/urgent] " tip-bot2 for Andy Lutomirski
2020-07-03 17:02 ` [PATCH entry v2 2/6] x86/entry, selftests: Further improve user entry sanity checks Andy Lutomirski
2020-07-04 17:49   ` [tip: x86/urgent] " tip-bot2 for Andy Lutomirski
2020-08-20 10:23     ` peterz
2020-08-22 21:59       ` Andy Lutomirski
2020-07-03 17:02 ` [PATCH entry v2 3/6] x86/entry/xen: Route #DB correctly on Xen PV Andy Lutomirski
2020-07-04 17:49   ` [tip: x86/urgent] " tip-bot2 for Andy Lutomirski
2020-07-06  8:41   ` [PATCH entry v2 3/6] " Michal Kubecek
2020-07-06  8:57     ` Jürgen Groß [this message]
2020-07-06  9:32       ` Michal Kubecek
2020-07-03 17:02 ` [PATCH entry v2 4/6] x86/entry/32: Fix #MC and #DB wiring on x86_32 Andy Lutomirski
2020-07-04 17:49   ` [tip: x86/urgent] " tip-bot2 for Andy Lutomirski
2020-07-03 17:02 ` [PATCH entry v2 5/6] x86/ldt: Disable 16-bit segments on Xen PV Andy Lutomirski
2020-07-03 19:00   ` Andrew Cooper
2020-07-04 17:49   ` [tip: x86/urgent] " tip-bot2 for Andy Lutomirski
2020-07-03 17:02 ` [PATCH entry v2 6/6] x86/entry: Rename idtentry_enter/exit_cond_rcu() to idtentry_enter/exit() Andy Lutomirski
2020-07-07  8:23   ` [tip: x86/entry] " tip-bot2 for Andy Lutomirski
2020-07-03 17:31 ` [PATCH entry v2 0/6] x86/entry: Fixes and cleanups Peter Zijlstra

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=9432d30a-e1eb-2b5e-beff-e24768c09aad@suse.com \
    --to=jgross@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mkubecek@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).