]> Cypherpunks repositories - gostls13.git/commit
runtime: check summary before scavenging in fast path
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 13 Nov 2019 16:56:50 +0000 (16:56 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 15 Nov 2019 15:22:54 +0000 (15:22 +0000)
commitd183253572461eb0cfa46b847b4abd966deb39df
treeca03c10c493bee6a9136543f89e1412fbfbcd24f
parent4e8d27068df52eb372dc2ba7e929e47850934805
runtime: check summary before scavenging in fast path

In scavengeOne's fast path, we currently don't check the summary for the
chunk that scavAddr points to, which means that we might accidentally
scavenge unused address space if the previous scavenge moves the
scavAddr into that space. The result of this today is a crash.

This change makes it so that scavengeOne's fast path only happens after
the check, following the comment in mpagealloc.go. It also adds a test
for this case.

Fixes #35465.
Updates #35112.

Change-Id: I861d44ee75e42a0e1f5aaec243bc449228273903
Reviewed-on: https://go-review.googlesource.com/c/go/+/206978
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/runtime/mgcscavenge.go
src/runtime/mgcscavenge_test.go