Skip to contentSkip to conversation

KVM: remove printing of vcpu address

PATCH In review Tobin C. Harding 2 participants 2 messages Oct 9, 2017 – Oct 13, 2017 KVM arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: remove printing of vcpu address

Code currently prints the address of the kvm_vcpu structure in an error message. It is not immediately clear what value this address adds to the error string, we can use the vcpu ID instead. Printing unnecessary kernel addresses to dmesg poses a security risk.

Remove the address from error message output, show vcpu ID instead.

---
 virt/kvm/arm/arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/arm/arch_timer.c +1 -1
index 8e89d63005c7..ca6c331cad28 100644
@@ -88,7 +88,7 @@ static irqreturn_t kvm_arch_timer_handler(int irq, void *dev_id)
 	 * interrupt at this point is a sure sign of some major
 	 * breakage.
 	 */
-	pr_warn("Unexpected interrupt %d on vcpu %p\n", irq, vcpu);
+	pr_warn("Unexpected interrupt %d on vcpu ID %d\n", irq, vcpu->vcpu_id);
 	return IRQ_HANDLED;
 }
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Tobin C. Harding

Code currently prints the address of the kvm_vcpu structure in an error message. It is not immediately clear what value this address adds to the error string, we can use the vcpu ID instead.

I would say it's not immediately clear how the vcpu ID is more valuable. The pointer identifies a unique vcpu across all VMs, vcpu ID does not.

Quoted 2 lines

Printing unnecessary
kernel addresses to dmesg poses a security risk.

Is this really a concern we have for error messages? I understand you can get a single pointer revealed if you have broken hardware or if we have a bug, but I see numerious other examples in the kernel.

If anything, we can remote printing the vcpu pointer entirely.

Thanks,
-Christoffer

Quoted 24 lines

Remove the address from error message output, show vcpu ID instead.

---
 virt/kvm/arm/arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/arm/arch_timer.c +1 -1
index 8e89d63005c7..ca6c331cad28 100644
@@ -88,7 +88,7 @@ static irqreturn_t kvm_arch_timer_handler(int irq, void *dev_id)
 	 * interrupt at this point is a sure sign of some major
 	 * breakage.
 	 */
-	pr_warn("Unexpected interrupt %d on vcpu %p\n", irq, vcpu);
+	pr_warn("Unexpected interrupt %d on vcpu ID %d\n", irq, vcpu->vcpu_id);
 	return IRQ_HANDLED;
 }
 
Signature · 1 line
2.7.4