From patchwork Tue Aug 25 00:26:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-cheng Yu X-Patchwork-Id: 11734577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CE6F739 for ; Tue, 25 Aug 2020 00:30:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3902D22CA0 for ; Tue, 25 Aug 2020 00:30:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3902D22CA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 78ADD900018; Mon, 24 Aug 2020 20:30:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 71365900010; Mon, 24 Aug 2020 20:30:40 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600EC900018; Mon, 24 Aug 2020 20:30:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 49C58900010 for ; Mon, 24 Aug 2020 20:30:40 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 198991EE6 for ; Tue, 25 Aug 2020 00:30:40 +0000 (UTC) X-FDA: 77187210240.25.price96_2a184cd27057 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id D84F11804E3A0 for ; Tue, 25 Aug 2020 00:30:39 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,yu-cheng.yu@intel.com,,RULES_HIT:30012:30051:30054:30055:30056:30064,0,RBL:134.134.136.20:@intel.com:.lbl8.mailshell.net-64.95.201.95 62.50.0.100;04yfr9pbpa8osh4wcdx5euib5j5nnoc5fhg4n6cd6oeo5z3wzcxxbu9gxfxpxyr.duds8ee4dxih9qcu5r8naaohawgo7gihp55xo1n3xj1mdsh7x36cbckz45q88a9.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:1:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: price96_2a184cd27057 X-Filterd-Recvd-Size: 4356 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Tue, 25 Aug 2020 00:30:39 +0000 (UTC) IronPort-SDR: BpHzW562IOnG7Q/Kz56xWVIfROjOAqMA6RDVVOSj5OQX+JomMh7Yff6gix0k2121WyV7uAG36x mx3yKJ4m2CHQ== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="143794768" X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="143794768" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 17:30:38 -0700 IronPort-SDR: lYjt4wcfMve2UloFv1ZVhYpn9TLEcoQGsrogMIRpRCyCUOWZ2cXw36gxsL2insLMn2J+uDtF9n 2Af6Rj+f0Ywg== X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="443429341" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 17:30:37 -0700 From: Yu-cheng Yu To: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang Cc: Yu-cheng Yu Subject: [PATCH v11 9/9] x86: Disallow vsyscall emulation when CET is enabled Date: Mon, 24 Aug 2020 17:26:44 -0700 Message-Id: <20200825002645.3658-10-yu-cheng.yu@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200825002645.3658-1-yu-cheng.yu@intel.com> References: <20200825002645.3658-1-yu-cheng.yu@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D84F11804E3A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "H.J. Lu" Emulation of the legacy vsyscall page is required by some programs built before 2013. Newer programs after 2013 don't use it. Disallow vsyscall emulation when Control-flow Enforcement (CET) is enabled to enhance security. Signed-off-by: H.J. Lu Signed-off-by: Yu-cheng Yu --- arch/x86/Kconfig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5bd6d6a10047..bbc68ecfae2b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1210,7 +1210,7 @@ config X86_ESPFIX64 config X86_VSYSCALL_EMULATION bool "Enable vsyscall emulation" if EXPERT default y - depends on X86_64 + depends on X86_64 && !X86_INTEL_CET help This enables emulation of the legacy vsyscall page. Disabling it is roughly equivalent to booting with vsyscall=none, except @@ -1225,6 +1225,8 @@ config X86_VSYSCALL_EMULATION Disabling this option saves about 7K of kernel size and possibly 4K of additional runtime pagetable memory. + This option is disabled when Intel CET is enabled. + config X86_IOPL_IOPERM bool "IOPERM and IOPL Emulation" default y @@ -2361,7 +2363,7 @@ config COMPAT_VDSO choice prompt "vsyscall table for legacy applications" - depends on X86_64 + depends on X86_64 && !X86_INTEL_CET default LEGACY_VSYSCALL_XONLY help Legacy user code that does not know how to find the vDSO expects @@ -2378,6 +2380,8 @@ choice If unsure, select "Emulate execution only". + This option is not enabled when Intel CET is enabled. + config LEGACY_VSYSCALL_EMULATE bool "Full emulation" help