Commit Graph

113 Commits

Author SHA1 Message Date
gVisor bot a4b1c6f5a4 Merge pull request #3742 from lubinszARM:pr_n1_1
PiperOrigin-RevId: 328639254
2020-08-26 17:10:16 -07:00
Adin Scannell 983a55aa06 Support stdlib analyzers with nogo.
This immediately revealed an escape analysis violation (!), where
the sync.Map was being used in a context that escapes were not
allowed. This is a relatively minor fix and is included.

PiperOrigin-RevId: 328611237
2020-08-26 14:42:35 -07:00
Bin Lu 57bfbed1d6 Device major number greater than 2 digits in /proc/self/maps on arm64 N1 machine
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-08-24 22:41:01 -04:00
Michael Pratt ab6c474210 Bump build constraints to 1.17
This enables pre-release testing with 1.16. The intention is to replace these
with a nogo check before the next release.

PiperOrigin-RevId: 328193911
2020-08-24 12:58:39 -07:00
Bin Lu 05d742ede4 Running hello-world on Thunderx2 with kvm
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-08-12 05:37:27 -04:00
Andrei Vagin 13a8ae81b2 Add context.FullStateChanged()
It indicates that the Sentry has changed the state of the thread and
next calls of PullFullState() has to do nothing.

PiperOrigin-RevId: 325567415
2020-08-07 22:49:55 -07:00
gVisor bot 8f6d576afe Merge pull request #3069 from lubinszARM:pr_serr_injection2
PiperOrigin-RevId: 325546308
2020-08-07 18:32:25 -07:00
Andrei Vagin 25798f214c Add callbacks to support lazy loading/restoring thread states
PiperOrigin-RevId: 324748508
2020-08-03 22:08:25 -07:00
gVisor bot 6a4bcbdb28 Merge pull request #3448 from lubinszARM:pr_tls_tests
PiperOrigin-RevId: 324127810
2020-07-30 18:44:17 -07:00
gVisor bot c9515dcca3 Merge pull request #3028 from lubinszARM:pr_kvm_hello1
PiperOrigin-RevId: 324125938
2020-07-30 18:29:32 -07:00
Bin Lu bb25c9611b add usr-tls test cases for Arm64
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-30 03:44:23 -04:00
Bin Lu cd1149eef3 supporting sError injection step 2 on Arm64
I disabled DAIF(DEBUG, sError, IRQ, FIQ) in guest kernel mode,
and enabled them in guest user mode.
So, I can make sure all DAIF-s come from guest user mode,
and then the case 'TestBounceStress' can passed on Arm64.

Test steps:
 1, cd pkg/sentry/platform/kvm
 2, bazel test kvm_test --strip=never --test_output=streamed

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-30 03:24:35 -04:00
gVisor bot 1b2006083c Merge pull request #3299 from lubinszARM:pr_asid
PiperOrigin-RevId: 323455097
2020-07-27 15:44:30 -07:00
Andrei Vagin f347a578b7 Move platform.File in memmap
The subsequent systrap changes will need to import memmap from
the platform package.

PiperOrigin-RevId: 323409486
2020-07-27 11:59:10 -07:00
Bin Lu 14087485bd updated the functions to distinguish IA/DA for Arm64
We need to correctly distinguish instruction_abort/data_abort for
mem_abort@Arm64.
So, EC/WNR/FSC in esr_el1 should be checked.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-26 23:35:18 -04:00
Bin Lu 8c9156fed6 add asid support to Arm64
Support the operation of asid, so that I can optimize tlb performance
by combining with nG.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-20 01:09:00 -04:00
gVisor bot c5d827d110 Merge pull request #3200 from lubinszARM:pr_kvm_ut_1
PiperOrigin-RevId: 321060717
2020-07-13 16:49:20 -07:00
Bin Lu feb867bb83 Split the kvm ut test cases to correspond to different platforms
Split the kvm ut test cases to pass unit-tests on Arm64.
    I will add the tls and full-context test cases for Arm64 later.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-10 03:13:13 -04:00
