From a75e0cb69b9c2a210ca7b80c52b37f721bad8f3e Mon Sep 17 00:00:00 2001
From: Juerg Haefliger <juergh@canonical.com>
Date: Wed, 29 May 2019 08:57:47 +0200
Subject: [PATCH] UBUNTU: SAUCE: Clarify IBRS/IBPB runtime state change
 messages

BugLink: https://bugs.launchpad.net/bugs/1830176

The Ubuntu kernel contains runtime controls to enable/disable IBRS and IBPB
which emit messages on state changes. In 4.4.180 upstream added Spectre v2
user space mitigation which also emits a message. Modify the Ubuntu-only
messages to differentiate them from the regular upstream message.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
---
 kernel/sysctl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7d8e7b67d09d..81fdbd81ca80 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -223,9 +223,9 @@ int set_ibpb_enabled(unsigned int val)
 	if (boot_cpu_has(X86_FEATURE_USE_IBPB)) {
 		ibpb_enabled = val;
 		if (ibpb_enabled != prev)
-			pr_info("Spectre V2 : Spectre v2 mitigation: %s "
+			pr_info("Spectre V2 : mitigation: %s "
 				"Indirect Branch Prediction Barrier\n",
-				ibpb_enabled ? "Enabling" : "Disabling");
+				ibpb_enabled ? "Enabling kernel" : "Disabling kernel");
 	} else {
 		ibpb_enabled = 0;
 		if (val) {
@@ -272,10 +272,10 @@ int set_ibrs_enabled(unsigned int val)
 	if (boot_cpu_has(X86_FEATURE_USE_IBRS_FW)) {
 		ibrs_enabled = val;
 		if (ibrs_enabled != prev)
-			pr_info("Spectre V2 : Spectre v2 mitigation: %s "
-				"Indirect Branch Restricted Speculation%s\n",
-				ibrs_enabled ? "Enabling" : "Disabling",
-				ibrs_enabled == 2 ? " (user space)" : "");
+			pr_info("Spectre V2 : mitigation: %s "
+				"Indirect Branch Restricted Speculation\n",
+				ibrs_enabled == 2 ? "Enabling kernel+user" :
+				ibrs_enabled ? "Enabling kernel" : "Disabling");
 
 		if (ibrs_enabled == 0) {
 			/* Always disable IBRS */
-- 
2.30.9