]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
s390: report spectre mitigation via syslog
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 20 Mar 2018 15:33:43 +0000 (16:33 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 28 Mar 2018 06:38:25 +0000 (08:38 +0200)
Add a boot message if either of the spectre defenses is active.
The message is
    "Spectre V2 mitigation: execute trampolines."
or  "Spectre V2 mitigation: limited branch prediction."

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/nospec-branch.c

index 192e633a79d870b21a902b3c16cd5c2ceac5015d..adec38c5f53b18de6fe993ceafdfebd768412ea8 100644 (file)
@@ -32,6 +32,16 @@ static int __init nospec_setup_early(char *str)
 }
 early_param("nospec", nospec_setup_early);
 
+static int __init nospec_report(void)
+{
+       if (IS_ENABLED(CC_USING_EXPOLINE) && !nospec_disable)
+               pr_info("Spectre V2 mitigation: execute trampolines.\n");
+       if (__test_facility(82, S390_lowcore.alt_stfle_fac_list))
+               pr_info("Spectre V2 mitigation: limited branch prediction.\n");
+       return 0;
+}
+arch_initcall(nospec_report);
+
 #ifdef CONFIG_EXPOLINE
 
 int nospec_disable = IS_ENABLED(CONFIG_EXPOLINE_OFF);