mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
arm64 kvm: fix panic in kvm.dropPageTables
Related with issue #3019, #4056. When running hello-world with gvisor-kvm, there is panic when exits: " panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x3c0 pc=0x7c3f18] goroutine 284 [running]: ... ... gvisor.dev/gvisor/pkg/sentry/platform/kvm.(*machine).dropPageTables(0x4000166840, 0x400032a040) pkg/sentry/platform/kvm/machine_arm64.go:111 +0x88 fp=0x4000479e00 sp=0x4000479da0 pc=0x7c3f18 " Also make dropPageTables() arch independent.
This commit is contained in:
@@ -469,6 +469,19 @@ func (m *machine) newDirtySet() *dirtySet {
|
||||
}
|
||||
}
|
||||
|
||||
// dropPageTables drops cached page table entries.
|
||||
func (m *machine) dropPageTables(pt *pagetables.PageTables) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
// Clear from all PCIDs.
|
||||
for _, c := range m.vCPUsByID {
|
||||
if c != nil && c.PCIDs != nil {
|
||||
c.PCIDs.Drop(pt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lock marks the vCPU as in user mode.
|
||||
//
|
||||
// This should only be called directly when known to be safe, i.e. when
|
||||
|
||||
@@ -84,19 +84,6 @@ const (
|
||||
poolPCIDs = 8
|
||||
)
|
||||
|
||||
// dropPageTables drops cached page table entries.
|
||||
func (m *machine) dropPageTables(pt *pagetables.PageTables) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
// Clear from all PCIDs.
|
||||
for _, c := range m.vCPUsByID {
|
||||
if c != nil && c.PCIDs != nil {
|
||||
c.PCIDs.Drop(pt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// initArchState initializes architecture-specific state.
|
||||
func (c *vCPU) initArchState() error {
|
||||
var (
|
||||
|
||||
@@ -100,19 +100,6 @@ func availableRegionsForSetMem() (phyRegions []physicalRegion) {
|
||||
return phyRegions
|
||||
}
|
||||
|
||||
// dropPageTables drops cached page table entries.
|
||||
func (m *machine) dropPageTables(pt *pagetables.PageTables) {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
// Clear from all PCIDs.
|
||||
for _, c := range m.vCPUsByID {
|
||||
if c.PCIDs != nil {
|
||||
c.PCIDs.Drop(pt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// nonCanonical generates a canonical address return.
|
||||
//
|
||||
//go:nosplit
|
||||
|
||||
Reference in New Issue
Block a user