]> Cypherpunks repositories - gostls13.git/commit
runtime: intercept munmap as we do mmap
authorIan Lance Taylor <iant@golang.org>
Tue, 6 Jun 2017 22:08:59 +0000 (15:08 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 6 Jun 2017 23:26:55 +0000 (23:26 +0000)
commitf425f549573e5017861216d62ccb22ee37b68004
treea5dc94df90194f08092676258a4079650564b4f5
parent557f6a13beb9e2da58d439d228e7f8f838c61159
runtime: intercept munmap as we do mmap

For cgo programs on linux-amd64 we call the C function mmap.
This supports programs such as the C memory sanitizer that need to
intercept all calls to mmap. It turns out that there are programs that
intercept both mmap and munmap, or that at least expect that if they
intercept mmap, they also intercept munmap. So, if we permit mmap
to be intercepted, also permit munmap to be intercepted.

No test, as it requires two odd things: a C program that intercepts
mmap and munmap, and a Go program that calls munmap.

Change-Id: Iec33f47d59f70dbb7463fd12d30728c24cd4face
Reviewed-on: https://go-review.googlesource.com/45016
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/cgo/gcc_mmap.c
src/runtime/cgo/mmap.go
src/runtime/cgo_mmap.go
src/runtime/mmap.go
src/runtime/stubs2.go
src/runtime/sys_linux_amd64.s