]> Cypherpunks repositories - gostls13.git/commitdiff
bytes: don't leave mprotect-ed pages after unsafe test.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Wed, 3 Apr 2013 15:30:20 +0000 (08:30 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 3 Apr 2013 15:30:20 +0000 (08:30 -0700)
Fixes inscrutable GC faults during testing.

R=golang-dev, bradfitz, dave, fullung
CC=golang-dev
https://golang.org/cl/8300044

src/pkg/bytes/equal_test.go

index a393d5e7dec84a2b7fbb6748f1fdf71d40443100..1bf19a74b80193c8be4d7952b18981ec0228e153 100644 (file)
@@ -30,6 +30,8 @@ func TestEqualNearPageBoundary(t *testing.T) {
        }
        syscall.Mprotect(b[i-pagesize:i], 0)
        syscall.Mprotect(b[i+pagesize:i+2*pagesize], 0)
+       defer syscall.Mprotect(b[i-pagesize:i], syscall.PROT_READ|syscall.PROT_WRITE)
+       defer syscall.Mprotect(b[i+pagesize:i+2*pagesize], syscall.PROT_READ|syscall.PROT_WRITE)
 
        // both of these should fault
        //pagesize += int(b[i-1])