Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1410)

Issue 7981043: code review 7981043: sync, sync/atomic: do not corrupt race detector after a... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 11 months ago by remyoudompheng
Modified:
11 years, 11 months ago
Reviewers:
CC:
golang-dev, r, minux1, dvyukov, rsc, adg
Visibility:
Public.

Description

sync, sync/atomic: do not corrupt race detector after a nil dereference. The race detector uses a global lock to analyze atomic operations. A panic in the middle of the code leaves the lock acquired. Similarly, the sync package may leave the race detectro inconsistent when methods are called on nil pointers.

Patch Set 1 #

Patch Set 2 : diff -r b4351de48c51 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r b4351de48c51 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 4 : diff -r 7cd19e1a734a https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 5 : diff -r c3f5e38e7aa0 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r e95933d23b2f https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+63 lines, -0 lines) Patch
M src/pkg/runtime/race/testdata/atomic_test.go View 1 2 3 2 chunks +19 lines, -0 lines 0 comments Download
M src/pkg/runtime/race/testdata/sync_test.go View 1 2 3 1 chunk +19 lines, -0 lines 0 comments Download
M src/pkg/sync/atomic/race.go View 1 2 3 15 chunks +15 lines, -0 lines 0 comments Download
M src/pkg/sync/cond.go View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
M src/pkg/sync/mutex.go View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/sync/rwmutex.go View 1 2 3 4 chunks +4 lines, -0 lines 0 comments Download
M src/pkg/sync/waitgroup.go View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 25
remyoudompheng
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 11 months ago (2013-03-22 23:14:46 UTC) #1
r
They might in-line already, but should it be done by hand anyway? You'd could have ...
11 years, 11 months ago (2013-03-23 00:27:30 UTC) #2
minux1
check for <4096 doesn't solve the general peoblem of a bad pointer passed in. why ...
11 years, 11 months ago (2013-03-23 07:31:17 UTC) #3
remyoudompheng
On 2013/03/23 07:31:17, minux wrote: > check for <4096 doesn't solve the general > peoblem ...
11 years, 11 months ago (2013-03-23 08:18:07 UTC) #4
dvyukov
On 2013/03/23 08:18:07, remyoudompheng wrote: > On 2013/03/23 07:31:17, minux wrote: > > check for ...
11 years, 11 months ago (2013-03-25 14:00:48 UTC) #5
dvyukov
https://codereview.appspot.com/7981043/diff/5001/src/pkg/sync/atomic/race.go File src/pkg/sync/atomic/race.go (right): https://codereview.appspot.com/7981043/diff/5001/src/pkg/sync/atomic/race.go#newcode25 src/pkg/sync/atomic/race.go:25: panic("nil pointer dereference in atomic operation") throw the same ...
11 years, 11 months ago (2013-03-25 14:00:54 UTC) #6
dvyukov
LGTM
11 years, 11 months ago (2013-03-25 14:01:05 UTC) #7
dvyukov
On 2013/03/23 00:27:30, r wrote: > They might in-line already, but should it be done ...
11 years, 11 months ago (2013-03-25 14:02:34 UTC) #8
r
On Mon, Mar 25, 2013 at 7:02 AM, <dvyukov@google.com> wrote: > On 2013/03/23 00:27:30, r ...
11 years, 11 months ago (2013-03-25 15:55:46 UTC) #9
minux1
On 2013/03/25 14:00:48, dvyukov wrote: > Yes, it's quite possible that SIGSEGV leaves internal race ...
11 years, 11 months ago (2013-03-25 19:49:19 UTC) #10
rsc
It would be better to dereference the pointer, so that the runtime can trigger the ...
11 years, 11 months ago (2013-03-25 19:58:22 UTC) #11
dvyukov
On 2013/03/25 19:58:22, rsc wrote: > It would be better to dereference the pointer, so ...
11 years, 11 months ago (2013-03-26 06:34:48 UTC) #12
dvyukov
On 2013/03/25 19:49:19, minux wrote: > On 2013/03/25 14:00:48, dvyukov wrote: > > Yes, it's ...
11 years, 11 months ago (2013-03-26 06:40:40 UTC) #13
remyoudompheng
Hello golang-dev@googlegroups.com, r@golang.org, minux.ma@gmail.com, dvyukov@google.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 11 months ago (2013-03-28 19:46:17 UTC) #14
remyoudompheng
Similar fixes were needed in the sync package to avoid corruptions. I was not aware ...
11 years, 11 months ago (2013-03-28 19:47:09 UTC) #15
dvyukov
https://codereview.appspot.com/7981043/diff/22001/src/pkg/sync/mutex.go File src/pkg/sync/mutex.go (right): https://codereview.appspot.com/7981043/diff/22001/src/pkg/sync/mutex.go#newcode84 src/pkg/sync/mutex.go:84: _ = m.state Is it actually necessary? I would ...
11 years, 11 months ago (2013-03-29 08:08:48 UTC) #16
remyoudompheng
It seems necessary because of the racedisable/raceenable thing. The sequence must be correct even if ...
11 years, 11 months ago (2013-03-29 08:22:23 UTC) #17
dvyukov
On Fri, Mar 29, 2013 at 12:22 PM, Rémy Oudompheng <remyoudompheng@gmail.com> wrote: > It seems ...
11 years, 11 months ago (2013-03-29 08:39:45 UTC) #18
remyoudompheng
On 2013/03/29 08:39:45, dvyukov wrote: > On Fri, Mar 29, 2013 at 12:22 PM, Rémy ...
11 years, 11 months ago (2013-04-02 06:42:51 UTC) #19
dvyukov
Yes, now I see the problem. Defer is used only in WaitGroup. Panic in most ...
11 years, 11 months ago (2013-04-07 21:32:29 UTC) #20
remyoudompheng
Is this okay for Go 1.1 ?
11 years, 11 months ago (2013-04-08 07:05:10 UTC) #21
adg
I want to only include critical fixes from now on. It doesn't seem critical to ...
11 years, 11 months ago (2013-04-08 07:09:06 UTC) #22
remyoudompheng
On 2013/4/8 Andrew Gerrand <adg@golang.org> wrote: > I want to only include critical fixes from ...
11 years, 11 months ago (2013-04-08 07:15:53 UTC) #23
adg
Okay. I am fine with this going into 1.1, seeing as the race detector is ...
11 years, 11 months ago (2013-04-08 07:20:54 UTC) #24
remyoudompheng
11 years, 11 months ago (2013-04-08 21:46:59 UTC) #25
*** Submitted as https://code.google.com/p/go/source/detail?r=0a4f1eb9372f ***

sync, sync/atomic: do not corrupt race detector after a nil dereference.

The race detector uses a global lock to analyze atomic
operations. A panic in the middle of the code leaves the
lock acquired.

Similarly, the sync package may leave the race detectro
inconsistent when methods are called on nil pointers.

R=golang-dev, r, minux.ma, dvyukov, rsc, adg
CC=golang-dev
https://codereview.appspot.com/7981043
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b