hypervisor: mshv: fix GVA translation flags

Original we checked for R and W, but that code path never got executed.

It is now understood that we can only get here when we execute code. Fix
the permission flags.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2024-07-03 18:54:48 +00:00 committed by Liu Wei
parent 1eb4133034
commit 67f22b6aa4

View File

@ -1526,8 +1526,10 @@ impl<'a> MshvEmulatorContext<'a> {
return Ok(self.map.1);
}
// TODO: More fine-grained control for the flags
let flags = HV_TRANSLATE_GVA_VALIDATE_READ | HV_TRANSLATE_GVA_VALIDATE_WRITE;
// We can only get into here when executing guest code. Check for R and X permissions. In
// the future if we have other use cases, we may want to allow the caller to specify the
// flags.
let flags = HV_TRANSLATE_GVA_VALIDATE_READ | HV_TRANSLATE_GVA_VALIDATE_EXECUTE;
let (gpa, result_code) = self
.vcpu