From patchwork Sat Apr 2 14:01:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 8731661 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8D6099F44D for ; Sat, 2 Apr 2016 14:04:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93A5D20109 for ; Sat, 2 Apr 2016 14:04:40 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3C2D2037E for ; Sat, 2 Apr 2016 14:04:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amM87-00051M-7g; Sat, 02 Apr 2016 14:02:23 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amM85-0004zr-Or for Xen-devel@lists.xen.org; Sat, 02 Apr 2016 14:02:21 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 4C/38-07120-DE0DFF65; Sat, 02 Apr 2016 14:02:21 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLIsWRWlGSWpSXmKPExsVybKJsh+6bC// DDD5uVLFY8nExiwOjx9Hdv5kCGKNYM/OS8isSWDNWHz/CWvCdreJZw2rmBsYzrF2MXBxCAlMZ JdZ+WcoO4XxllDi6uBEow8HBJqAu0dLp28XIySEiIC0x+9k+VhCbWaCJWWLOSjkQW1ggSqL/6 l4WEJtFQFXi0LwTzCA2r0CoxIKpIDM5OSQE5CS2bdnDCGJzChhLLOl7DxYXEjCS2Pz3EBM+cQ mBDIl5PXNYIWwviUU3LkHZahJXz21insAosICRYRWjenFqUVlqka6xXlJRZnpGSW5iZo6uoYG ZXm5qcXFiempOYlKxXnJ+7iZGYFAxAMEOxo5/TocYJTmYlER5eeP+hwnxJeWnVGYkFmfEF5Xm pBYfYpTh4FCS4H17HignWJSanlqRlpkDDG+YtAQHj5II7waQNG9xQWJucWY6ROoUoy7Hgh+31 zIJseTl56VKifOKA6NFSACkKKM0D24ELNYuMcpKCfMyAh0lxFOQWpSbWYIq/4pRnINRSZj3Ks gqnsy8ErhNr4COYAI6okP6H8gRJYkIKakGxkMhGk/MrxskHazbXTVdfenmHx1RLp/Za3IuOFf P3biw7f5Fax7188v2uXzqPH7fZ+7OLO/dX4tOurV94Gqdvfbf8UaFM0r3ZYzLOr46FZQISZ3S iUs4px9vkb1N+vvTWJH+DUxdz/YqCyz4Y7LvtE//NoGJifvuhXE1rNuaZrWqpvTcKp8lL5RYi jMSDbWYi4oTAVWA0HewAgAA X-Env-Sender: luto@kernel.org X-Msg-Ref: server-16.tower-21.messagelabs.com!1459605739!2770691!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36255 invoked from network); 2 Apr 2016 14:02:20 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-16.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Apr 2016 14:02:20 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B599203B6; Sat, 2 Apr 2016 14:02:18 +0000 (UTC) Received: from localhost (unknown [209.118.255.66]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BCDC2203AE; Sat, 2 Apr 2016 14:02:17 +0000 (UTC) From: Andy Lutomirski To: X86 ML Date: Sat, 2 Apr 2016 07:01:40 -0700 Message-Id: <515fb611449a755312a476cfe11675906e7ddf6c.1459605520.git.luto@kernel.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Cc: KVM list , Peter Zijlstra , Linus Torvalds , linux-kernel@vger.kernel.org, xen-devel , Borislav Petkov , Andy Lutomirski , Paolo Bonzini , Andrew Morton , Arjan van de Ven Subject: [Xen-devel] [PATCH v5 9/9] x86/msr: Set the return value to zero when native_rdmsr_safe fails X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will cause unchecked native_rdmsr_safe failures to return deterministic results. Signed-off-by: Andy Lutomirski --- arch/x86/include/asm/msr.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 13da359881d7..e97e79f8a22b 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -109,7 +109,10 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr, asm volatile("2: rdmsr ; xor %[err],%[err]\n" "1:\n\t" ".section .fixup,\"ax\"\n\t" - "3: mov %[fault],%[err] ; jmp 1b\n\t" + "3: mov %[fault],%[err]\n\t" + "xorl %%eax, %%eax\n\t" + "xorl %%edx, %%edx\n\t" + "jmp 1b\n\t" ".previous\n\t" _ASM_EXTABLE(2b, 3b) : [err] "=r" (*err), EAX_EDX_RET(val, low, high)