Skip to content

Commit

Permalink
Merge release-20201216.0-86-ga20da7082 (automated)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvisor-bot committed Jan 12, 2021
2 parents 3f46e58 + a20da70 commit 1ea6658
Show file tree
Hide file tree
Showing 17 changed files with 2,215 additions and 65 deletions.
13 changes: 7 additions & 6 deletions pkg/sentry/loader/vdso.go
Expand Up @@ -26,6 +26,7 @@ import (
"gvisor.dev/gvisor/pkg/log"
"gvisor.dev/gvisor/pkg/safemem"
"gvisor.dev/gvisor/pkg/sentry/arch"
"gvisor.dev/gvisor/pkg/sentry/loader/vdsodata"
"gvisor.dev/gvisor/pkg/sentry/memmap"
"gvisor.dev/gvisor/pkg/sentry/mm"
"gvisor.dev/gvisor/pkg/sentry/pgalloc"
Expand Down Expand Up @@ -177,7 +178,7 @@ type VDSO struct {

// getSymbolValueFromVDSO returns the specific symbol value in vdso.so.
func getSymbolValueFromVDSO(symbol string) (uint64, error) {
f, err := elf.NewFile(bytes.NewReader(vdsoBin))
f, err := elf.NewFile(bytes.NewReader(vdsodata.Binary))
if err != nil {
return 0, err
}
Expand All @@ -199,19 +200,19 @@ func getSymbolValueFromVDSO(symbol string) (uint64, error) {
// PrepareVDSO validates the system VDSO and returns a VDSO, containing the
// param page for updating by the kernel.
func PrepareVDSO(mfp pgalloc.MemoryFileProvider) (*VDSO, error) {
vdsoFile := &byteFullReader{data: vdsoBin}
vdsoFile := &byteFullReader{data: vdsodata.Binary}

// First make sure the VDSO is valid. vdsoFile does not use ctx, so a
// nil context can be passed.
info, err := validateVDSO(nil, vdsoFile, uint64(len(vdsoBin)))
info, err := validateVDSO(nil, vdsoFile, uint64(len(vdsodata.Binary)))
if err != nil {
return nil, err
}

// Then copy it into a VDSO mapping.
size, ok := usermem.Addr(len(vdsoBin)).RoundUp()
size, ok := usermem.Addr(len(vdsodata.Binary)).RoundUp()
if !ok {
return nil, fmt.Errorf("VDSO size overflows? %#x", len(vdsoBin))
return nil, fmt.Errorf("VDSO size overflows? %#x", len(vdsodata.Binary))
}

mf := mfp.MemoryFile()
Expand All @@ -226,7 +227,7 @@ func PrepareVDSO(mfp pgalloc.MemoryFileProvider) (*VDSO, error) {
return nil, fmt.Errorf("unable to map VDSO memory: %v", err)
}

_, err = safemem.CopySeq(ims, safemem.BlockSeqOf(safemem.BlockFromSafeSlice(vdsoBin)))
_, err = safemem.CopySeq(ims, safemem.BlockSeqOf(safemem.BlockFromSafeSlice(vdsodata.Binary)))
if err != nil {
mf.DecRef(vdso)
return nil, fmt.Errorf("unable to copy VDSO into memory: %v", err)
Expand Down
7 changes: 7 additions & 0 deletions pkg/sentry/loader/vdsodata/vdso_amd64.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions pkg/sentry/loader/vdsodata/vdso_arm64.go

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions pkg/sentry/loader/vdsodata/vdsodata.go
@@ -0,0 +1,16 @@
// Copyright 2020 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package vdsodata contains a compiled VDSO object.
package vdsodata
4 changes: 4 additions & 0 deletions pkg/sentry/platform/ring0/defs_impl_amd64.go
@@ -1,3 +1,7 @@
// +build amd64
// +build amd64
// +build 386 amd64

package ring0

import (
Expand Down
4 changes: 4 additions & 0 deletions pkg/sentry/platform/ring0/defs_impl_arm64.go
@@ -1,3 +1,7 @@
// +build arm64
// +build arm64
// +build arm64

package ring0

import (
Expand Down
137 changes: 78 additions & 59 deletions pkg/sentry/platform/ring0/entry_impl_arm64.s
Expand Up @@ -3,71 +3,90 @@
// Automatically generated, do not edit.

// CPU offsets.
#define CPU_REGISTERS 0x28
#define CPU_ERROR_CODE 0x10
#define CPU_ERROR_TYPE 0x18
#define CPU_ENTRY 0x20

// CPU entry offsets.
#define ENTRY_SCRATCH0 0x100
#define ENTRY_STACK_TOP 0x108
#define ENTRY_CPU_SELF 0x110
#define ENTRY_KERNEL_CR3 0x118
#define CPU_SELF 0x00
#define CPU_REGISTERS 0x258
#define CPU_STACK_TOP 0x210
#define CPU_ERROR_CODE 0x210
#define CPU_ERROR_TYPE 0x218
#define CPU_FAULT_ADDR 0x220
#define CPU_TTBR0_KVM 0x228
#define CPU_TTBR0_APP 0x230
#define CPU_VECTOR_CODE 0x238
#define CPU_APP_ADDR 0x240
#define CPU_LAZY_VFP 0x248
#define CPU_APP_ASID 0x250

// Bits.
#define _RFLAGS_IF 0x200
#define _RFLAGS_IOPL0 0x1000
#define _KERNEL_FLAGS 0x02
#define _KERNEL_FLAGS 0x3c5

// Vectors.
#define DivideByZero 0x00
#define Debug 0x01
#define NMI 0x02
#define Breakpoint 0x03
#define Overflow 0x04
#define BoundRangeExceeded 0x05
#define InvalidOpcode 0x06
#define DeviceNotAvailable 0x07
#define DoubleFault 0x08
#define CoprocessorSegmentOverrun 0x09
#define InvalidTSS 0x0a
#define SegmentNotPresent 0x0b
#define StackSegmentFault 0x0c
#define GeneralProtectionFault 0x0d
#define PageFault 0x0e
#define X87FloatingPointException 0x10
#define AlignmentCheck 0x11
#define MachineCheck 0x12
#define SIMDFloatingPointException 0x13
#define VirtualizationException 0x14
#define SecurityException 0x1e
#define SyscallInt80 0x80
#define Syscall 0x100
#define El1Sync 0x04
#define El1Irq 0x05
#define El1Fiq 0x06
#define El1Err 0x07
#define El0Sync 0x08
#define El0Irq 0x09
#define El0Fiq 0x0a
#define El0Err 0x0b
#define El1SyncDa 0x10
#define El1SyncIa 0x11
#define El1SyncSpPc 0x12
#define El1SyncUndef 0x13
#define El1SyncDbg 0x14
#define El1SyncInv 0x15
#define El0SyncSVC 0x16
#define El0SyncDa 0x17
#define El0SyncIa 0x18
#define El0SyncFpsimdAcc 0x19
#define El0SyncSveAcc 0x1a
#define El0SyncFpsimdExc 0x1b
#define El0SyncSys 0x1c
#define El0SyncSpPc 0x1d
#define El0SyncUndef 0x1e
#define El0SyncDbg 0x1f
#define El0SyncWfx 0x20
#define El0SyncInv 0x21
#define El0ErrNMI 0x22
#define PageFault 0x17
#define Syscall 0x16
#define VirtualizationException 0x23

// Ptrace registers.
#define PTRACE_R15 0x00
#define PTRACE_R14 0x08
#define PTRACE_R13 0x10
#define PTRACE_R12 0x18
#define PTRACE_RBP 0x20
#define PTRACE_RBX 0x28
#define PTRACE_R11 0x30
#define PTRACE_R10 0x38
#define PTRACE_R9 0x40
#define PTRACE_R8 0x48
#define PTRACE_RAX 0x50
#define PTRACE_RCX 0x58
#define PTRACE_RDX 0x60
#define PTRACE_RSI 0x68
#define PTRACE_RDI 0x70
#define PTRACE_ORIGRAX 0x78
#define PTRACE_RIP 0x80
#define PTRACE_CS 0x88
#define PTRACE_FLAGS 0x90
#define PTRACE_RSP 0x98
#define PTRACE_SS 0xa0
#define PTRACE_FS 0xa8
#define PTRACE_GS 0xb0
#define PTRACE_R0 0x00
#define PTRACE_R1 0x08
#define PTRACE_R2 0x10
#define PTRACE_R3 0x18
#define PTRACE_R4 0x20
#define PTRACE_R5 0x28
#define PTRACE_R6 0x30
#define PTRACE_R7 0x38
#define PTRACE_R8 0x40
#define PTRACE_R9 0x48
#define PTRACE_R10 0x50
#define PTRACE_R11 0x58
#define PTRACE_R12 0x60
#define PTRACE_R13 0x68
#define PTRACE_R14 0x70
#define PTRACE_R15 0x78
#define PTRACE_R16 0x80
#define PTRACE_R17 0x88
#define PTRACE_R18 0x90
#define PTRACE_R19 0x98
#define PTRACE_R20 0xa0
#define PTRACE_R21 0xa8
#define PTRACE_R22 0xb0
#define PTRACE_R23 0xb8
#define PTRACE_R24 0xc0
#define PTRACE_R25 0xc8
#define PTRACE_R26 0xd0
#define PTRACE_R27 0xd8
#define PTRACE_R28 0xe0
#define PTRACE_R29 0xe8
#define PTRACE_R30 0xf0
#define PTRACE_SP 0xf8
#define PTRACE_PC 0x100
#define PTRACE_PSTATE 0x108
#define PTRACE_TLS 0x110
// Copyright 2019 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down

0 comments on commit 1ea6658

Please sign in to comment.