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

Issue 6939056: code review 6939056: sync/atomic: nil check before cas (Closed)

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

Description

sync/atomic: nil check before cas Fixes issue 4422. Implements the suggestion by Remy and Minux as described in the issue. loco(~/src) % go run issue4422.go panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x0 pc=0x2aa20] goroutine 1 [running]: sync/atomic.CompareAndSwapUint32(0x0, 0x0, 0x1, 0x2, 0x0, ...) /home/dfc/go/src/pkg/sync/atomic/asm_linux_arm.s:33 +0x8 sync.(*Mutex).Lock(0x0, 0x1e1b4) /home/dfc/go/src/pkg/sync/mutex.go:43 +0x38 main.main() /home/dfc/src/issue4422.go:9 +0x28

Patch Set 1 #

Patch Set 2 : diff -r 7e135713451d https://code.google.com/p/go #

Total comments: 3

Patch Set 3 : diff -r 7e135713451d https://code.google.com/p/go #

Patch Set 4 : diff -r 7e135713451d https://code.google.com/p/go #

Total comments: 2

Patch Set 5 : diff -r 7e135713451d https://code.google.com/p/go #

Patch Set 6 : diff -r 5acb449b2a67 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -0 lines) Patch
M src/pkg/sync/atomic/asm_linux_arm.s View 1 2 3 4 5 2 chunks +5 lines, -0 lines 0 comments Download

Messages

