From patchwork Mon Nov 26 17:27:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 10698853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 48EFE15A8 for ; Mon, 26 Nov 2018 17:32:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34E152A291 for ; Mon, 26 Nov 2018 17:32:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 295D82A2EE; Mon, 26 Nov 2018 17:32:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 619302A291 for ; Mon, 26 Nov 2018 17:32:28 +0000 (UTC) Received: (qmail 3218 invoked by uid 550); 26 Nov 2018 17:32:27 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 30414 invoked from network); 26 Nov 2018 17:27:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=2uvYqwo8b0d15h+35lgIxvtd3vHLDG6JsoJ+bhXgr5M=; b=R3anh+9CYkNOdHKx/t0Js6QRHN0H3wJhaUFe39j7ELxRdo3kQLWljIhaXciPQkbp36 qtE9nmJmVCSfNaOBjyVx8qOy+M8Tx22ds74m1E6aHiu18x3q9oN6bGXpC1iAuv+8Pzjv U3v9E+c/1GwT/+dIDL+P6XQkPeirUpFOONDOn0zy+oU9H52e0Ry/WREvGDqoqzXs3NYy xeko7wlvYtG/hDLz7GRIZ4XFGjUSx/Y9k81qZ1gRXQ7Eyl2Ofb+y3YX74QEGyQkszEUD EXDlez6Aq1+rvv+JyXaeXHnkU5tuVDnq+N20kHfwhSlHJiRjQ9LKo5srhDUMat8omQDb mtJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=2uvYqwo8b0d15h+35lgIxvtd3vHLDG6JsoJ+bhXgr5M=; b=YFhVT8cVmJzwcE0vx5Vn3n+q7wYRtFdqyAWJsnLdTfeq/U/PEzTmzZSBlqJZr1EMfy g7lm7258s1TNn1Z7GcjJ3DYZbVNx+e0KE7+jLnMND/+TZmtTepZxojChF+FTrsY3imdL gf707RtdYRhVr4X7Ca/exl5xkKHUNf9MYng85AmIZ4KY+DjCAoLQ2nRF1gILhdWX1rXU N6Qceng7FHZd/zOkvE0J4i7h47c/AteUqWpYnC1yZhuH8R6rc6I9Sk86qlfFAoku9Yty FGPBhJ0nt+fzZ8gaycGuJ3eHW07C1B7qUXmVd1gkaOI8z2U8E/tpGniUnCyIvGZDh/Cs f+Ww== X-Gm-Message-State: AGRZ1gLPKyj7dKGZcpgu7UdbPi1ByhHakb9aJDCs7hEEd62Kf6OZh7Q8 /7GQeaxIfH/SGzp9qT0oZp1oeFcOOA== X-Google-Smtp-Source: AJdET5e7LX3HaAy/Rrg06eUAN//jyR1uYYLyA4NcwQVXpJR+VoRkY8ps3mubK4/cT7nNxxqh+05cBxPfLg== X-Received: by 2002:aed:23fd:: with SMTP id k58mr17514268qtc.39.1543253237335; Mon, 26 Nov 2018 09:27:17 -0800 (PST) Date: Mon, 26 Nov 2018 18:27:06 +0100 Message-Id: <20181126172706.184008-1-jannh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog Subject: [PATCH] x86/fpu: XRSTOR is expected to raise #GP From: Jann Horn To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , jannh@google.com Cc: Sebastian Andrzej Siewior , Andy Lutomirski , kernel-hardening@lists.openwall.com, "Naveen N. Rao" , linux-kernel@vger.kernel.org, "H. Peter Anvin" , x86@kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit 75045f77f7a7 ("x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups") incorrectly replaced the fixup entry for XSTATE_OP with a user-#PF-only fixup. However, XRSTOR can also raise #GP when the supplied address points to userspace memory. Change it back. Reported-by: Sebastian Andrzej Siewior Fixes: 75045f77f7a7 ("x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups") Signed-off-by: Jann Horn Acked-by: Sebastian Andrzej Siewior --- arch/x86/include/asm/fpu/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 5f7290e6e954..69dcdf195b61 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -226,7 +226,7 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu) "3: movl $-2,%[err]\n\t" \ "jmp 2b\n\t" \ ".popsection\n\t" \ - _ASM_EXTABLE_UA(1b, 3b) \ + _ASM_EXTABLE(1b, 3b) \ : [err] "=r" (err) \ : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ : "memory")