runtime: consistency check for G rescan position
runtime: consistency check for G rescan position

Issue #17099 shows a failure that indicates we rescanned a stack twice
concurrently during mark termination, which suggests that the rescan
list became inconsistent. Add a simple check when we dequeue something
from the rescan list that it claims to be at the index where we found
it.

Change-Id: I6a267da4154a2e7b7d430cb4056e6bae978eaf62
Reviewed-on: https://go-review.googlesource.com/29280
Run-TryBot: Austin Clements <7ea35d812706d9213868749011af1ed4fa2f6aa0@google.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Rick Hudson <838bd060584c511f21c75c69ea04b7b120d86af0@golang.org>

akutz/go,ImJasonH/go,akutz/go,nawawi/go,derekmarcotte/go,momchil-velikov/go,nawawi/go,josharian/go,CAFxX/go,golang/go,akutz/go,goodlang/good,suncycheng/go,vsekhar/elastic-go,cloudflare/go,josharian/go,codestation/go,polyverse-security/go,Cofyc/go,nawawi/go,golang/go,polyverse-security/go,linux-on-ibm-z/go,CAFxX/go,josharian/go,Cofyc/go,CAFxX/go,cloudflare/go,CAFxX/go,ImJasonH/go,ImJasonH/go,goodlang/good,momchil-velikov/go,suncycheng/go,nawawi/go,derekmarcotte/go,codestation/go,Cofyc/go,polyverse-security/go,goodlang/good,akutz/go,vsekhar/elastic-go,vsekhar/elastic-go,derekmarcotte/go,goodlang/good,codestation/go,cloudflare/go,goodlang/good,josharian/go,momchil-velikov/go,linux-on-ibm-z/go,derekmarcotte/go,josharian/go,codestation/go,derekmarcotte/go,linux-on-ibm-z/go,suncycheng/go,polyverse-security/go,ImJasonH/go,CAFxX/go,suncycheng/go,christopher-henderson/Go,goodlang/good,vsekhar/elastic-go,golang/go,momchil-velikov/go,golang/go,nawawi/go,linux-on-ibm-z/go,josharian/go,suncycheng/go,codestation/go,golang/go,polyverse-security/go,nawawi/go,suncycheng/go,ImJasonH/go,polyverse-security/go,ImJasonH/go,nawawi/go,akutz/go,josharian/go,Cofyc/go,ImJasonH/go,akutz/go,linux-on-ibm-z/go,codestation/go,codestation/go,codestation/go,cloudflare/go,ImJasonH/go,polyverse-security/go,Cofyc/go,CAFxX/go,cloudflare/go,momchil-velikov/go,vsekhar/elastic-go,vsekhar/elastic-go,derekmarcotte/go,goodlang/good,linux-on-ibm-z/go,Cofyc/go,derekmarcotte/go,CAFxX/go,momchil-velikov/go,vsekhar/elastic-go,golang/go,akutz/go,cloudflare/go,golang/go,derekmarcotte/go,nawawi/go,golang/go,cloudflare/go,momchil-velikov/go,momchil-velikov/go,polyverse-security/go,vsekhar/elastic-go,suncycheng/go,josharian/go,cloudflare/go,suncycheng/go,linux-on-ibm-z/go,Cofyc/go,Cofyc/go,goodlang/good,CAFxX/go,akutz/go,linux-on-ibm-z/go