)]}' { "commit": "35455fff0ebb7dd1b8e698f245a823ef8c711ac9", "tree": "f487de9d0a0fe87f557adeee844aa70f3e3734f0", "parents": [ "31f71506d7026595be76713af25197a8c0022ac8" ], "author": { "name": "Daniel S Fava", "email": "danielsfava@gmail.com", "time": "Thu Nov 12 17:25:47 2020 +0100" }, "committer": { "name": "Ian Lance Taylor", "email": "iant@golang.org", "time": "Fri Nov 13 15:00:23 2020 +0000" }, "message": "runtime: swap the order of raceacquire() and racerelease()\n\nIn chansend() and chanrecv() of chan.go, the order of calls to\nraceacquire() and racerelease() was swapped, which meant that the\ncode was not following the memory model \"by the letter of the law.\"\nSimilar for bufrecv and bufsend in select.go\n\nThe memory model says:\n\n- A send happens before the corresponding receive completes, and\n- the kth receive on a channel with capacity C happens before the\nk+C send on that channel completes.\n\nThe operative word here is \"completes.\" For example, a sender obtains\nhappens-before information on completion of the send-operation, which\nmeans, after the sender has deposited its message onto the channel.\nSimilarly for receives.\n\nIf the order of raceacquire() and racerelease() is incorrect, the race\ndetector may fail to report some race conditions.\n\nThe fix is minimal from the point of view of Go. The fix does, however,\nrely on a new function added to TSan:\n\nhttps://reviews.llvm.org/D76322\n\nThis commit only affects execution when race detection is enabled.\n\nAdded two tests into `runtime/race/output_test.go`:\n\n- `chanmm` tests for the issue addressed by this patch\n- `mutex` is a test for inverted semaphores, which must not be broken\n by this (or any other) patch\n\nFixes #37355\n\nChange-Id: I5e886879ead2bd456a4b7dd1d17253641b767f63\nReviewed-on: https://go-review.googlesource.com/c/go/+/220419\nRun-TryBot: Ian Lance Taylor \u003ciant@golang.org\u003e\nTryBot-Result: Go Bot \u003cgobot@golang.org\u003e\nTrust: Dmitri Shuralyov \u003cdmitshur@golang.org\u003e\nReviewed-by: Dmitry Vyukov \u003cdvyukov@google.com\u003e\n", "tree_diff": [ { "type": "modify", "old_id": "859f36c914525dc875c3399de9327596d4da145b", "old_mode": 33188, "old_path": "src/runtime/chan.go", "new_id": "254816e3696cc69182180820117c82c125456711", "new_mode": 33188, "new_path": "src/runtime/chan.go" }, { "type": "modify", "old_id": "53910f991c5a967f77fd40d2de4f0863b239fb1c", "old_mode": 33188, "old_path": "src/runtime/race.go", "new_id": "79fd21765d7dfa683a57de7138ccba321971eded", "new_mode": 33188, "new_path": "src/runtime/race.go" }, { "type": "modify", "old_id": "b4b8936c7c609dbfe4de2e1e6f1c673680924ec7", "old_mode": 33188, "old_path": "src/runtime/race/output_test.go", "new_id": "5d0192f67f3ae3e764cc03c4fc1fdaeeb446c45f", "new_mode": 33188, "new_path": "src/runtime/race/output_test.go" }, { "type": "modify", "old_id": "6f26afa854fbcc3c58f5babd6d50efcaf7b8d720", "old_mode": 33188, "old_path": "src/runtime/race0.go", "new_id": "180f707b1a74294288ddff98fd9b58620fb9e585", "new_mode": 33188, "new_path": "src/runtime/race0.go" }, { "type": "modify", "old_id": "41e68a37463b2287fe886070cb86c94ca1bfb915", "old_mode": 33188, "old_path": "src/runtime/select.go", "new_id": "f04b130b15c8d6be6a43c19249dea742f0eec2a6", "new_mode": 33188, "new_path": "src/runtime/select.go" } ] }