From a6e6b11e3a443ef532bc9b710e893e111f8ea2a3 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Tue, 23 Aug 2022 10:40:31 -0700 Subject: runtime: initialize pointer bits of noscan spans Some code paths in the runtime (cgo, heapdump) request heap bits without first checking that the span is !noscan. Instead of trying to find and work around all those cases, just set the pointer bits of noscan spans correctly. It's somewhat safer than ensuring we caught all the possible cases. Fixes #54557 Fixes #54558 Change-Id: Ibd476e6cdea77c962e4d15aad26f29df66fd94e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/425194 Reviewed-by: Michael Knyszek Run-TryBot: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Keith Randall --- src/runtime/mgcmark.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/runtime/mgcmark.go') diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index d4d7c93ba9..c2602c0aa1 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -1273,6 +1273,8 @@ func scanobject(b uintptr, gcw *gcWork) { throw("scanobject n == 0") } if s.spanclass.noscan() { + // Correctness-wise this is ok, but it's inefficient + // if noscan objects reach here. throw("scanobject of a noscan object") } -- cgit v1.3-5-g9baa