Bin Lu 49f38dee10 allow guest user applications read ctr_el0 on Arm64
At present, when doing syscall_kvm test, we need to
enable the function of ESR_ELx_SYS64_ISS_SYS_CTR_READ to
successfully pass the test.

I set SCTLR_EL1.UCT==1, so that the related cases can passed.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-07-03 00:08:39 -04:00
Bin Lu 4232be8480 support sError injection in kvm module on Arm64
There are 3 types of asynchronous exceptions on Arm64: sError, IRQ, FIQ.
In this case, we use the sError injection method in bluepillHandler to force the guest to quit.
So that the test case of "TestBounce" can be passed on Arm64.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-06-16 22:50:14 -04:00
gVisor bot b436b9717e Merge pull request #2711 from lubinszARM:pr_mmio
PiperOrigin-RevId: 315812219
2020-06-10 18:51:41 -07:00
Bin Lu b792cc1ca9 minor change in kvm module for Arm64
Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-06-09 05:42:41 -04:00
Adin Scannell 527d08f6af Add +checkescape annotations to kvm/ring0.
This analysis also catches a potential bug, which is a split on mapPhysical.
This would have led to potential guest-exit during Mapping (although this
would have been handled by the now-unecessary retryInGuest loop).

PiperOrigin-RevId: 315025106
2020-06-05 17:25:28 -07:00
gVisor bot 288a1ca6f0 Merge pull request #2689 from lubinszARM:pr_prot_none
PiperOrigin-RevId: 314186752
2020-06-01 13:02:14 -07:00
Michael Pratt 65569cfca0 Update Go version build tags
None of the dependencies have changed in 1.15. It may be possible to simplify
some of the wrappers in rawfile following 1.13, but that can come in a later
change.

PiperOrigin-RevId: 313863264
2020-05-29 15:44:07 -07:00
Bin Lu a534b2c652 adding the VM-Exit method for Arm64
On amd64, it uses 'HLT' to leave the guest.
 Unlike amd64, arm64 can only uses mmio_exit/psci to leave the guest.

 So, I designed the HYPERCALL_VMEXIT to be compatible with amd64/arm64.

 To keep it simple, I used the address of exception table as the
 MMIO base address, so that I can trigger a MMIO-EXIT by forcibly writing this space.
 Then, in host user space, I can calculate this address to find out
 which hypercall.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-05-17 22:28:39 -04:00
Bin Lu 5fa480a877 PROT_NONE should be specially treated in the step of mapPhysical
It's a workaround to treat PROT_NONE as RDONLY temporarily.

TODO(gvisor.dev/issue/2686): PROT_NONE should be specially treated.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-05-13 04:40:28 -04:00
Rahat Mahmood 3c67754663 Enable automated marshalling for signals and the arch package.
PiperOrigin-RevId: 308472331
2020-04-25 23:56:04 -07:00
gVisor bot 10725475c3 Merge pull request #1707 from lubinszARM:pr_lazy_fpsimd_2
PiperOrigin-RevId: 308347744
2020-04-24 16:23:16 -07:00
Andrei Vagin 0c586946ea Specify a memory file in platform.New().
PiperOrigin-RevId: 307941984
2020-04-22 17:50:10 -07:00
Bin Lu ab54d4f496 remove nogo exemption for machine_arm64_unsafe.go
Minimize the use of unsafe.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-04-09 03:54:58 -04:00
Adin Scannell 4e6a1a5adb Automated rollback of changelist 303799678
PiperOrigin-RevId: 304221302
2020-04-01 11:06:26 -07:00
Adin Scannell 3fac85da95 kvm: handle exit reasons even under EINTR.
In the case of other signals (preemption), inject a normal bounce and
defer the signal until the vCPU has been returned from guest mode.

PiperOrigin-RevId: 303799678
2020-03-30 12:37:57 -07:00
Andrei Vagin 22d89ef5cb Import "unsafe" in bluepill_arm64_unsafe.go
This fixes a compile time error:
pkg/sentry/platform/kvm/bluepill_arm64_unsafe.go:45:35: undefined: unsafe

