From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754371AbdLLNkK (ORCPT ); Tue, 12 Dec 2017 08:40:10 -0500 Received: from mail.skyhub.de ([5.9.137.197]:39914 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754254AbdLLNkF (ORCPT ); Tue, 12 Dec 2017 08:40:05 -0500 From: Borislav Petkov To: X86 ML Cc: LKML , Linus Torvalds , Andy Lutomirsky , Peter Zijlstra , Dave Hansen , Greg KH , keescook@google.com, hughd@google.com, Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , aliguori@amazon.com, Will Deacon , daniel.gruss@iaik.tugraz.at Subject: [PATCH] x86/pti: Add pti= cmdline option and documentation Date: Tue, 12 Dec 2017 14:39:52 +0100 Message-Id: <20171212133952.10177-1-bp@alien8.de> X-Mailer: git-send-email 2.13.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Keep the "nopti" for traditional reasons. Requested-by: Linus Torvalds Signed-off-by: Borislav Petkov Cc: Linus Torvalds Cc: Andy Lutomirsky Cc: Peter Zijlstra Cc: Dave Hansen Cc: Greg KH Cc: keescook@google.com Cc: hughd@google.com Cc: Brian Gerst Cc: Josh Poimboeuf Cc: Denys Vlasenko Cc: Boris Ostrovsky Cc: Juergen Gross Cc: David Laight Cc: Eduardo Valentin Cc: aliguori@amazon.com Cc: Will Deacon Cc: daniel.gruss@iaik.tugraz.at --- Documentation/admin-guide/kernel-parameters.txt | 6 ++++++ arch/x86/mm/pti.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 5dfd26265484..520fdec15bbb 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3255,6 +3255,12 @@ pt. [PARIDE] See Documentation/blockdev/paride.txt. + pti= [X86_64] + Control user/kernel address space isolation: + on - enable + off - disable + auto - default setting + pty.legacy_count= [KNL] Number of legacy pty's. Overwrites compiled-in default number. diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index f48645d2f3fd..4afa16b444b2 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -51,15 +51,33 @@ void __init pti_check_boottime_disable(void) { bool enable = true; + char arg[5]; + + if (cmdline_find_option(boot_command_line, "pti", arg, sizeof(arg))) { + if (!strncmp(arg, "on", 2)) + goto enable; + + if (!strncmp(arg, "off", 3)) { + pr_info("disabled on command line.\n"); + return; + } + + if (!strncmp(arg, "auto", 4)) + goto skip; + } if (cmdline_find_option_bool(boot_command_line, "nopti")) { pr_info("disabled on command line.\n"); enable = false; } + +skip: if (hypervisor_is_type(X86_HYPER_XEN_PV)) { pr_info("disabled on XEN_PV.\n"); enable = false; } + +enable: if (enable) setup_force_cpu_bug(X86_BUG_CPU_SECURE_MODE_PTI); } -- 2.13.0