Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp107031yba; Mon, 20 May 2019 05:50:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxX0SnHQge/YGesf1vyhlXCTK1+WP29pFEmkevSW/TFhDdT/nuMI1oQxSVHzjOMTSb5A/3K X-Received: by 2002:aa7:9289:: with SMTP id j9mr35243008pfa.251.1558356619781; Mon, 20 May 2019 05:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356619; cv=none; d=google.com; s=arc-20160816; b=o96WRB1DIn4Vn1wCeOc/vTRvc0YGX3uU96nLR9/sAcB7HsRXjsffdxLpLfpYTuExfY G66sE3TO6qluD6PRZTE2RBDDI93bsW9TKYXz+xj6dGsQM1CvQ/Sv7CMlFsraYQMraTAS D1HGbwRBzQCTEGNgn6Of8oJXY+NQnnjObbZrjKTTWIP3TNyEXuZhCoY4AKvtsL+W68/p gJtQssBk6+0tNEChPvRmIH9zA6nGGjkYuWVViLO3sVcmnM5m5HkgG72rbf/m8ZuxsQkb /d726mGrWMIPIeiCNWbkA1Lqtteq27b6GB9p2iw13effBewtwXY92r5TFJ8dkgAU/pk2 io5g== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dDKrrNMUQ6Gj2JxuQsvBAF8fIXYSGoFC8vUSYyKeVPU=; b=TyyBQBae0g+R/kIC9gUpcvyxIGnCwlJluXFg/mMhtS2x0D8qRc1OfeCwwafbFjhszd Hnmk/WnsMnn5iWrKjS/Vw8Ezw2KPfcgiyjIpXXhznKWi6bzqgQ1Rw+dhEt2COOCJmwIA CEPHfkqSj9/GwQN9Qyixx/QOR7djorUgJAT7LdcxXkm1wPBz7x1IMp6n5ANslvgCe3oR REAK2hyZbnMOGOFLVDX8m7eqpoNGBr0scVUxUG+n6aY2zbDFvGSNEl7qsPJE2aZxXwjB tZjze2ogkuB83cTgV8cs1OchryurSRPuyb4DBG2KMyxI7AL2e7QcoL9rMKBj74O7Uj5d BWMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ynf6dIs9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si19915838pfa.190.2019.05.20.05.50.05; Mon, 20 May 2019 05:50:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ynf6dIs9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389122AbfETMs0 (ORCPT + 99 others); Mon, 20 May 2019 08:48:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388262AbfETMW6 (ORCPT ); Mon, 20 May 2019 08:22:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 845E521783; Mon, 20 May 2019 12:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354978; bh=+GH+DCDK/EE36J4OWkKzbGvcyDu4QdcaLRrUrfIowyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ynf6dIs9mPD3VHriFfqXPgkRLdqHOddecOCKkbfCeJ/uJUoXZyw3eJ3tiHLt8EupF BiwRULXFLU6oBGxsF93vyssC6Q494V6jLLpSG86GODFkRx6Zs/iUVe65fdEkiUjghj N09B+zFZWoyHONs2NfLzWOVeRUFkHk7tkaIxlhTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Borislav Petkov , Frederic Weisbecker , Jon Masters , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.19 002/105] x86/speculation/mds: Revert CPU buffer clear on double fault exit Date: Mon, 20 May 2019 14:13:08 +0200 Message-Id: <20190520115247.226620319@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Lutomirski commit 88640e1dcd089879530a49a8d212d1814678dfe7 upstream. The double fault ESPFIX path doesn't return to user mode at all -- it returns back to the kernel by simulating a #GP fault. prepare_exit_to_usermode() will run on the way out of general_protection before running user code. Signed-off-by: Andy Lutomirski Cc: Borislav Petkov Cc: Frederic Weisbecker Cc: Greg Kroah-Hartman Cc: Jon Masters Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: stable@vger.kernel.org Fixes: 04dcbdb80578 ("x86/speculation/mds: Clear CPU buffers on exit to user") Link: http://lkml.kernel.org/r/ac97612445c0a44ee10374f6ea79c222fe22a5c4.1557865329.git.luto@kernel.org Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- Documentation/x86/mds.rst | 7 ------- arch/x86/kernel/traps.c | 8 -------- 2 files changed, 15 deletions(-) --- a/Documentation/x86/mds.rst +++ b/Documentation/x86/mds.rst @@ -158,13 +158,6 @@ Mitigation points mitigated on the return from do_nmi() to provide almost complete coverage. - - Double fault (#DF): - - A double fault is usually fatal, but the ESPFIX workaround, which can - be triggered from user space through modify_ldt(2) is a recoverable - double fault. #DF uses the paranoid exit path, so explicit mitigation - in the double fault handler is required. - - Machine Check Exception (#MC): Another corner case is a #MC which hits between the CPU buffer clear --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -388,13 +387,6 @@ dotraplinkage void do_double_fault(struc regs->ip = (unsigned long)general_protection; regs->sp = (unsigned long)&gpregs->orig_ax; - /* - * This situation can be triggered by userspace via - * modify_ldt(2) and the return does not take the regular - * user space exit, so a CPU buffer clear is required when - * MDS mitigation is enabled. - */ - mds_user_clear_cpu_buffers(); return; } #endif