Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp4336780ybt; Mon, 6 Jul 2020 02:00:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybBcF8vdj4etGG5BXvYwlRF+JcobyyWBctRmWo/roK3zXLnTX0/FhXhaqryt3b5UZtW6It X-Received: by 2002:a50:afa2:: with SMTP id h31mr1991499edd.303.1594026017968; Mon, 06 Jul 2020 02:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594026017; cv=none; d=google.com; s=arc-20160816; b=HUxkOQDWL0xnK8p6qNzwnLUwwhCOvJ2XnrPIgwyacJ00V9eHTC3LBUf3bbPDxsrSgc PdUReIqhP+oec8G6k3FcgcyLI0E0bhjShu92fcSkXe/I/2oaHGQisduT3rQ7Goo9Gt8g EZmePksMnDDLb5TEpK1R1zEuGr8syQV/mpXfVpbWfvs1dyvYG6/OnBgY2C7rhHMBtikm 73DqmYTlztMvkwiaSqQWtLJoJ226cd73ttKIFMiN3JWGjiIcXwvwDDeFEj6g+ZsZ8vwE KWJBBXtKFk/UKEhEdH6f6Ys/cr1kWXkZj0rwcqFW53/TSbzNuaEnWpdQDlWlfUHsB0yv MS5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=1GkSz4f0GcQG6fkLDGCNI2dW5Zbrf+WIpkgDlMjVpXI=; b=Y2EDGg44Eh3v2tX3I3khBGqpFvM7CF52TEWziE6fCpyMCgxFLWKs+oD2d9CmgdNpCO HzRjVlSAQjJlGxXZyVBT+BjAM5Yk0fIG037KYSOLq97IWyub2SxMUBHB6CBvAetnlEod fTkLBo6O3ECZ3+ZKNojzhZzwlDNgDnMIazN4FDd1u3ZED+J0nT2KsDxzB3kmFZ+rMfLF xg89T3S4nerV4fl5SF6LVaJRzg5CphvXLJ8IekURccCWVd6l9UQDbhffvAdoBCtZmdk0 WjbeDk5rPCatc2rlnXfdr5yYPJ1u9Cy7yhybqK3mIas0hkrgTYEUeqtVC0r0jQbB2FWJ K9sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si8732624ejj.575.2020.07.06.01.59.55; Mon, 06 Jul 2020 02:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbgGFI5J (ORCPT + 99 others); Mon, 6 Jul 2020 04:57:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:50464 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728321AbgGFI5I (ORCPT ); Mon, 6 Jul 2020 04:57:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 23F56AEB6; Mon, 6 Jul 2020 08:57:08 +0000 (UTC) Subject: Re: [PATCH entry v2 3/6] x86/entry/xen: Route #DB correctly on Xen PV To: Michal Kubecek , Andy Lutomirski Cc: x86@kernel.org, Andrew Cooper , LKML References: <4163e733cce0b41658e252c6c6b3464f33fdff17.1593795633.git.luto@kernel.org> <20200706084155.ndltt24ipognh67e@lion.mk-sys.cz> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <9432d30a-e1eb-2b5e-beff-e24768c09aad@suse.com> Date: Mon, 6 Jul 2020 10:57:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200706084155.ndltt24ipognh67e@lion.mk-sys.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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