runtime: fix stackFromSystem returning memory
The stackFromSystem debug mode has two problems: 1) It rounds the stack allocation to _PageSize. If the physical page size is >8K, this can cause unmapping the memory later to either under-unmap or over-unmap. 2) It doesn't return the rounded-up allocation size to its caller, so when we later unmap the memory, we may pass the wrong length. Fix these problems by rounding the size up to the physical page size and putting that rounded-up size in the returned stack bounds. Fixes #17289. Change-Id: I6b854af3b06bb16e3750798397bb5e2a722ec1cb Reviewed-on: https://go-review.googlesource.com/43636Reviewed-by: Keith Randall <khr@golang.org>
Showing
Please register or sign in to comment