Skip to contentSkip to conversation

x86/pti: Add pti= cmdline option and documentation

PATCH In review Borislav Petkov 4 participants 5 messages Dec 12, 2017 – Dec 18, 2017

Subsystems (3)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/pti: Add pti= cmdline option and documentation

From: Borislav Petkov <[email protected]>

Keep the "nopti" for traditional reasons.

Cc Linus Torvalds <[email protected]>
Cc Andy Lutomirsky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Greg KH <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Juergen Gross <[email protected]>
Cc David Laight <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Will Deacon <[email protected]>
---
 Documentation/admin-guide/kernel-parameters.txt |  6 ++++++
 arch/x86/mm/pti.c                               | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +6 -0
index 5dfd26265484..520fdec15bbb 100644
@@ -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.
arch/x86/mm/pti.c +18 -0
index f48645d2f3fd..4afa16b444b2 100644
@@ -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);
 }
Signature · 1 line
2.13.0
#2 lore raw
In reply to Borislav Petkov

Hi Borislav, [+ tglx]

Quoted 23 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

Keep the "nopti" for traditional reasons.

Cc Linus Torvalds <[email protected]>
Cc Andy Lutomirsky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Greg KH <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Juergen Gross <[email protected]>
Cc David Laight <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Will Deacon <[email protected]>
Quoted 4 lines
---
 Documentation/admin-guide/kernel-parameters.txt |  6 ++++++
 arch/x86/mm/pti.c                               | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)

On arm64, I've gone for kpti=. I'm happy to change this to align with x86, but the patches are queued now so I don't want to keep changing it.

Is "pti=" definitely what you're going for on x86?

Will

#3 lore raw
Quoted 29 lines · Will Deacon
Quoted 23 lines · Borislav Petkov

From: Borislav Petkov <[email protected]>

Keep the "nopti" for traditional reasons.

Cc Linus Torvalds <[email protected]>
Cc Andy Lutomirsky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Greg KH <[email protected]>
Cc Brian Gerst <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc Boris Ostrovsky <[email protected]>
Cc Juergen Gross <[email protected]>
Cc David Laight <[email protected]>
Cc Eduardo Valentin <[email protected]>
Cc Will Deacon <[email protected]>
Quoted 4 lines
---
 Documentation/admin-guide/kernel-parameters.txt |  6 ++++++
 arch/x86/mm/pti.c                               | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+)
Quoted 4 lines

On arm64, I've gone for kpti=. I'm happy to change this to align with x86, but the patches are queued now so I don't want to keep changing it.

Is "pti=" definitely what you're going for on x86?

It was pointed out to me yesterday that "kpti" can be pronounced "cuppatea", whereas "pti" doesn't roll off the tongue nearly so easily this side of the pond.

But I would still like to avoid divergence on the name.

Will

#4 lore raw
Quoted 1 line · Will Deacon

But I would still like to avoid divergence on the name.

Please rename it to 'PTI' to sync the naming with x86.

Thanks,

Ingo