[go] runtime: fix memclrNoHeapPointersPreemptible

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Mar 17, 2026, 4:50:03 PM (23 hours ago) Mar 17
to Keith Randall, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Keith Randall, Go LUCI, Michael Pratt, David Chase, Muhammad Hamza, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
runtime: fix memclrNoHeapPointersPreemptible

memclrNoHeapPointersChunked was originally written for
clearing fresh allocations. It converts to uintptr early and thus
doesn't handle the case where the pointer points to the stack.
At the preemption point, the buffer being pointed to might be
on the stack and copied to a new location. Then we'd end up
zeroing random heap memory when we return from preemption.

Fix it to keep the pointer to the allocation in an unsafe.Pointer,
so it gets updated correctly on a stack copy.

Update #78081
(Fixes?)
Change-Id: Id25c7faf45f201929cb8c8bbcc7c8bd4f67c31ac
Auto-Submit: Keith Randall <k...@golang.org>
Reviewed-by: Michael Pratt <mpr...@google.com>
Reviewed-by: Keith Randall <k...@google.com>
Files:
  • M src/runtime/malloc.go
Change size: S
Delta: 1 file changed, 14 insertions(+), 9 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Keith Randall, +2 by Michael Pratt
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Id25c7faf45f201929cb8c8bbcc7c8bd4f67c31ac
Gerrit-Change-Number: 756122
Gerrit-PatchSet: 6
Gerrit-Owner: Keith Randall <k...@golang.org>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Muhammad Hamza <hamz...@live.co.uk>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages