summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/platform/kvm/allocator.go
diff options
context:
space:
mode:
authorlubinszARM <34124929+lubinszARM@users.noreply.github.com>2019-10-30 15:51:42 -0700
committergVisor bot <gvisor-bot@google.com>2019-10-30 15:53:31 -0700
commitca933329fa46ce219b39f4cf8cba1754b36cc2c2 (patch)
treef9bf28a63dbe2dfb48e9d38be8d84d0cbfac9235 /pkg/sentry/platform/kvm/allocator.go
parentca90dad0e21c758925968d217ad15a05015bd82c (diff)
support using KVM_MEM_READONLY for arm64 regions
On Arm platform, "setMemoryRegion" has extra permission checks. In virt/kvm/arm/mmu.c: kvm_arch_prepare_memory_region() .... if (writable && !(vma->vm_flags & VM_WRITE)) { ret = -EPERM; break; } .... So, for Arm platform, the "flags" for kvm_memory_region is required. And on x86 platform, the "flags" can be always set as '0'. Signed-off-by: Bin Lu <bin.lu@arm.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/google/gvisor/pull/810 from lubinszARM:pr_setregion 8c99b19cfb0c859c6630a1cfff951db65fcf87ac PiperOrigin-RevId: 277602603
Diffstat (limited to 'pkg/sentry/platform/kvm/allocator.go')
-rw-r--r--pkg/sentry/platform/kvm/allocator.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/platform/kvm/allocator.go b/pkg/sentry/platform/kvm/allocator.go
index 80942e9c9..3f35414bb 100644
--- a/pkg/sentry/platform/kvm/allocator.go
+++ b/pkg/sentry/platform/kvm/allocator.go
@@ -54,7 +54,7 @@ func (a allocator) PhysicalFor(ptes *pagetables.PTEs) uintptr {
//
//go:nosplit
func (a allocator) LookupPTEs(physical uintptr) *pagetables.PTEs {
- virtualStart, physicalStart, _, ok := calculateBluepillFault(physical)
+ virtualStart, physicalStart, _, ok := calculateBluepillFault(physical, physicalRegions)
if !ok {
panic(fmt.Sprintf("LookupPTEs failed for 0x%x", physical))
}