]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix wbshadow mode
authorDmitry Vyukov <dvyukov@google.com>
Mon, 26 Jan 2015 14:28:54 +0000 (17:28 +0300)
committerDmitry Vyukov <dvyukov@google.com>
Tue, 27 Jan 2015 17:50:55 +0000 (17:50 +0000)
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 <rsc@golang.org>
src/runtime/mbarrier.go

index 6c1ebd5c64016d22d9dbfe006951f8a2e001a8de..c9ed035dabd9f3aa5f451003957f132c6e21f662 100644 (file)
@@ -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