google / gvisor

Application Kernel for Containers

Home Page:https://gvisor.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arm64: the kvm platform is broken

avagin opened this issue · comments

Description

kvm_test started failing when we switched to go 1.17.

Steps to reproduce

# bazel test pkg/sentry/platform/kvm:kvm_test --test_arg=-test.v --test_output=streamed  --nocache_test_results --test_timeout=30
INFO: Build option --test_timeout has changed, discarding analysis cache.
INFO: Analyzed target //pkg/sentry/platform/kvm:kvm_test (0 packages loaded, 12146 targets configured).
INFO: Found 1 test target...
=== RUN   TestKernelTLS
I0209 17:54:58.481207      22 physical_map.go:124] region: virtual [feea608000,ffff6a608000)
I0209 17:54:58.481364      22 physical_map.go:176] physicalRegion: virtual [1000,10000) => physical [1000,10000)
I0209 17:54:58.481374      22 physical_map.go:176] physicalRegion: virtual [10000,297000) => physical [10000,297000)
I0209 17:54:58.481381      22 physical_map.go:176] physicalRegion: virtual [297000,2a0000) => physical [297000,2a0000)
I0209 17:54:58.481388      22 physical_map.go:176] physicalRegion: virtual [2a0000,586000) => physical [2a0000,586000)
I0209 17:54:58.481394      22 physical_map.go:176] physicalRegion: virtual [586000,4000400000) => physical [586000,4000400000)
I0209 17:54:58.481405      22 physical_map.go:176] physicalRegion: virtual [4000400000,4004000000) => physical [4000400000,4004000000)
I0209 17:54:58.481411      22 physical_map.go:176] physicalRegion: virtual [4004000000,feea608000) => physical [4004000000,feea608000)
I0209 17:54:58.481417      22 physical_map.go:176] physicalRegion: virtual [ffff6a608000,ffff6cb59000) => physical [feea608000,feecb59000)
I0209 17:54:58.481424      22 physical_map.go:176] physicalRegion: virtual [ffff6cb59000,ffff6cbd9000) => physical [feecb59000,feecbd9000)
I0209 17:54:58.481430      22 physical_map.go:176] physicalRegion: virtual [ffff6cbd9000,ffff6cbda000) => physical [feecbd9000,feecbda000)
I0209 17:54:58.481436      22 physical_map.go:176] physicalRegion: virtual [ffff6cbda000,ffff8cb69000) => physical [feecbda000,ff0cb69000)
I0209 17:54:58.481442      22 physical_map.go:176] physicalRegion: virtual [ffff8cb69000,ffff8cb6a000) => physical [ff0cb69000,ff0cb6a000)
I0209 17:54:58.481448      22 physical_map.go:176] physicalRegion: virtual [ffff8cb6a000,ffff90b5b000) => physical [ff0cb6a000,ff10b5b000)
I0209 17:54:58.481454      22 physical_map.go:176] physicalRegion: virtual [ffff90b5b000,ffff90b5c000) => physical [ff10b5b000,ff10b5c000)
I0209 17:54:58.481461      22 physical_map.go:176] physicalRegion: virtual [ffff90b5c000,ffff91359000) => physical [ff10b5c000,ff11359000)
I0209 17:54:58.481467      22 physical_map.go:176] physicalRegion: virtual [ffff91359000,ffff9135a000) => physical [ff11359000,ff1135a000)
I0209 17:54:58.481473      22 physical_map.go:176] physicalRegion: virtual [ffff9135a000,ffff91459000) => physical [ff1135a000,ff11459000)
I0209 17:54:58.481479      22 physical_map.go:176] physicalRegion: virtual [ffff91459000,ffff914b9000) => physical [ff11459000,ff114b9000)
I0209 17:54:58.481485      22 physical_map.go:176] physicalRegion: virtual [ffff914b9000,ffff914bb000) => physical [ff114b9000,ff114bb000)
I0209 17:54:58.481491      22 physical_map.go:176] physicalRegion: virtual [ffff914bb000,ffff914bc000) => physical [ff114bb000,ff114bc000)
I0209 17:54:58.481497      22 physical_map.go:176] physicalRegion: virtual [ffff914bc000,fffffffff000) => physical [ff114bc000,ff7ffff000)
--- PASS: TestKernelTLS (0.04s)
=== RUN   TestKernelSyscall
-- Test timed out at 2022-02-09 17:55:28 UTC --

TIMEOUT: //pkg/sentry/platform/kvm:kvm_test (Summary)
      /root/.cache/bazel/_bazel_root/98e301f8e92f507b60c695e5bf470688/execroot/__main__/bazel-out/aarch64-fastbuild-ST-4c64f0b3d5c7/testlogs/pkg/sentry/platform/kvm/kvm_test/test.log
Target //pkg/sentry/platform/kvm:kvm_test up-to-date:
  bazel-out/aarch64-fastbuild-ST-4c64f0b3d5c7/bin/pkg/sentry/platform/kvm/kvm_test_/kvm_test
INFO: Elapsed time: 32.224s, Critical Path: 30.33s
INFO: 2 processes: 2 linux-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//pkg/sentry/platform/kvm:kvm_test                                      TIMEOUT in 30.0s
  /root/.cache/bazel/_bazel_root/98e301f8e92f507b60c695e5bf470688/execroot/__main__/bazel-out/aarch64-fastbuild-ST-4c64f0b3d5c7/testlogs/pkg/sentry/platform/kvm/kvm_test/test.log

INFO: Build completed, 1 test FAILED, 2 total actions

runsc version

# git describe HEAD
release-20220208.0-2-ga15231dab

I have run git bisect in the go repo and it points on https://go-review.googlesource.com/c/go/+/270537.

I saw you have submitted a PR for the issue. I will check it.

It isn't submitted yet. You can review it here: #7164.

It isn't submitted yet. You can review it here: #7164.

Ok, I am still learning about this issue and your PR. Have you done tests (syscall tests, integration tests) on Arm64 with your PR?

@zhlhahaha pkg/sentry/platform/kvm:kvm_test passes with this fix, but I didn't run syscall tests.

@zhlhahaha pkg/sentry/platform/kvm:kvm_test passes with this fix, but I didn't run syscall tests.

Ok, no problem, I will do the tests and inform you.

I have verified the tests, all tests have passed, but I am still confused about why this PR https://go-review.googlesource.com/c/go/+/270537 leads to error. Is it caused by (*mheap).sysAlloc which does not set memory from Reserved to Prepared any more after this PR?

Yes, it is. Reserved is PROT_NONE and Prepared is RW.

Got it. Let me check it.