From 35c7234601c409a1d1595e4eb9fe72e8ba4e6464 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 15 Sep 2021 17:14:21 -0400 Subject: runtime: add always-preempt maymorestack hook This adds a maymorestack hook that forces a preemption at every possible cooperative preemption point. This would have helped us catch several recent preemption-related bugs earlier, including #47302, #47304, and #47441. For #48297. Change-Id: Ib82c973589c8a7223900e1842913b8591938fb9f Reviewed-on: https://go-review.googlesource.com/c/go/+/359796 Trust: Austin Clements Run-TryBot: Austin Clements TryBot-Result: Go Bot Reviewed-by: Cherry Mui Reviewed-by: Michael Pratt Reviewed-by: David Chase --- src/runtime/stack.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/runtime/stack.go') diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 52d21e4ee4..7d9ae1e9d2 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -144,6 +144,9 @@ const ( // Force a stack movement. Used for debugging. // 0xfffffeed in hex. stackForceMove = uintptrMask & -275 + + // stackPoisonMin is the lowest allowed stack poison value. + stackPoisonMin = uintptrMask & -4096 ) // Global pool of spans that have free stacks. -- cgit v1.3