diff mbox

Recent Go patch broke Alpha bootstrap

Message ID CAFULd4a=t3z05uYPTNq=0m_RfmDdJHO_=5ecGT=Wn2gO4jPDPA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Nov. 12, 2013, 1:17 p.m. UTC
On Tue, Nov 12, 2013 at 8:52 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Mon, Nov 11, 2013 at 8:52 PM, Ian Lance Taylor <iant@google.com> wrote:
>> On Fri, Nov 8, 2013 at 1:10 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>>>
>>> panic: runtime error: invalid memory address or nil pointer dereference
>>> [signal 0xb code=0x1 addr=0x1c]
>
>>> FAIL: runtime/pprof
>>> gmake[2]: *** [runtime/pprof/check] Error 1
>>>
>>> This one is new, I have to look into it a bit deeper.
>>
>>
>> I don't know what is happening here.  I can't recreate it.  There was
>> a different problem that could arise in runtime/pprof, that was fixed
>> by a patch I submitted on Saturday
>> (http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01016.html).  So it's
>> possible that this is fixed now.
>
> The failure is specific to !USING_SPLIT_STACK targets:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x200009e9280 (LWP 21478)]
> 0x000000012001e854 in syscall.Exitsyscall () at
> ../../../gcc-svn/trunk/libgo/runtime/proc.c:1986
> 1986            m->p->syscalltick++;
> (gdb) list
> 1981    #ifdef USING_SPLIT_STACK
> 1982            gp->gcstack = nil;
> 1983    #endif
> 1984            gp->gcnext_sp = nil;
> 1985            runtime_memclr(&gp->gcregs, sizeof gp->gcregs);
> 1986            m->p->syscalltick++;
> 1987    }
> 1988
> 1989    static bool
> 1990    exitsyscallfast(void)
> (gdb) p m
> $2 = <optimized out>
>
> The crash is at line 1986, but it is unclear if m or p are null.

It is p that is null.

Trying to add debug printf fixes the failure. Adding:

makes test to pass.

However, moving pritf after runtime_mcall shows that m->p can be null
after the call:

$ ./a.out
Testy 0xc21000f000
Testy (nil)
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x1c]

goroutine 10 [running]:
syscall.Exitsyscall
        ../../../gcc-svn/trunk/libgo/runtime/proc.c:1987
pprof.profileWriter
        /home/uros/gcc-build/alphaev68-unknown-linux-gnu/libgo/gotest5746/test/pprof.go:600
created by runtime_pprof.StartCPUProfile
        /home/uros/gcc-build/alphaev68-unknown-linux-gnu/libgo/gotest5746/test/pprof.go:594

goroutine 1 [chan receive]:
testing.RunTests
        ../../../gcc-svn/trunk/libgo/go/testing/testing.go:470
testing.Main
        ../../../gcc-svn/trunk/libgo/go/testing/testing.go:401
main.main
        /home/uros/gcc-build/alphaev68-unknown-linux-gnu/libgo/gotest5746/test/_testmain.go:34

goroutine 8 [chan receive]:
testing.tRunner
        ../../../gcc-svn/trunk/libgo/go/testing/testing.go:389
created by testing.RunTests
        ../../../gcc-svn/trunk/libgo/go/testing/testing.go:469

Trivial fix would be adding if (m->p) in front of the dereference, but
I don't know if exitsyscall0 is allowed to return nill in m->p.

Uros.
diff mbox

Patch

Index: proc.c
===================================================================
--- proc.c      (revision 204684)
+++ proc.c      (working copy)
@@ -1969,6 +1969,7 @@  runtime_exitsyscall(void)

        m->locks--;

+       printf ("Testx %p\n", m->p);
        // Call the scheduler.
        runtime_mcall(exitsyscall0);