[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <86pl97r3ox.wl-maz@kernel.org>
Date: Mon, 24 Nov 2025 12:54:38 +0000
From: Marc Zyngier <maz@...nel.org>
To: Jack Thomson <jackabt.amazon@...il.com>
Cc: oliver.upton@...ux.dev,
pbonzini@...hat.com,
joey.gouly@....com,
suzuki.poulose@....com,
yuzenghui@...wei.com,
catalin.marinas@....com,
will@...nel.org,
shuah@...nel.org,
linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
isaku.yamahata@...el.com,
xmarcalx@...zon.co.uk,
kalyazin@...zon.co.uk,
jackabt@...zon.com
Subject: Re: [PATCH v3 1/3] KVM: arm64: Add pre_fault_memory implementation
On Mon, 24 Nov 2025 11:34:38 +0000,
Marc Zyngier <maz@...nel.org> wrote:
>
> On Wed, 19 Nov 2025 15:49:08 +0000,
> Jack Thomson <jackabt.amazon@...il.com> wrote:
> >
[...]
> > + fault_info->hpfar_el2 = HPFAR_EL2_NS |
> > + FIELD_PREP(HPFAR_EL2_FIPA, ipa >> 12);
> > +
> > + if (kvm_slot_has_gmem(memslot)) {
> > + ret = gmem_abort(vcpu, ipa, NULL, memslot, false);
> > + } else {
> > + hva = gfn_to_hva_memslot_prot(memslot, gfn, NULL);
> > + if (kvm_is_error_hva(hva)) {
> > + ret = -EFAULT;
> > + goto out;
> > + }
> > + ret = user_mem_abort(vcpu, ipa, NULL, memslot, &page_size, hva,
> > + false);
> > + }
And thinking of it a bit more, this is completely broken. What happens
if the vcpu is in a nested context? You just populate random pages in
an IPA space that is not relevant at all, corrupting the guest state.
You must correctly handle the context the vcpu is in, instead of
assuming that this is the canonical context. This means going via the
*guest's* S2 translation, just like handle_mem_abort() does.
M.
--
Without deviation from the norm, progress is not possible.
Powered by blists - more mailing lists