mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
arm64: the mair_el1 value is wrong
the correct value needed is 0xbbff440c0400 but the const defined is 0x000000000000ffc0 due to the operator error in _MT_EL1_INIT, both kernel and user space memory attribute should be Normal memory not DEVICE_nGnRE Signed-off-by: Min Le <lemin.lm@antgroup.com>
This commit is contained in:
@@ -101,13 +101,20 @@ const (
|
||||
|
||||
// Arm64: Memory Attribute Indirection Register EL1.
|
||||
const (
|
||||
_MT_DEVICE_nGnRnE = 0
|
||||
_MT_DEVICE_nGnRE = 1
|
||||
_MT_DEVICE_GRE = 2
|
||||
_MT_NORMAL_NC = 3
|
||||
_MT_NORMAL = 4
|
||||
_MT_NORMAL_WT = 5
|
||||
_MT_EL1_INIT = (0 << _MT_DEVICE_nGnRnE) | (0x4 << _MT_DEVICE_nGnRE * 8) | (0xc << _MT_DEVICE_GRE * 8) | (0x44 << _MT_NORMAL_NC * 8) | (0xff << _MT_NORMAL * 8) | (0xbb << _MT_NORMAL_WT * 8)
|
||||
_MT_DEVICE_nGnRnE = 0
|
||||
_MT_DEVICE_nGnRE = 1
|
||||
_MT_DEVICE_GRE = 2
|
||||
_MT_NORMAL_NC = 3
|
||||
_MT_NORMAL = 4
|
||||
_MT_NORMAL_WT = 5
|
||||
_MT_ATTR_DEVICE_nGnRnE = 0x00
|
||||
_MT_ATTR_DEVICE_nGnRE = 0x04
|
||||
_MT_ATTR_DEVICE_GRE = 0x0c
|
||||
_MT_ATTR_NORMAL_NC = 0x44
|
||||
_MT_ATTR_NORMAL_WT = 0xbb
|
||||
_MT_ATTR_NORMAL = 0xff
|
||||
_MT_ATTR_MASK = 0xff
|
||||
_MT_EL1_INIT = (_MT_ATTR_DEVICE_nGnRnE << (_MT_DEVICE_nGnRnE * 8)) | (_MT_ATTR_DEVICE_nGnRE << (_MT_DEVICE_nGnRE * 8)) | (_MT_ATTR_DEVICE_GRE << (_MT_DEVICE_GRE * 8)) | (_MT_ATTR_NORMAL_NC << (_MT_NORMAL_NC * 8)) | (_MT_ATTR_NORMAL << (_MT_NORMAL * 8)) | (_MT_ATTR_NORMAL_WT << (_MT_NORMAL_WT * 8))
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -78,7 +78,7 @@ const (
|
||||
|
||||
const (
|
||||
executeDisable = xn
|
||||
optionMask = 0xfff | 0xfff<<48
|
||||
optionMask = 0xfff | 0xffff<<48
|
||||
protDefault = accessed | shared
|
||||
)
|
||||
|
||||
@@ -188,7 +188,7 @@ func (p *PTE) Set(addr uintptr, opts MapOpts) {
|
||||
v |= mtNormal
|
||||
} else {
|
||||
v = v &^ user
|
||||
v |= mtDevicenGnRE // Strong order for the addresses with ring0.KernelStartAddress.
|
||||
v |= mtNormal
|
||||
}
|
||||
atomic.StoreUintptr((*uintptr)(p), v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user