Skip to contentSkip to conversation

cpu/speculation: Warn on unsupported mitigations= parameter

PATCH In review Geert Uytterhoeven 5 participants 5 messages May 16, 2019 – Jun 26, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpu/speculation: Warn on unsupported mitigations= parameter

Currently, if the user specifies an unsupported mitigation strategy on the kernel command line, it will be ignored silently. The code will fall back to the default strategy, possibly leaving the system more vulnerable than expected.

This may happen due to e.g. a simple typo, or, for a stable kernel release, because not all mitigation strategies have been backported.

Inform the user by printing a message.

Fixes 98af8452945c5565 ("cpu/speculation: Add 'mitigations=' cmdline option")
---
 kernel/cpu.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/cpu.c +3 -0
index f2ef10460698e9ec..8458fda00e6ddb88 100644
@@ -2339,6 +2339,9 @@ static int __init mitigations_parse_cmdline(char *arg)
 		cpu_mitigations = CPU_MITIGATIONS_AUTO;
 	else if (!strcmp(arg, "auto,nosmt"))
 		cpu_mitigations = CPU_MITIGATIONS_AUTO_NOSMT;
+	else
+		pr_crit("Unsupported mitigations=%s, system may still be vulnerable\n",
+			arg);
 
 	return 0;
 }
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Geert Uytterhoeven

Currently, if the user specifies an unsupported mitigation strategy on the kernel command line, it will be ignored silently. The code will fall back to the default strategy, possibly leaving the system more vulnerable than expected.

Honestly, I am not convinced. We are not doing this for vast majority of other cmdline options either, if for any at all.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 9 lines · Jiri Kosina
Quoted 4 lines · Geert Uytterhoeven

Currently, if the user specifies an unsupported mitigation strategy on the kernel command line, it will be ignored silently. The code will fall back to the default strategy, possibly leaving the system more vulnerable than expected.

Honestly, I am not convinced. We are not doing this for vast majority of other cmdline options either, if for any at all.

That's really a weakness - I've been bitten by this previously: I typoed or mis-remembered a command line option and didn't have it while I thought I had it.

Our boot-commandline library is pretty user-unfriendly.

Thanks,

Ingo

Acked-by on v1 1/1
#3 lore raw
In reply to Geert Uytterhoeven
Quoted 34 lines · Geert Uytterhoeven

Currently, if the user specifies an unsupported mitigation strategy on the kernel command line, it will be ignored silently. The code will fall back to the default strategy, possibly leaving the system more vulnerable than expected.

This may happen due to e.g. a simple typo, or, for a stable kernel release, because not all mitigation strategies have been backported.

Inform the user by printing a message.

Fixes 98af8452945c5565 ("cpu/speculation: Add 'mitigations=' cmdline option")
---
 kernel/cpu.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/cpu.c +3 -0
index f2ef10460698e9ec..8458fda00e6ddb88 100644
@@ -2339,6 +2339,9 @@ static int __init mitigations_parse_cmdline(char *arg)
 		cpu_mitigations = CPU_MITIGATIONS_AUTO;
 	else if (!strcmp(arg, "auto,nosmt"))
 		cpu_mitigations = CPU_MITIGATIONS_AUTO_NOSMT;
+	else
+		pr_crit("Unsupported mitigations=%s, system may still be vulnerable\n",
+			arg);
 
 	return 0;
 }
Signature · 1 line
2.17.1
Signature · 1 line
Josh
#4 lore raw
In reply to Geert Uytterhoeven
cpu/speculation: Warn on unsupported mitigations= parameter
Commit-ID:  1bf72720281770162c87990697eae1ba2f1d917a
Gitweb:     https://git.kernel.org/tip/1bf72720281770162c87990697eae1ba2f1d917a
Author:     Geert Uytterhoeven <[email protected]>
AuthorDate: Thu, 16 May 2019 09:09:35 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 26 Jun 2019 16:56:21 +0200

cpu/speculation: Warn on unsupported mitigations= parameter

Currently, if the user specifies an unsupported mitigation strategy on the kernel command line, it will be ignored silently. The code will fall back to the default strategy, possibly leaving the system more vulnerable than expected.

This may happen due to e.g. a simple typo, or, for a stable kernel release, because not all mitigation strategies have been backported.

Inform the user by printing a message.

Fixes 98af8452945c5565 ("cpu/speculation: Add 'mitigations=' cmdline option")
Cc Peter Zijlstra <[email protected]>
Cc Jiri Kosina <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Ben Hutchings <[email protected]>
---
 kernel/cpu.c | 3 +++
 1 file changed, 3 insertions(+)
kernel/cpu.c +3 -0
index 077fde6fb953..551db494f153 100644
@@ -2339,6 +2339,9 @@ static int __init mitigations_parse_cmdline(char *arg)
 		cpu_mitigations = CPU_MITIGATIONS_AUTO;
 	else if (!strcmp(arg, "auto,nosmt"))
 		cpu_mitigations = CPU_MITIGATIONS_AUTO_NOSMT;
+	else
+		pr_crit("Unsupported mitigations=%s, system may still be vulnerable\n",
+			arg);
 
 	return 0;
 }