PiperOrigin-RevId: 300375687
2020-03-11 12:01:46 -07:00
Andrei Vagin bf87da89d3
Merge branch 'master' into pr_lazy_fpsimd_2 2020-03-06 21:12:32 -08:00
gVisor bot 18d41cf153 Merge pull request #1963 from xiaobo55x:kvm_common
PiperOrigin-RevId: 299405855
2020-03-06 12:05:30 -08:00
gVisor bot 56c4272568 Merge pull request #1946 from xiaobo55x:dieTramp
PiperOrigin-RevId: 299405663
2020-03-06 12:01:23 -08:00
gVisor bot 6ddeb35ed4 Merge pull request #1912 from lubinszARM:pr_kvm_build
PiperOrigin-RevId: 297492004
2020-02-26 19:09:45 -08:00
Haibo Xu 73201f4c57 Code Clean: Move arch independent codes to common file in kvm pkg.
Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: Iefbdf53e8e8d6d23ae75d8a2ff0d2a6e71f414d8
2020-02-26 01:51:31 +00:00
Adin Scannell 98b693e61b Don't acquire contended lock with the OS thread locked.
Fixes #1049

PiperOrigin-RevId: 297175164
2020-02-25 12:22:29 -08:00
Haibo Xu 93e0c37529 Enable bluepill dieTrampoline operation on arm64.
Signed-off-by: Haibo Xu <haibo.xu@arm.com>
Change-Id: I9e1bf2513c23bdd8c387e5b3c874c6ad3ca9aab0
2020-02-25 01:50:58 +00:00
Bin Lu de68e1d8c4 Code Clean:Move getUserRegisters into dieArchSetup() and other small changes.
Consistent with QEMU, getUserRegisters() should be an arch-specific
function. So, it should be called in dieArchSetup().

With this patch and the pagetable/pcid patch, the kvm modules on Arm64 can be
built successfully.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-02-20 06:43:27 +00:00
Bin Lu 89957c6c87 Lazy-fpsimd support patch series#2: add fpsimd@Arm64 support to kvm module
Add fpsimd support to KVM module so that the test case "TestKernelFloatingPoint"
can be passed on Arm64 platform.

Signed-off-by: Bin Lu <bin.lu@arm.com>
2020-01-29 04:46:05 -05:00
Adin Scannell 0e2f1b7abd Update package locations.
Because the abi will depend on the core types for marshalling (usermem,
context, safemem, safecopy), these need to be flattened from the sentry
directory. These packages contain no sentry-specific details.

PiperOrigin-RevId: 291811289
2020-01-27 15:31:32 -08:00
Adin Scannell d29e59af9f Standardize on tools directory.
PiperOrigin-RevId: 291745021
2020-01-27 12:21:00 -08:00
Michael Pratt 7a79715504 Check for EINTR from KVM_CREATE_VM
The kernel may return EINTR from:

kvm_create_vm
  kvm_init_mmu_notifier
    mmu_notifier_register
      do_mmu_notifier_register
        mm_take_all_locks

Go 1.14's preemptive scheduling signals make hitting this much more likely.

PiperOrigin-RevId: 291212669
2020-01-23 11:49:02 -08:00
gVisor bot 2ebd21478e Merge pull request #1540 from laijs:fix-PCIDs
PiperOrigin-RevId: 289925133
2020-01-15 13:48:51 -08:00
Ian Gudger 27500d529f New sync package.
* Rename syncutil to sync.
* Add aliases to sync types.
* Replace existing usage of standard library sync package.

This will make it easier to swap out synchronization primitives. For example,
this will allow us to use primitives from github.com/sasha-s/go-deadlock to
check for lock ordering violations.

Updates #1472

PiperOrigin-RevId: 289033387
2020-01-09 22:02:24 -08:00
Lai Jiangshan fdfa05ff2c Avoid panic when c.PCIDs is nil
When PCID is disabled, there would throw a panic
when dropPageTables() access to c.PCID without check.

Signed-off-by: Lai Jiangshan <eag0628@gmail.com>
2020-01-09 09:18:33 +00:00
gVisor bot 98e8246ad1 Merge pull request #890 from lubinszARM:pr_phyap
PiperOrigin-RevId: 286299056
2019-12-18 17:37:30 -08:00