[PATCH 4/5] x86/pti: warn for unknown pti boot options
From: Jiang Biao
Date: Mon Jul 16 2018 - 00:22:28 EST
When using unknown pti boot options other than on/off/auto, we
select auto silently, which is sometimes confusing. Add warning for
unknown pti boot options like we do in
spectre_v2_select_mitigation().
Signed-off-by: Jiang Biao <jiang.biao2@xxxxxxxxxx>
---
arch/x86/mm/pti.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index a76b2cc..a368656 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -92,14 +92,14 @@ void __init pti_check_boottime_disable(void)
pti_mode = PTI_FORCE_OFF;
pti_print_if_insecure("disabled on command line.");
return;
- }
- if (ret == 2 && !strncmp(arg, "on", 2)) {
+ } else if (ret == 2 && !strncmp(arg, "on", 2)) {
pti_mode = PTI_FORCE_ON;
pti_print_if_secure("force enabled on command line.");
goto enable;
- }
- if (ret == 4 && !strncmp(arg, "auto", 4)) {
- pti_mode = PTI_AUTO;
+ } else if (ret == 4 && !strncmp(arg, "auto", 4)) {
+ goto autosel;
+ } else {
+ pr_err("unknown option (%s). Switching to AUTO select\n", arg);
goto autosel;
}
}
--
2.7.4