From d2c81ad84776edfb4c790666f1d80554b4393d46 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 17 Nov 2015 17:31:04 -0500 Subject: [PATCH] runtime: recursively disallow write barriers in sysmon sysmon runs without a P. This means it can't interact with the garbage collector, so write barriers not allowed in anything that sysmon does. Fixes #10600. Change-Id: I9de1283900dadee4f72e2ebfc8787123e382ae88 Reviewed-on: https://go-review.googlesource.com/17006 Run-TryBot: Austin Clements Reviewed-by: Dmitry Vyukov TryBot-Result: Gobot Gobot --- src/runtime/proc.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index f89669f2a16..f641d38a943 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3321,6 +3321,9 @@ func checkdead() { // This is a variable for testing purposes. It normally doesn't change. var forcegcperiod int64 = 2 * 60 * 1e9 +// Always runs without a P, so write barriers are not allowed. +// +//go:nowritebarrierrec func sysmon() { // If a heap span goes unused for 5 minutes after a garbage collection, // we hand it back to the operating system.