From patchwork Tue Nov 27 13:32:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 10700533 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 8D70017D5 for ; Tue, 27 Nov 2018 13:34:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B8652B331 for ; Tue, 27 Nov 2018 13:34:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FACB2B346; Tue, 27 Nov 2018 13:34:03 +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 EAEDD2A45C for ; Tue, 27 Nov 2018 13:34:01 +0000 (UTC) Received: (qmail 7911 invoked by uid 550); 27 Nov 2018 13:33:59 -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 7330 invoked from network); 27 Nov 2018 13:32:19 -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=0x98bOJuAVkDdHDZ1/E8Wz7Dv4wK/V7vxU55zlPZenA=; b=EzHoXGNb+UErVyniVY/VeHHrvxS2TQcz/DGSRmykMUgu5pmE1qhFfLQrP0ak2SsE9F mxCm7Le/Ux36tctl0jsPFnhKkeU8r5EO1JqdAZ++P7AbcXBRx9Q57j9F7zWoe0B7+XWd LdGFm803ydegXgXH2tLzQCas+Tcs8ocQEakkf48PogmZBSlFwYjgz4e3vW23Ofm4UjjT m9mn5GcvEItfJrpcNLzmCHs0XYM6gJY4bmPR0QLLxNMmZexUapHtoSWwdICrqZaYimQu FwZJMm9ZPnME0nESQb06F2IMJbuwgGgCSP9r9jC8Gu+6h7nhMAzqNb76RDpwbfJKyCs6 JxBg== 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=0x98bOJuAVkDdHDZ1/E8Wz7Dv4wK/V7vxU55zlPZenA=; b=g5TRE1bZWEHPo1FcJF/OlCFUhlCvd2YQG/D/FHdmn0l5g8GIhqQ2gWdLliO9uspLK6 P5SBycGize9XlTLTpe6LEmI6Ljeetg66Ef9TindpbbDK8XWecS1FHC26g9gqUs/bfUEd Ik9cSHrF/bhOjm0gqsL6FxexxjzH7P6t0pxP/brj/+JaqipVEoP15CFLrk99PAZCX42b Up84u4AEUIveFWom5vOGm9pRnArTqLipY+Z7tvVrUuq6fJiVwzOQLlbXjdu0+VX435ln W3NDEa6jrX9bF8b8P8VrnqRP9XRhNIV2KkahuqJ5ZEz75zI/YMYNFi6OSsF0wqTYxSuE 7v4g== X-Gm-Message-State: AA+aEWZ4c5cNUS9hVXWFolnAg7MulNkuAVd1xGsDdzZVKRj7c9GuP90y LuYK3BZ9uxzNK81schcwYj+tphsAQg== X-Google-Smtp-Source: AFSGD/VPf2hUp62itkSewGyOa71oswgLrY9qY4sutKYlRMghib84bGI2KyYeWmrXH/g45UtE0Dz/Js08Ug== X-Received: by 2002:a24:5dd4:: with SMTP id w203mr397233ita.8.1543325526820; Tue, 27 Nov 2018 05:32:06 -0800 (PST) Date: Tue, 27 Nov 2018 14:32:00 +0100 Message-Id: <20181127133200.38322-1-jannh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog Subject: [PATCH v2] x86/fpu: XRSTOR is expected to raise #GP From: Jann Horn To: Thomas Gleixner , Sebastian Andrzej Siewior , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , jannh@google.com Cc: Andy Lutomirski , kernel-hardening@lists.openwall.com, "Naveen N. Rao" , linux-kernel@vger.kernel.org, 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. XRSTOR can also raise #GP if the xstate content is invalid, and _ASM_EXTABLE_UA doesn't expect that. Change this fixup back to _ASM_EXTABLE so that #GP gets fixed up. Reported-by: Sebastian Andrzej Siewior Fixes: 75045f77f7a7 ("x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups") Signed-off-by: Jann Horn --- 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")