lkml.org 
[lkml]   [2020]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH entry v2 3/6] x86/entry/xen: Route #DB correctly on Xen PV
    From
    Date
    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

    \
     
     \ /
      Last update: 2020-07-06 11:02    [W:3.061 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site