Commit d9419218 authored by Dmitry Vyukov's avatar Dmitry Vyukov

runtime: fix wbshadow mode

Half of tests currently crash with GODEBUG=wbshadow.
_PageSize is set to 8192. So data can be extended outside
of actually mapped region during rounding. Which leads to crash
during initial copying to shadow.
Use _PhysPageSize instead.

Change-Id: Iaa89992bd57f86dafa16b092b53fdc0606213acb
Reviewed-on: https://go-review.googlesource.com/3286Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 85e7bee1
...@@ -105,7 +105,7 @@ func writebarrierptr(dst *uintptr, src uintptr) { ...@@ -105,7 +105,7 @@ func writebarrierptr(dst *uintptr, src uintptr) {
return return
} }
if src != 0 && (src < _PageSize || src == poisonStack) { if src != 0 && (src < _PhysPageSize || src == poisonStack) {
systemstack(func() { throw("bad pointer in write barrier") }) systemstack(func() { throw("bad pointer in write barrier") })
} }
...@@ -140,7 +140,7 @@ func writebarrierptr_nostore(dst *uintptr, src uintptr) { ...@@ -140,7 +140,7 @@ func writebarrierptr_nostore(dst *uintptr, src uintptr) {
return return
} }
if src != 0 && (src < _PageSize || src == poisonStack) { if src != 0 && (src < _PhysPageSize || src == poisonStack) {
systemstack(func() { throw("bad pointer in write barrier") }) systemstack(func() { throw("bad pointer in write barrier") })
} }
...@@ -422,8 +422,8 @@ func wbshadowinit() { ...@@ -422,8 +422,8 @@ func wbshadowinit() {
if end < uintptr(unsafe.Pointer(&ebss)) { if end < uintptr(unsafe.Pointer(&ebss)) {
end = uintptr(unsafe.Pointer(&ebss)) end = uintptr(unsafe.Pointer(&ebss))
} }
start &^= _PageSize - 1 start &^= _PhysPageSize - 1
end = round(end, _PageSize) end = round(end, _PhysPageSize)
mheap_.data_start = start mheap_.data_start = start
mheap_.data_end = end mheap_.data_end = end
reserved = false reserved = false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment