KVM: arm/arm64: reduce verbosity of KVM init log
PATCH 1/1 KVM: arm/arm64: reduce verbosity of KVM init log
On my GICv3 system, the following is printed to the kernel log at boot:
kvm [1]: 8-bit VMID
kvm [1]: IDMAP page: d20e35000
kvm [1]: HYP VA range: 800000000000:ffffffffffff kvm [1]: vgic-v2 at 2c020000
kvm [1]: GIC system register CPU interface enabled kvm [1]: vgic interrupt IRQ1
kvm [1]: virtual timer IRQ4
kvm [1]: Hyp mode initialized successfully
The KVM IDMAP is a mapping of a statically allocated kernel structure, and so printing its physical address leaks the physical placement of the kernel when physical KASLR in effect. So change the kvm_info() to kvm_debug() to remove it from the log output.
While at it, trim the output a bit more: IRQ numbers can be found in /proc/interrupts, and the HYP VA and vgic-v2 lines are not highly informational either.
--- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/mmu.c | 6 +++--- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/arm/vgic/vgic-v2.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
virt/kvm/arm/arch_timer.c +1 -1
@@ -755,7 +755,7 @@ int kvm_timer_hyp_init(bool has_gic) } } -kvm_info ("virtual timer IRQ%d\n" , host_vtimer_irq); +kvm_debug ("virtual timer IRQ%d\n" , host_vtimer_irq); cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING, "kvm/arm/timer:starting", kvm_timer_starting_cpu,
virt/kvm/arm/mmu.c +3 -3
@@ -1810,9 +1810,9 @@ int kvm_mmu_init(void)*/ BUG_ON ((hyp_idmap_start ^ (hyp_idmap_end -1 )) &PAGE_MASK ); -kvm_info ("IDMAP page: %lx\n" , hyp_idmap_start); -kvm_info ("HYP VA range: %lx:%lx\n" , -kern_hyp_va (PAGE_OFFSET ),kern_hyp_va (~0UL )); +kvm_debug ("IDMAP page: %lx\n" , hyp_idmap_start); +kvm_debug ("HYP VA range: %lx:%lx\n" , +kern_hyp_va (PAGE_OFFSET ),kern_hyp_va (~0UL )); if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && hyp_idmap_start < kern_hyp_va(~0UL) &&
virt/kvm/arm/vgic/vgic-init.c +1 -1
@@ -520,7 +520,7 @@ int kvm_vgic_hyp_init(void) goto out_free_irq; } -kvm_info ("vgic interrupt IRQ%d\n" , kvm_vgic_global_state.maint_irq); +kvm_debug ("vgic interrupt IRQ%d\n" , kvm_vgic_global_state.maint_irq);return 0 ; out_free_irq:
virt/kvm/arm/vgic/vgic-v2.c +1 -1
@@ -410,7 +410,7 @@ int vgic_v2_probe(const struct gic_kvm_info *info) kvm_vgic_global_state.type =VGIC_V2 ; kvm_vgic_global_state.max_gic_vcpus =VGIC_V2_MAX_CPUS ; -kvm_info ("vgic-v2@%llx\n" , info->vctrl.start); +kvm_debug ("vgic-v2@%llx\n" , info->vctrl.start);return 0 ; out:
Signature · 1 line
2.11.0
PATCH 1/1 KVM: arm/arm64: reduce verbosity of KVM init log
Quoted 20 lines · Ard Biesheuvel
On my GICv3 system, the following is printed to the kernel log at boot:
kvm [1]: 8-bit VMID
kvm [1]: IDMAP page:d20e35000
kvm [1]: HYP VA range: 800000000000:ffffffffffff kvm [1]: vgic-v2 at2c020000
kvm [1]: GIC system register CPU interface enabled kvm [1]: vgic interrupt IRQ1
kvm [1]: virtual timer IRQ4
kvm [1]: Hyp mode initialized successfullyThe KVM IDMAP is a mapping of a statically allocated kernel structure, and so printing its physical address leaks the physical placement of the kernel when physical KASLR in effect. So change the
kvm_info()tokvm_debug()to remove it from the log output.While at it, trim the output a bit more: IRQ numbers can be found in
/proc/interrupts, and the HYP VA and vgic-v2 lines are not highly informational either.
Quoted 8 lines
Cc <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>--- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/mmu.c | 6 +++--- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/arm/vgic/vgic-v2.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
Will
PATCH 1/1 KVM: arm/arm64: reduce verbosity of KVM init log
In reply to Ard BiesheuvelQuoted 86 lines · Ard Biesheuvel
On my GICv3 system, the following is printed to the kernel log at boot:
kvm [1]: 8-bit VMID
kvm [1]: IDMAP page:d20e35000
kvm [1]: HYP VA range: 800000000000:ffffffffffff kvm [1]: vgic-v2 at2c020000
kvm [1]: GIC system register CPU interface enabled kvm [1]: vgic interrupt IRQ1
kvm [1]: virtual timer IRQ4
kvm [1]: Hyp mode initialized successfullyThe KVM IDMAP is a mapping of a statically allocated kernel structure, and so printing its physical address leaks the physical placement of the kernel when physical KASLR in effect. So change the
kvm_info()tokvm_debug()to remove it from the log output.While at it, trim the output a bit more: IRQ numbers can be found in
/proc/interrupts, and the HYP VA and vgic-v2 lines are not highly informational either.Cc <[email protected]>Signed-off-by Ard Biesheuvel <[email protected]>--- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/mmu.c | 6 +++--- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/arm/vgic/vgic-v2.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)virt/kvm/arm/arch_timer.c +1
-1@@ -755,7 +755,7 @@ int kvm_timer_hyp_init(bool has_gic) } } -kvm_info ("virtual timer IRQ%d\n" , host_vtimer_irq); +kvm_debug ("virtual timer IRQ%d\n" , host_vtimer_irq); cpuhp_setup_state(CPUHP_AP_KVM_ARM_TIMER_STARTING, "kvm/arm/timer:starting", kvm_timer_starting_cpu,virt/kvm/arm/mmu.c +3
-3@@ -1810,9 +1810,9 @@ int kvm_mmu_init(void)*/ BUG_ON ((hyp_idmap_start ^ (hyp_idmap_end -1 )) &PAGE_MASK ); -kvm_info ("IDMAP page: %lx\n" , hyp_idmap_start); -kvm_info ("HYP VA range: %lx:%lx\n" , -kern_hyp_va (PAGE_OFFSET ),kern_hyp_va (~0UL )); +kvm_debug ("IDMAP page: %lx\n" , hyp_idmap_start); +kvm_debug ("HYP VA range: %lx:%lx\n" , +kern_hyp_va (PAGE_OFFSET ),kern_hyp_va (~0UL )); if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && hyp_idmap_start < kern_hyp_va(~0UL) &&virt/kvm/arm/vgic/vgic-init.c +1
-1@@ -520,7 +520,7 @@ int kvm_vgic_hyp_init(void) goto out_free_irq; } -kvm_info ("vgic interrupt IRQ%d\n" , kvm_vgic_global_state.maint_irq); +kvm_debug ("vgic interrupt IRQ%d\n" , kvm_vgic_global_state.maint_irq);return 0 ; out_free_irq:virt/kvm/arm/vgic/vgic-v2.c +1
-2@@ -410,7 +410,7 @@ int vgic_v2_probe(const struct gic_kvm_info *info) kvm_vgic_global_state.type =VGIC_V2 ; kvm_vgic_global_state.max_gic_vcpus =VGIC_V2_MAX_CPUS ; -kvm_info ("vgic-v2@%llx\n" , info->vctrl.start); +kvm_debug ("vgic-v2@%llx\n" , info->vctrl.start);return 0 ; out: --
Quoted 2 lines
2.11.0