-
Notifications
You must be signed in to change notification settings - Fork 19k
cmd/compile: //go:norace for ASAN and other instrumentation #64310
Copy link
Copy link
Closed
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
What version of Go are you using (
go version)?tip
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?Linux with GOARCH='amd64' and GOARCH='arm64'
What did you do?
Our Go toolchain contains a patch that allows handling Go runtime crashes for reporting. Code that needs to run as part of that patch is very restricted. The biggest restriction is that it doesn't allow memory allocation. It's possible to write Go code that doesn't allocate memory, but it's near impossible when the code is instrumented. For example, to make the crash handling work with the race detector, all functions have to be annotated with
//go:norace.We're now running into this problem again when enabling ASAN using
-asan. The problem is that when ASAN is enabled, the existing code starts to allocate memory where it doesn't without the instrumentation. My best guess is that the ASAN instrumentation leads to different escape analysis results. (I suspected inlining decisions as well, but I don't see any additional allocations when I disable inlining completely).It would help a lot to be able to either disable ASAN instrumentation for crash handling functions with
//go:noasanor, even better, to disable all instrumentation with, say,//go:noinstrumentation./cc @cherrymui, @dr2chase