From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964957AbbEHTDn (ORCPT ); Fri, 8 May 2015 15:03:43 -0400 Received: from mga03.intel.com ([134.134.136.65]:24923 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753633AbbEHS7i (ORCPT ); Fri, 8 May 2015 14:59:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,391,1427785200"; d="scan'208";a="491194288" Subject: [PATCH 07/19] x86, mpx: boot-time disable To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, tglx@linutronix.de, Dave Hansen , dave.hansen@linux.intel.com From: Dave Hansen Date: Fri, 08 May 2015 11:59:51 -0700 References: <20150508185948.4C19F4B0@viggo.jf.intel.com> In-Reply-To: <20150508185948.4C19F4B0@viggo.jf.intel.com> Message-Id: <20150508185951.279CBD42@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen MPX has the _potential_ to cause some issues. Say part of your init system tried to protect one of its components from buffer overflows with MPX. If there were a false positive, it's possible that MPX could keep a system from booting. MPX could also potentially cause performance issues since it is present in hot paths like the unmap path. Allow it to be disabled at boot time. Signed-off-by: Dave Hansen --- b/Documentation/kernel-parameters.txt | 4 ++++ b/arch/x86/kernel/cpu/common.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff -puN arch/x86/kernel/cpu/common.c~x86-mpx-disable-boot-time arch/x86/kernel/cpu/common.c --- a/arch/x86/kernel/cpu/common.c~x86-mpx-disable-boot-time 2015-05-08 11:46:13.048674454 -0700 +++ b/arch/x86/kernel/cpu/common.c 2015-05-08 11:46:13.053674679 -0700 @@ -172,6 +172,22 @@ static int __init x86_xsaves_setup(char } __setup("noxsaves", x86_xsaves_setup); +static int __init x86_mpx_setup(char *s) +{ + /* require an exact match without trailing characters */ + if (strlen(s)) + return 0; + + /* do not emit a message if the feature is not present */ + if (!boot_cpu_has(X86_FEATURE_MPX)) + return 1; + + setup_clear_cpu_cap(X86_FEATURE_MPX); + pr_info("nompx: Intel Memory Protection Extensions (MPX) disabled\n"); + return 1; +} +__setup("nompx", x86_mpx_setup); + #ifdef CONFIG_X86_32 static int cachesize_override = -1; static int disable_x86_serial_nr = 1; diff -puN Documentation/kernel-parameters.txt~x86-mpx-disable-boot-time Documentation/kernel-parameters.txt --- a/Documentation/kernel-parameters.txt~x86-mpx-disable-boot-time 2015-05-08 11:46:13.050674544 -0700 +++ b/Documentation/kernel-parameters.txt 2015-05-08 11:46:13.054674724 -0700 @@ -937,6 +937,10 @@ bytes respectively. Such letter suffixes Enable debug messages at boot time. See Documentation/dynamic-debug-howto.txt for details. + nompx [X86] Disables Intel Memory Protection Extensions. + See Documentation/x86/intel_mpx.txt for more + information about the feature. + eagerfpu= [X86] on enable eager fpu restore off disable eager fpu restore _