Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp111711yba; Mon, 20 May 2019 05:55:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1GUbqLne4y+mwNaS/iG35zxLg+b2rnialfGutS0aWbs4BFqS/BMSLar3xK85qlwRDsiPK X-Received: by 2002:a17:902:6b0b:: with SMTP id o11mr75879925plk.266.1558356955799; Mon, 20 May 2019 05:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558356955; cv=none; d=google.com; s=arc-20160816; b=QIuJHMZ6OVRovCNnSBXBovIplaOmHjIkd15coxWmWmw9+R5Mxc+O4NOfSKrjLpsuFW EkxMWfHCrRqVbJDljMCJigojrQOlF7qEZKNp2LrOeJJQEBUBDYEBggSF728phhkuPhN3 /USvRQ8F5hbwWa/DoxHhjeJB1tVHpNLVVX/NHQ8Dd8w+byC9l6C0I64UySnWfpvRAoMs PO03LJz3Rx30QSeVt106ANKgBR7U83Xbh06znO4RU/A2P/TTU56jcA0grHd+SBYigXqI 3Mw84l+xftDja0L7Wx2Ied6QZViCJqcSd2onIYqt3WuNgWKzQwdZEqzwqnUeioUu4tzs dx7A== 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=cIqPQxh3CbEvJZDqf2c7hf9XU4IJctveVw2yenL0qbg=; b=06/fA2NSdKyuPzmNIlvq3h9gxsyOKzsnj5VrKcldpqxb56NV1Ha1tfsD280auptfL1 4okSXT5oqYOW1ab1Rha+OtcG6Y0sghDVz1S0qt2QPGghVCcwA1Aw81K5XwnewC7hIL7M tsNP7uxddTFLjoK7wr8aJIz+3+NEwfbq1KMXB6o4GC94r5ibE7qoH6Dr5ij/Cs9zgMLV K5N2ld7DkQ2UDAakLZV/ypSMjB6/6w+fga7kkdMXRVO7rSbhP7VDKXf7J7BDoNmsAACE sXD/ySozHAvwkVko8eHgC8k9UmeV1uhaOQRlsBm3niaGc6cVQWS1AXqqGEgkUzrPz5Tv VkoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C8YpcTEN; 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 w26si17926972pgc.142.2019.05.20.05.55.41; Mon, 20 May 2019 05:55:55 -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=C8YpcTEN; 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 S2387404AbfETMQw (ORCPT + 99 others); Mon, 20 May 2019 08:16:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:57590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733292AbfETMQu (ORCPT ); Mon, 20 May 2019 08:16:50 -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 8520C20863; Mon, 20 May 2019 12:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354609; bh=PTYGx9/Qs/Lx+KktI6LWC0BAUKBvbzdl9YW9wTgYltU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8YpcTEN9/uH10ccTpUJp+7mtPJ812XRkrehqA31jvXYEsfTGD1Jp8M2lCaQTGmkd f1Q8RZ2CahkZQVFbteCsQiuDH0C0ss+KmYuIuIE9l4Nq4NUMRU5P8HZKOXw42PdOQZ w9fU/bUC5Dm7s61pXwiKXsv2ZTaQRKOYFQsdkD3o= 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.9 04/44] x86/speculation/mds: Revert CPU buffer clear on double fault exit Date: Mon, 20 May 2019 14:13:53 +0200 Message-Id: <20190520115231.418026516@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115230.720347034@linuxfoundation.org> References: <20190520115230.720347034@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 @@ -62,7 +62,6 @@ #include #include #include -#include #include #include @@ -341,13 +340,6 @@ dotraplinkage void do_double_fault(struc regs->ip = (unsigned long)general_protection; regs->sp = (unsigned long)&normal_regs->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