From: Austin Clements Date: Wed, 26 Oct 2016 18:34:20 +0000 (-0400) Subject: runtime: zero-initialize LR on new stacks X-Git-Tag: go1.8beta1~499 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=88518e7dd6a118167aa71851a3a9f24d0230bc82;p=gostls13.git runtime: zero-initialize LR on new stacks Currently we initialize LR on a new stack by writing nil to it. But this is an initializing write since the newly allocated stack is not zeroed, so this is unsafe with the hybrid barrier. Change this is a uintptr write to avoid a bad write barrier. Updates #17503. Change-Id: I062ac352e35df7da4644c1f2a5aaab87049d1f60 Reviewed-on: https://go-review.googlesource.com/32093 Reviewed-by: Rick Hudson --- diff --git a/src/runtime/proc.go b/src/runtime/proc.go index af111014f1..774801ab15 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2806,7 +2806,7 @@ func newproc1(fn *funcval, argp *uint8, narg int32, nret int32, callerpc uintptr spArg := sp if usesLR { // caller's LR - *(*unsafe.Pointer)(unsafe.Pointer(sp)) = nil + *(*uintptr)(unsafe.Pointer(sp)) = 0 prepGoExitFrame(sp) spArg += sys.MinFrameSize }