Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1883759imu; Fri, 23 Nov 2018 01:26:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/XbWkLlmGT7Hf4CQZpCtFekYPL2MYJLguK/Mf1MFJL4IWm2n301ZyRjb5vds9NB2qykBl1t X-Received: by 2002:a17:902:1008:: with SMTP id b8mr5425576pla.252.1542965195173; Fri, 23 Nov 2018 01:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542965195; cv=none; d=google.com; s=arc-20160816; b=s8h60flBB+7MLoXMY+K4Jo0lmevazSG+jrkyS150vq0TR1DMwNtVxL5jDn+YimH7bY /s9EA86i4KyGa3NEByYZ2q3Kl4YLY+H+xBmUnB7eP81F8gWO55MbsC5T2YcCCKPYebf9 HO52Mq7y7dnLM5OXrD9oLYOm4PLGwVwMxr8DYEeBHVl5bFv+NAx0cBRco0wrteXVsztO tgNf50PmuwDsCVlr2/8PY7uRwrUq2ZYrh8NRWYxJw7Uk0zqWDjCWwjCECQZeQKp8jg1h /CbxUY8tOAn2CqtkL75yGzid3p55foe2adJFvHuSB6evBdrLMiDPGHTjPqca9gkaSypJ u/eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=EkxL/h/08K4Gx9HcY6Tlu2YSOj9WorkRUmlVsZ78bok=; b=VQb1RJ3Sk6PwxOW+PM0WZB8eW3MxVzxtfZw8+xHMt3U+8c+rlBhkQvtQClcPCIBLEe L8rD9dklTv8/BMwGN/KD1PQMDyS7Vb2OTSP1NmxS6PCd2HVIUI+di8Z7c0VYCXIi8pHC YZtUWfyRvFUkTntHpyir7oBDDcgOvKdpdCHK5C4HpUu2K+iNUXG8haWXDr8XCVSurI4Y ge87c3vgxPagtMfVW2LU3eDfrC2FIPiydy0jcWrVHxbHPf8Pl6h0uIsdM5dH8i2EixLx 7cHKgM1PRf7EvTuOuqkDOwVY9KFO4yEHleT8oBU3IUP92EqPw3IQdix1v2VSMQqVhwZV kCYg== ARC-Authentication-Results: i=1; mx.google.com; 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 t19-v6si21651925plo.69.2018.11.23.01.26.20; Fri, 23 Nov 2018 01:26:35 -0800 (PST) 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; 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 S2393933AbeKVUuk (ORCPT + 99 others); Thu, 22 Nov 2018 15:50:40 -0500 Received: from terminus.zytor.com ([198.137.202.136]:52319 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387936AbeKVUuk (ORCPT ); Thu, 22 Nov 2018 15:50:40 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wAMAASHs3743740 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 22 Nov 2018 02:10:28 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wAMAASnr3743737; Thu, 22 Nov 2018 02:10:28 -0800 Date: Thu, 22 Nov 2018 02:10:28 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Andy Lutomirski Message-ID: Cc: peterz@infradead.org, mingo@kernel.org, hpa@zytor.com, bp@alien8.de, riel@surriel.com, yu-cheng.yu@intel.com, torvalds@linux-foundation.org, tglx@linutronix.de, luto@kernel.org, dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org Reply-To: peterz@infradead.org, mingo@kernel.org, hpa@zytor.com, bp@alien8.de, riel@surriel.com, yu-cheng.yu@intel.com, torvalds@linux-foundation.org, tglx@linutronix.de, luto@kernel.org, dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org In-Reply-To: <9999f151d72ff352265f3274c5ab3a4105090f49.1542841400.git.luto@kernel.org> References: <9999f151d72ff352265f3274c5ab3a4105090f49.1542841400.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/fault: Don't try to recover from an implicit supervisor access Git-Commit-ID: ebb53e2597e2dc7637ab213df006e99681b6ee25 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ebb53e2597e2dc7637ab213df006e99681b6ee25 Gitweb: https://git.kernel.org/tip/ebb53e2597e2dc7637ab213df006e99681b6ee25 Author: Andy Lutomirski AuthorDate: Wed, 21 Nov 2018 15:11:23 -0800 Committer: Ingo Molnar CommitDate: Thu, 22 Nov 2018 09:23:00 +0100 x86/fault: Don't try to recover from an implicit supervisor access This avoids a situation in which we attempt to apply various fixups that are not intended to handle implicit supervisor accesses from user mode if we screw up in a way that causes this type of fault. Signed-off-by: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Yu-cheng Yu Link: http://lkml.kernel.org/r/9999f151d72ff352265f3274c5ab3a4105090f49.1542841400.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/mm/fault.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 82881bc5feef..ca38bd0472f2 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -653,6 +653,15 @@ no_context(struct pt_regs *regs, unsigned long error_code, unsigned long flags; int sig; + if (user_mode(regs)) { + /* + * This is an implicit supervisor-mode access from user + * mode. Bypass all the kernel-mode recovery code and just + * OOPS. + */ + goto oops; + } + /* Are we prepared to handle this kernel fault? */ if (fixup_exception(regs, X86_TRAP_PF, error_code, address)) { /* @@ -738,6 +747,7 @@ no_context(struct pt_regs *regs, unsigned long error_code, if (IS_ENABLED(CONFIG_EFI)) efi_recover_from_page_fault(address); +oops: /* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice: