Skip to content

Conversation

@valpackett
Copy link
Contributor

aarch64 KVM has recently introduced guest_memfd support, but since there are no VM TEEs with upstream support on that arch, it returns EINVAL when we try to create a non-mappable memfd (which is what flags==0 implies).

Then.. even if we make it mappable and skip setting the private flag, we get a 100% CPU busy loop in the guest. Same happens in QEMU though so that's not a libkrun bug. Still, let's avoid all of that by not trying to use guest_memfd for protecting the VM's memory outside of platforms where that's explicitly supported (SEV/TDX).

…iners#478)

aarch64 KVM has recently introduced guest_memfd support, but since there
are no VM TEEs with upstream support on that arch, it returns EINVAL when
we try to create a non-mappable memfd (which is what flags==0 implies).

Then.. even if we make it mappable and skip setting the private flag,
we get a 100% CPU busy loop in the guest. Same happens in QEMU though
so that's not a libkrun bug. Still, let's avoid *all* of that by not
trying to use guest_memfd for protecting the VM's memory outside of
platforms where that's explicitly supported (SEV/TDX).

Signed-off-by: Val Packett <val@invisiblethingslab.com>
.map_err(Error::SetUserMemoryRegion)?;
};
} else {
if !self.fd.check_extension(GuestMemfd) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be made an else if to avoid unnecessary nesting?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this was made into an else if, we would need another conditional branch to return Error::KvmCap(GuestMemfd). It's better as it is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants