]> Cypherpunks repositories - gostls13.git/commit
runtime: fix min/max logic in findScavengeCandidate
authorMichael Anthony Knyszek <mknyszek@google.com>
Sat, 9 Nov 2019 00:21:02 +0000 (00:21 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 11 Nov 2019 16:02:42 +0000 (16:02 +0000)
commitf511467532f7b0009b6eff7752f2250e7f63ab12
treec7c679afef68e0a2c984544414ee85553bd13bf5
parent696c41488a2e3c0f86b01e420701c9aa05951228
runtime: fix min/max logic in findScavengeCandidate

Before this CL, if max > min and max was unaligned to min, then the
function could return an unaligned (unaligned to min) region to
scavenge. On most platforms, this leads to some kind of crash.

Fix this by explicitly aligning max to the next multiple of min.

Fixes #35445.
Updates #35112.

Change-Id: I0af42d4a307b48a97e47ed152c619d77b0298291
Reviewed-on: https://go-review.googlesource.com/c/go/+/206277
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/mgcscavenge.go
src/runtime/mgcscavenge_test.go