Received: by 10.223.185.116 with SMTP id b49csp3206106wrg; Mon, 5 Mar 2018 16:31:33 -0800 (PST) X-Google-Smtp-Source: AG47ELuoqObwTQXNOK+q3yzk5vYQwExVL+SpQYtqy1iFzyc4/NMSKS3iO/EjtJ8scRpu8tJQBLOD X-Received: by 2002:a17:902:b187:: with SMTP id s7-v6mr14924967plr.448.1520296293355; Mon, 05 Mar 2018 16:31:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520296293; cv=none; d=google.com; s=arc-20160816; b=oAE1tEZ787f6dGW5wYk1o+E5CAbeF8Og3lHG2Dfm3iWKFCNoGhIb87uv8KM8/SqM5a bvcWKdsdlLjzbX1n1NkmLKzu5IZBEcrytWD+eedwn/LZZZFA3PVbHRgeXh6oAOHT5n0Q 0ZFu7EUkOoRXvOWTqEoq3Iq830mEUygOk3HG0FQrCKsmVucqWroMN+uOXzpcd2O7zPdp lKCLn1kNUvW1Mc1OlG0Q4ae2ChReJsHmn7DnwUygK8euYQjY+A8zDQ+TtD8cLjK6UlLr RfmyYK8CjRQenS2nS18aAexzn2QP4Z2wrUgOOJOVkDE3lImoywZzPD+/epptSVi6O0gh AkkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=Vz86igTPHo5J/6qoEzXJX+m9LzxtKitnToNZZ29ko+Y=; b=bWifZ9RfAJBx9DMDDTlBwSukaly3/KpcVUWFfKk/eYvB8AxHlJITx2sAIcoCKlXM36 WnSZ5iaFQV/TnHBgN8EqKNMkf7PYk3csWiiDZgLGbCGzsCPslZgzPGUOBBFju8u3zH1W eNcvWz0SCGKPv3Kcbdz/Wn+4uK4/GJcEQyrubwol/DUhdmUygTZmJK7dNSFtlQWG4l0i E8QA+QTyIBpHuLity3oK5fYVb53c00Qp3QylEsslQjTDyvH3xjTfhsUm2esF1ELYdOEY tbSx7rWYuTttaJ5GD7bRZZChJPwo6EN+gMGLaYikxZU5/KCAnwDwYYLXXvz0JUvl5dTe KDhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=LTnlhGfF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15-v6si10430356pln.718.2018.03.05.16.31.19; Mon, 05 Mar 2018 16:31:33 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=LTnlhGfF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933766AbeCFA3v (ORCPT + 99 others); Mon, 5 Mar 2018 19:29:51 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:40950 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933479AbeCFA0v (ORCPT ); Mon, 5 Mar 2018 19:26:51 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w260Luxv187421; Tue, 6 Mar 2018 00:26:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=Vz86igTPHo5J/6qoEzXJX+m9LzxtKitnToNZZ29ko+Y=; b=LTnlhGfFYGHJQ2+i6Ty0wCqX1/hJx3v8/h+U7Ph7VRVCvGf8sdkH05WErc/BNpsuwHV/ rYMJdu9J2uRGXsfQdudbmXgyCB9O0zHI0q3wIY/Q23cI7xrITxQ/3NqldkR3T+kvByCY 6ZXUf6ihS+aW6Xzwsu75twi4QvZt0K797+TwvIvq2y0rUEqClKB2gKg5pMdTvTi0BwOu 7ckGLIkDaqASKSk+W6GENIWcoABXaFKDXaE8ETJFlA9R5/GuOcXF/QvlNuIR2PBnhza0 /OQjY/QoH7ztvlqBnT0XIJClTcPDDib225+2QBLjqWAA92SCyKh7EnPSynx7JV0IGj1+ mg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ghdxf8jry-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Mar 2018 00:26:45 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w260QjPZ026360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Mar 2018 00:26:45 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w260QibA022319; Tue, 6 Mar 2018 00:26:44 GMT Received: from localhost.localdomain (/98.216.35.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Mar 2018 16:26:44 -0800 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, Alexander.Levin@microsoft.com, dan.j.williams@intel.com, sathyanarayanan.kuppuswamy@intel.com, pankaj.laxminarayan.bharadiya@intel.com, akuster@mvista.com, cminyard@mvista.com, pasha.tatashin@oracle.com, gregkh@linuxfoundation.org, stable@vger.kernel.org Subject: [PATCH 4.1 51/65] x86/kaiser: Rename and simplify X86_FEATURE_KAISER handling Date: Mon, 5 Mar 2018 19:25:24 -0500 Message-Id: <20180306002538.1761-52-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180306002538.1761-1-pasha.tatashin@oracle.com> References: <20180306002538.1761-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8823 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803060003 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Concentrate it in arch/x86/mm/kaiser.c and use the upstream string "nopti". Signed-off-by: Borislav Petkov Signed-off-by: Greg Kroah-Hartman (cherry picked from commit dea9aa9ffae11c91285335cc3215b4f0e48e8139) Signed-off-by: Pavel Tatashin --- Documentation/kernel-parameters.txt | 2 +- arch/x86/kernel/cpu/common.c | 18 ------------------ arch/x86/mm/kaiser.c | 20 +++++++++++++++++++- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 2d75f55419e0..c1f3dbed0021 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -2439,7 +2439,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. nojitter [IA-64] Disables jitter checking for ITC timers. - nokaiser [X86-64] Disable KAISER isolation of kernel from user. + nopti [X86-64] Disable KAISER isolation of kernel from user. no-kvmclock [X86,KVM] Disable paravirtualized KVM clock driver diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 4404a78bdc0a..e80e6e5ede48 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -188,20 +188,6 @@ static int __init x86_pcid_setup(char *s) return 1; } __setup("nopcid", x86_pcid_setup); - -static int __init x86_nokaiser_setup(char *s) -{ - /* nokaiser doesn't accept parameters */ - if (s) - return -EINVAL; -#ifdef CONFIG_KAISER - kaiser_enabled = 0; - setup_clear_cpu_cap(X86_FEATURE_KAISER); - pr_info("nokaiser: KAISER feature disabled\n"); -#endif - return 0; -} -early_param("nokaiser", x86_nokaiser_setup); #endif static int __init x86_noinvpcid_setup(char *s) @@ -776,10 +762,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_power = cpuid_edx(0x80000007); init_scattered_cpuid_features(c); -#ifdef CONFIG_KAISER - if (kaiser_enabled) - set_cpu_cap(c, X86_FEATURE_KAISER); -#endif } static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c) diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c index bfd48347eaac..a724496a5852 100644 --- a/arch/x86/mm/kaiser.c +++ b/arch/x86/mm/kaiser.c @@ -275,8 +275,13 @@ void __init kaiser_init(void) { int cpu; - if (!kaiser_enabled) + if (!kaiser_enabled) { + setup_clear_cpu_cap(X86_FEATURE_KAISER); return; + } + + setup_force_cpu_cap(X86_FEATURE_KAISER); + kaiser_init_all_pgds(); for_each_possible_cpu(cpu) { @@ -419,3 +424,16 @@ void kaiser_flush_tlb_on_return_to_user(void) X86_CR3_PCID_USER_FLUSH | KAISER_SHADOW_PGD_OFFSET); } EXPORT_SYMBOL(kaiser_flush_tlb_on_return_to_user); + +static int __init x86_nokaiser_setup(char *s) +{ + /* nopti doesn't accept parameters */ + if (s) + return -EINVAL; + + kaiser_enabled = 0; + pr_info("Kernel/User page tables isolation: disabled\n"); + + return 0; +} +early_param("nopti", x86_nokaiser_setup); -- 2.16.2