diff options
Diffstat (limited to 'pkg/sentry/platform')
-rw-r--r-- | pkg/sentry/platform/kvm/BUILD | 12 | ||||
-rw-r--r-- | pkg/sentry/platform/kvm/kvm_safecopy_test.go | 1 | ||||
-rw-r--r-- | pkg/sentry/platform/kvm/machine.go | 2 | ||||
-rw-r--r-- | pkg/sentry/platform/kvm/machine_amd64.go | 2 | ||||
-rw-r--r-- | pkg/sentry/platform/kvm/machine_arm64.go | 50 |
5 files changed, 33 insertions, 34 deletions
diff --git a/pkg/sentry/platform/kvm/BUILD b/pkg/sentry/platform/kvm/BUILD index 9aba92e91..a26f54269 100644 --- a/pkg/sentry/platform/kvm/BUILD +++ b/pkg/sentry/platform/kvm/BUILD @@ -87,6 +87,12 @@ go_test( "virtual_map_test.go", ], library = ":kvm", + # FIXME(gvisor.dev/issue/3374): Not working with all build systems. + nogo = False, + # cgo has to be disabled. We have seen libc that blocks all signals and + # calls mmap from pthread_create, but we use SIGSYS to trap mmap system + # calls. + pure = True, tags = [ "manual", "nogotsan", @@ -106,12 +112,6 @@ go_test( "//pkg/sentry/time", "@org_golang_x_sys//unix:go_default_library", ], - # FIXME(gvisor.dev/issue/3374): Not working with all build systems. - nogo = False, - # cgo has to be disabled. We have seen libc that blocks all signals and - # calls mmap from pthread_create, but we use SIGSYS to trap mmap system - # calls. - pure = True, ) genrule( diff --git a/pkg/sentry/platform/kvm/kvm_safecopy_test.go b/pkg/sentry/platform/kvm/kvm_safecopy_test.go index cbfc61919..9a87c9e6f 100644 --- a/pkg/sentry/platform/kvm/kvm_safecopy_test.go +++ b/pkg/sentry/platform/kvm/kvm_safecopy_test.go @@ -102,4 +102,3 @@ func TestSafecopy(t *testing.T) { } }) } - diff --git a/pkg/sentry/platform/kvm/machine.go b/pkg/sentry/platform/kvm/machine.go index dce6960f9..dcf34015d 100644 --- a/pkg/sentry/platform/kvm/machine.go +++ b/pkg/sentry/platform/kvm/machine.go @@ -279,7 +279,7 @@ func newMachine(vm int) (*machine, error) { } } - for _, vr := range(readOnlyGuestRegions) { + for _, vr := range readOnlyGuestRegions { mapRegion(vr, _KVM_MEM_READONLY) } diff --git a/pkg/sentry/platform/kvm/machine_amd64.go b/pkg/sentry/platform/kvm/machine_amd64.go index 52e0a2f37..ab1e036b7 100644 --- a/pkg/sentry/platform/kvm/machine_amd64.go +++ b/pkg/sentry/platform/kvm/machine_amd64.go @@ -502,6 +502,6 @@ func (m *machine) getNewVCPU() *vCPU { return nil } -func archPhysicalRegions(physicalRegions []physicalRegion) ([]physicalRegion) { +func archPhysicalRegions(physicalRegions []physicalRegion) []physicalRegion { return physicalRegions } diff --git a/pkg/sentry/platform/kvm/machine_arm64.go b/pkg/sentry/platform/kvm/machine_arm64.go index 2a25a757f..08d98c479 100644 --- a/pkg/sentry/platform/kvm/machine_arm64.go +++ b/pkg/sentry/platform/kvm/machine_arm64.go @@ -112,7 +112,7 @@ func rdonlyRegionsForSetMem() (phyRegions []physicalRegion) { // archPhysicalRegions fills readOnlyGuestRegions and allocates separate // physical regions form them. -func archPhysicalRegions(physicalRegions []physicalRegion) ([]physicalRegion) { +func archPhysicalRegions(physicalRegions []physicalRegion) []physicalRegion { applyVirtualRegions(func(vr virtualRegion) { if excludeVirtualRegion(vr) { return // skip region. @@ -125,26 +125,26 @@ func archPhysicalRegions(physicalRegions []physicalRegion) ([]physicalRegion) { rdRegions := readOnlyGuestRegions[:] // Add an unreachable region. - rdRegions = append(rdRegions, region { + rdRegions = append(rdRegions, region{ virtual: 0xffffffffffffffff, - length: 0, + length: 0, }) - var regions []physicalRegion + var regions []physicalRegion addValidRegion := func(r *physicalRegion, virtual, length uintptr) { if length == 0 { return } - regions = append(regions, physicalRegion { - region: region{ - virtual: virtual, - length: length, - }, - physical: r.physical + (virtual - r.virtual), + regions = append(regions, physicalRegion{ + region: region{ + virtual: virtual, + length: length, + }, + physical: r.physical + (virtual - r.virtual), }) } i := 0 - for _, pr := range(physicalRegions) { + for _, pr := range physicalRegions { start := pr.virtual end := pr.virtual + pr.length for start < end { @@ -160,16 +160,16 @@ func archPhysicalRegions(physicalRegions []physicalRegion) ([]physicalRegion) { if end < rdStart { newEnd = end } - addValidRegion(&pr, start, newEnd - start) + addValidRegion(&pr, start, newEnd-start) start = rdStart continue } if rdEnd < end { - addValidRegion(&pr, start, rdEnd - start) + addValidRegion(&pr, start, rdEnd-start) start = rdEnd continue } - addValidRegion(&pr, start, end - start) + addValidRegion(&pr, start, end-start) start = end } } @@ -178,7 +178,7 @@ func archPhysicalRegions(physicalRegions []physicalRegion) ([]physicalRegion) { } // Get all available physicalRegions. -func availableRegionsForSetMem() ([]physicalRegion) { +func availableRegionsForSetMem() []physicalRegion { var excludedRegions []region applyVirtualRegions(func(vr virtualRegion) { if !vr.accessType.Write { @@ -187,9 +187,9 @@ func availableRegionsForSetMem() ([]physicalRegion) { }) // Add an unreachable region. - excludedRegions = append(excludedRegions, region { + excludedRegions = append(excludedRegions, region{ virtual: 0xffffffffffffffff, - length: 0, + length: 0, }) var regions []physicalRegion @@ -197,16 +197,16 @@ func availableRegionsForSetMem() ([]physicalRegion) { if length == 0 { return } - regions = append(regions, physicalRegion { - region: region{ - virtual: virtual, - length: length, - }, - physical: r.physical + (virtual - r.virtual), + regions = append(regions, physicalRegion{ + region: region{ + virtual: virtual, + length: length, + }, + physical: r.physical + (virtual - r.virtual), }) } i := 0 - for _, pr := range(physicalRegions) { + for _, pr := range physicalRegions { start := pr.virtual end := pr.virtual + pr.length for start < end { @@ -226,7 +226,7 @@ func availableRegionsForSetMem() ([]physicalRegion) { if rend > end { rend = end } - addValidRegion(&pr, start, rend - start) + addValidRegion(&pr, start, rend-start) start = excludeEnd } } |