Messages in this thread | | | Date | Thu, 21 Dec 2023 18:27:59 +0000 | From | Oliver Upton <> | Subject | Re: [PATCH v4 10/10] arm64: ptdump: Add guest stage-2 pagetables dumping |
| |
On Mon, Dec 18, 2023 at 01:59:00PM +0000, Sebastian Ene wrote: > Register a debugfs file on guest creation to be able to view their > second translation tables with ptdump. This assumes that the host is in > control of the guest stage-2 and has direct access to the pagetables. > > Signed-off-by: Sebastian Ene <sebastianene@google.com>
I couldn't see how this patched worked at all until I went back to patch 1 and found this:
> +static int kvm_ptdump_open(struct inode *inode, struct file *file) > +{
[...]
> + if (!reg->show_ptdump_info) > + reg->show_ptdump_info = kvm_ptdump_show;
[...]
> +}
> +static int kvm_ptdump_show(struct seq_file *m, void *) > +{ > + struct kvm *guest_kvm = m->private; > + struct kvm_s2_mmu *mmu = &guest_kvm->arch.mmu; > + int ret; > + > + write_lock(&guest_kvm->mmu_lock); > + ret = kvm_ptdump_show_common(m, mmu->pgt); > + write_unlock(&guest_kvm->mmu_lock); > + > + return ret; > +}
Where are you getting a reference on the kvm struct? You need to do this to ensure the VM doesn't get destroyed behind your back.
-- Thanks, Oliver
| |