{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/10600","labels_url":"https://api.github.com/repos/golang/go/issues/10600/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/10600/comments","events_url":"https://api.github.com/repos/golang/go/issues/10600/events","html_url":"https://github.com/golang/go/issues/10600","id":71724982,"number":10600,"title":"runtime: sysmon can invoke write barriers without a P","user":{"login":"aclements","id":2688315,"avatar_url":"https://avatars.githubusercontent.com/u/2688315?v=3","gravatar_id":"","url":"https://api.github.com/users/aclements","html_url":"https://github.com/aclements","followers_url":"https://api.github.com/users/aclements/followers","following_url":"https://api.github.com/users/aclements/following{/other_user}","gists_url":"https://api.github.com/users/aclements/gists{/gist_id}","starred_url":"https://api.github.com/users/aclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclements/subscriptions","organizations_url":"https://api.github.com/users/aclements/orgs","repos_url":"https://api.github.com/users/aclements/repos","events_url":"https://api.github.com/users/aclements/events{/privacy}","received_events_url":"https://api.github.com/users/aclements/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-28T22:29:00Z","updated_at":"2015-04-28T22:29:00Z","closed_at":null,"body":"sysmon runs without a P (that is, getg().m.p.ptr() == nil), but I believe it can invoke write barriers in certain unlikely (but possible) scenarios. If this happens, the write barrier will panic with \"writebarrierptr_nostore1 called with mp.p == nil\".\r\n\r\nThe common paths are all free of write barriers (sysmon itself, retake, and most of the functions called directly by them), but there are calls to record trace events, which are known to have write barriers when the trace buffer fills up, and other complex things like netpoll and checkdead that may not have write barriers but it's not at all obvious to me.\r\n\r\nI don't know what the answer to this is. Possibly sysmon needs something like we were considering for the GC: a special P that is dedicated to sysmon and doesn't count against GOMAXPROCS. It would also need modifications to at least its lengthy usleep calls, which wouldn't be interruptable by STW (but it doesn't matter right now since there's no P to stop anyway).\r\n\r\nThe most recent specific instance of this I can find was on netbsd-386-minux in commit 41dbcc1:\r\n  http://build.golang.org/log/c5098592bfbca60c15071fdf60427372c480a396\r\nThis specific one has long since been fixed, but shows evidence of sysmon running without a P.\r\n\r\n@dvyukov @RLH @rsc "}}