Total messages: 29
dave_cheney.net
Hello remyoudompheng@gmail.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
11 years, 4 months ago (2012-12-15 12:41:33 UTC) #1
minux1
https://codereview.appspot.com/6939056/diff/2001/src/pkg/sync/atomic/asm_linux_arm.s File src/pkg/sync/atomic/asm_linux_arm.s (right): https://codereview.appspot.com/6939056/diff/2001/src/pkg/sync/atomic/asm_linux_arm.s#newcode130 src/pkg/sync/atomic/asm_linux_arm.s:130: TEXT ·CompareAndSwapUint64(SB),7,$-4 i think you also need to do ...
11 years, 4 months ago (2012-12-15 12:45:54 UTC) #2
rsc
Looks good once Minux is happy.
11 years, 4 months ago (2012-12-15 18:15:55 UTC) #3
minux1
https://codereview.appspot.com/6939056/diff/2001/src/pkg/sync/atomic/asm_linux_arm.s File src/pkg/sync/atomic/asm_linux_arm.s (right): https://codereview.appspot.com/6939056/diff/2001/src/pkg/sync/atomic/asm_linux_arm.s#newcode83 src/pkg/sync/atomic/asm_linux_arm.s:83: MOVW addr+0(FP), R2 // ptr after some thought, i ...
11 years, 4 months ago (2012-12-15 19:02:37 UTC) #4
dave_cheney.net
Thank you for your comments. PTAL. https://codereview.appspot.com/6939056/diff/2001/src/pkg/sync/atomic/asm_linux_arm.s File src/pkg/sync/atomic/asm_linux_arm.s (right): https://codereview.appspot.com/6939056/diff/2001/src/pkg/sync/atomic/asm_linux_arm.s#newcode83 src/pkg/sync/atomic/asm_linux_arm.s:83: MOVW addr+0(FP), R2 ...
11 years, 4 months ago (2012-12-16 01:23:22 UTC) #5
minux1
On Sun, Dec 16, 2012 at 9:23 AM, <dave@cheney.net> wrote: > Done. But I did ...
11 years, 4 months ago (2012-12-16 01:32:35 UTC) #6
dave_cheney.net
PTAL. Now we get panic: runtime error: invalid memory address or nil pointer dereference [signal ...
11 years, 4 months ago (2012-12-16 01:42:25 UTC) #7
minux1
On 2012/12/16 01:42:25, dfc wrote: > panic: runtime error: invalid memory address or nil pointer ...
11 years, 4 months ago (2012-12-16 01:58:53 UTC) #8
dave_cheney.net
Done, and removed all the other cleanups in that file, the diff is now very ...
11 years, 4 months ago (2012-12-16 02:16:34 UTC) #9
dave_cheney.net
Hello remyoudompheng@gmail.com, minux.ma@gmail.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 4 months ago (2012-12-16 02:16:56 UTC) #10
minux1
On Sun, Dec 16, 2012 at 10:16 AM, <dave@cheney.net> wrote: > loco(~/src) % GOTRACEBACK=2 go ...
11 years, 4 months ago (2012-12-16 02:23:40 UTC) #11
dave_cheney.net
Hi Minux, Do you have any suggestions to fix the backtracer? Do we need to ...
11 years, 4 months ago (2012-12-18 23:37:57 UTC) #12
rsc
What if you try main calling f calling g calling CompareAndSwapUint64? Russ
11 years, 4 months ago (2012-12-18 23:52:37 UTC) #13
minux1
On Wed, Dec 19, 2012 at 7:52 AM, Russ Cox <rsc@golang.org> wrote: > What if ...
11 years, 4 months ago (2012-12-19 19:06:52 UTC) #14
minux1
On Wed, Dec 19, 2012 at 7:37 AM, <dave@cheney.net> wrote: > Do you have any ...
11 years, 4 months ago (2012-12-19 20:58:56 UTC) #15
minux1
On Thu, Dec 20, 2012 at 4:58 AM, minux <minux.ma@gmail.com> wrote: > The only solution ...
11 years, 4 months ago (2012-12-19 21:01:03 UTC) #16
dave_cheney.net
I think the cost of those additional instructions is minimal. +1 to this approach with ...
11 years, 4 months ago (2012-12-19 21:03:13 UTC) #17
minux1
On Thu, Dec 20, 2012 at 5:03 AM, Dave Cheney <dave@cheney.net> wrote: > @minux, thank ...
11 years, 4 months ago (2012-12-19 21:07:30 UTC) #18
dave_cheney.net
@minux, I applied your suggestion but on my pandaboard it was not a success pandaboard(~/src) ...
11 years, 4 months ago (2012-12-20 05:40:28 UTC) #19
minux1
On Thu, Dec 20, 2012 at 1:40 PM, <dave@cheney.net> wrote: > @minux, > > I ...
11 years, 4 months ago (2012-12-20 18:37:53 UTC) #20
rsc
The whole runtime assumes faults do not happen when LR is live, and this code ...
11 years, 4 months ago (2012-12-20 19:18:22 UTC) #21
minux1
On Friday, December 21, 2012, Russ Cox wrote: > The whole runtime assumes faults do ...
11 years, 4 months ago (2012-12-20 21:10:39 UTC) #22
rsc
> i think we need to fix the backtracer to always consider lr for the ...
11 years, 4 months ago (2012-12-22 15:29:38 UTC) #23
minux1
On Sat, Dec 22, 2012 at 11:29 PM, Russ Cox <rsc@golang.org> wrote: > the backtracer ...
11 years, 4 months ago (2012-12-22 15:40:37 UTC) #24
rsc
i think you should store it on the stack. sigpanic can trigger a panic, which ...
11 years, 4 months ago (2012-12-22 15:45:26 UTC) #25
minux1
On Sat, Dec 22, 2012 at 11:45 PM, Russ Cox <rsc@golang.org> wrote: > i think ...
11 years, 4 months ago (2012-12-22 15:50:33 UTC) #26
rsc
Minux, still planning to prepare the LR CL?
11 years, 2 months ago (2013-02-01 19:57:57 UTC) #27
rsc
Minux, still planning to prepare the LR CL?
11 years, 2 months ago (2013-02-01 19:58:01 UTC) #28
minux1
11 years, 2 months ago (2013-02-03 20:01:12 UTC) #29
On Sat, Feb 2, 2013 at 3:57 AM, <rsc@golang.org> wrote:

> Minux, still planning to prepare the LR CL?
>
https://codereview.appspot.com/7289047
Sign in to reply to this message.

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