Re: [PATCH 11/18] KVM: x86: Pass the instruction length on memory fault user-space exits

Nicolas Saenz Julienne
2024-09-16T15:53:52Z

On Fri Sep 13, 2024 at 7:11 PM UTC, Sean Christopherson wrote:
> On Sun, Jun 09, 2024, Nicolas Saenz Julienne wrote:
> > In order to simplify Hyper-V VSM secure memory intercept generation in
> > user-space (it avoids the need of implementing an x86 instruction
> > decoder and the actual decoding). Pass the instruction length being run
> > at the time of the guest exit as part of the memory fault exit
> > information.
>
> Why does userspace need the instruction length, but not the associated code stream?

Since the fault already provides the GPA it's trivial to read it from
the VMM. Then again, now that I've dug deeper into the RWX memory
attributes's edge cases, this doesn't always work. For example when
getting a fault during a page walk (the CPU being unable to access the
page that contains the next GPTE due to it being marked non-readable by
a memattr). The fault exit GPA will not point to the code stream.

I will rework/rethink this once I have the complete memattrs story.

Thanks,
Nicolas