Commit e4933091 authored by Austin Clements's avatar Austin Clements
Browse files

[release-branch.go1.5] runtime: avoid stat underflow crash

If the area returned by sysReserve in mheap.sysAlloc is outside the
usable arena, we sysFree it. We pass a fake stat pointer to sysFree
because we haven't added the allocation to any stat at that point.
However, we pass a 0 stat, so sysFree panics when it decrements the
stat because the fake stat underflows.

Fix this by setting the fake stat to the allocation size.

Updates #13143 (this is a prerequisite to fixing that bug).

Change-Id: I61a6c9be19ac1c95863cf6a8435e19790c8bfc9a
Reviewed-on: https://go-review.googlesource.com/16926


Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/16987


Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 20a05361
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment