]> Cypherpunks repositories - gostls13.git/commit
runtime: use 4K as the boundary of legal pointers
authorAustin Clements <austin@google.com>
Fri, 6 Jan 2017 14:44:41 +0000 (09:44 -0500)
committerAustin Clements <austin@google.com>
Fri, 6 Jan 2017 16:19:14 +0000 (16:19 +0000)
commit7aefdfded022f9775eb463156eda3a25a658a0ae
treef611616bcb138fe4351092ef932febabcc6df3f5
parent867dcb5570919e3b0c7dc35662e604c7136cc68d
runtime: use 4K as the boundary of legal pointers

Currently, the check for legal pointers in stack copying uses
_PageSize (8K) as the minimum legal pointer. By default, Linux won't
let you map under 64K, but

1) it's less clear what other OSes allow or will allow in the future;

2) while mapping the first page is a terrible idea, mapping anywhere
above that is arguably more justifiable;

3) the compiler only assumes the first physical page (4K) is never
mapped.

Make the runtime consistent with the compiler and more robust by
changing the bad pointer check to use 4K as the minimum legal pointer.

This came out of discussions on CLs 34663 and 34719.

Change-Id: Idf721a788bd9699fb348f47bdd083cf8fa8bd3e5
Reviewed-on: https://go-review.googlesource.com/34890
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/ssa/nilcheck.go
src/runtime/malloc.go
src/runtime/stack.go