Skip to contentSkip to conversation

Drivers: hv: vmbus: Deactivate sysctl_record_panic_msg by default in isolated guests

PATCH Applied Andrea Parri (Microsoft) 3 participants 3 messages Mar 1, 2022 – Mar 29, 2022

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

PATCH 1/1 Drivers: hv: vmbus: Deactivate sysctl_record_panic_msg by default in isolated guests

hv_panic_page might contain guest-sensitive information, do not dump it over to Hyper-V by default in isolated guests.

While at it, update some comments in hyperv_{panic,die}_event().

---
 drivers/hv/vmbus_drv.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/hv/vmbus_drv.c +12 -6
index 12a2b37e87f30..a963b970ffb2f 100644
@@ -77,8 +77,8 @@ static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
 
 	/*
 	 * Hyper-V should be notified only once about a panic.  If we will be
-	 * doing hyperv_report_panic_msg() later with kmsg data, don't do
-	 * the notification here.
+	 * doing hv_kmsg_dump() with kmsg data later, don't do the notification
+	 * here.
 	 */
 	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE
 	    && hyperv_report_reg()) {
@@ -100,8 +100,8 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
 
 	/*
 	 * Hyper-V should be notified only once about a panic.  If we will be
-	 * doing hyperv_report_panic_msg() later with kmsg data, don't do
-	 * the notification here.
+	 * doing hv_kmsg_dump() with kmsg data later, don't do the notification
+	 * here.
 	 */
 	if (hyperv_report_reg())
 		hyperv_report_panic(regs, val, true);
@@ -1546,14 +1546,20 @@ static int vmbus_bus_init(void)
 	if (ret)
 		goto err_connect;
 
+	if (hv_is_isolation_supported())
+		sysctl_record_panic_msg = 0;
+
 	/*
 	 * Only register if the crash MSRs are available
 	 */
 	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
 		u64 hyperv_crash_ctl;
 		/*
-		 * Sysctl registration is not fatal, since by default
-		 * reporting is enabled.
+		 * Panic message recording (sysctl_record_panic_msg)
+		 * is enabled by default in non-isolated guests and
+		 * disabled by default in isolated guests; the panic
+		 * message recording won't be available in isolated
+		 * guests should the following registration fail.
 		 */
 		hv_ctl_table_hdr = register_sysctl_table(hv_root_table);
 		if (!hv_ctl_table_hdr)
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

From: Andrea Parri (Microsoft) <[email protected]>
Sent: Tuesday, March 1, 2022 6:12 AM
...
hv_panic_page might contain guest-sensitive information, do not dump it over to Hyper-V by default in isolated guests.

While at it, update some comments in hyperv_{panic,die}_event().

---

maintainer Applied
#2 lore raw
Quoted 6 lines · Dexuan Cui
Quoted 6 lines

From: Andrea Parri (Microsoft) <[email protected]>
Sent: Tuesday, March 1, 2022 6:12 AM
...
hv_panic_page might contain guest-sensitive information, do not dump it over to Hyper-V by default in isolated guests.

Quoted 7 lines
Quoted 5 lines

While at it, update some comments in hyperv_{panic,die}_event().

---

Applied to hyperv-fixes. Thanks.