From d94192180fada39666081efd66e39e1ac1e81e60 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 26 Jan 2015 17:28:54 +0300 Subject: [PATCH] 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 --- src/runtime/mbarrier.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.48.1