From: Dmitry Vyukov Date: Mon, 26 Jan 2015 14:28:54 +0000 (+0300) Subject: runtime: fix wbshadow mode X-Git-Tag: go1.5beta1~2260 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d94192180fada39666081efd66e39e1ac1e81e60;p=gostls13.git 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/3286 Reviewed-by: Russ Cox --- diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go index 6c1ebd5c64..c9ed035dab 100644 --- a/src/runtime/mbarrier.go +++ b/src/runtime/mbarrier.go @@ -105,7 +105,7 @@ func writebarrierptr(dst *uintptr, src uintptr) { return } - if src != 0 && (src < _PageSize || src == poisonStack) { + if src != 0 && (src < _PhysPageSize || src == poisonStack) { systemstack(func() { throw("bad pointer in write barrier") }) } @@ -140,7 +140,7 @@ func writebarrierptr_nostore(dst *uintptr, src uintptr) { return } - if src != 0 && (src < _PageSize || src == poisonStack) { + if src != 0 && (src < _PhysPageSize || src == poisonStack) { systemstack(func() { throw("bad pointer in write barrier") }) } @@ -422,8 +422,8 @@ func wbshadowinit() { if end < uintptr(unsafe.Pointer(&ebss)) { end = uintptr(unsafe.Pointer(&ebss)) } - start &^= _PageSize - 1 - end = round(end, _PageSize) + start &^= _PhysPageSize - 1 + end = round(end, _PhysPageSize) mheap_.data_start = start mheap_.data_end = end reserved = false