[Bug ada/41929] New: 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

View: New views
8 Messages — Rating Filter:   Alert me  

[Bug ada/41929] New: 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Between 20091022 and 20091102, a parallel make check run (both 32 and 64 bit)
on Solaris 11/SPARC started to fail with `Cannot fork: out of memory'.  It
turns
out that the null_pointer_deref1 gnat.dg test is the culprit: it grows to 11+
GB
on my test system:

   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP      
 15442 ro         11G 6705M stop    43    0   0:03:16 0.0% null_pointer_de/1

pmap shows that it's all on the heap:

15442:  ./null_pointer_deref1.exe
0000000100000000        120K r-x--
/export/vol/gcc/obj/SunOS-sparc/gcc-4.5.0-20091102/11-gcc/gcc/testsuite/gnat/null_pointer_deref1.exe
000000010011C000         24K rwx--
/export/vol/gcc/obj/SunOS-sparc/gcc-4.5.0-20091102/11-gcc/gcc/testsuite/gnat/null_pointer_deref1.exe
0000000100122000       2936K rwx--    [ heap ]
0000000100400000     933888K rwx--    [ heap ]
7FFFFFFF7F460000          8K rwxs-    [ anon ]
7FFFFFFF7F500000         24K rwx--    [ anon ]
7FFFFFFF7F600000          8K rwx--    [ anon ]
7FFFFFFF7F700000          8K r-x--
/platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
7FFFFFFF7F800000       1312K r-x--  /lib/sparcv9/libc.so.1
7FFFFFFF7FA48000         40K rwx--  /lib/sparcv9/libc.so.1
7FFFFFFF7FA52000          8K rwx--  /lib/sparcv9/libc.so.1
7FFFFFFF7FB00000          8K rwx--    [ anon ]
7FFFFFFF7FC00000          8K rw---    [ anon ]
7FFFFFFF7FD00000          8K rw---    [ anon ]
7FFFFFFF7FE00000        224K r-x--  /lib/sparcv9/ld.so.1
7FFFFFFF7FF38000         16K rwx--  /lib/sparcv9/ld.so.1
7FFFFFFF7FF3C000          8K rwx--  /lib/sparcv9/ld.so.1
FFFFFFFCF5C00000   10653696K rw---    [ stack ]
         total     11592344K

Unfortunately, I haven't been able to get a stacktrace with pstack, nor with
gdb 6.6 (quite old now, admittedly).  Since this breaks all testing, I've moved
the source out of the way for now.


--
           Summary: 64-bit null_pointer_deref1 gnat.dg test consumes all
                    available memory
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.11
  GCC host triplet: sparc-sun-solaris2.11
GCC target triplet: sparc-sun-solaris2.11


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from ebotcazou at gcc dot gnu dot org  2009-11-03 18:49 -------
Somewhat expected, see the comment in the test.  A patch to disable it on this
platform (sparc*-*-solaris2.11) is pre-approved.

The failure very likely means that the 64-bit pattern matching code of the
fallback routine in config/sparc/sol2-unwind.h misbehaves for Solaris 11.
Unfortunately, I don't have access to any Solaris 11 machine so I cannot fix.

To debug this, you need to recompile libgcc at -O0 -g and put a breakpoint on
sparc64_fallback_frame_state from within the debugger; it will be hit once you
resume execution after the SIGSEGV.  What happens from that on?


--

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-03 18:49:44
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-11-04 10:29 -------
I see the same on x86_64-linux


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from ebotcazou at gcc dot gnu dot org  2009-11-04 11:19 -------
> I see the same on x86_64-linux

That would be surprising, nothing has changed since they were installed.  Are
you sure it's not gnat.dg/stack_check1.adb instead?  It passes on my machine,
both 32-bit and 64-bit mode, but I can imagine that this may be different on
yours.


--

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #4 from rguenther at suse dot de  2009-11-04 11:49 -------
Subject: Re:  64-bit null_pointer_deref1 gnat.dg test consumes
 all available memory

On Wed, 4 Nov 2009, ebotcazou at gcc dot gnu dot org wrote:

> ------- Comment #3 from ebotcazou at gcc dot gnu dot org  2009-11-04 11:19 -------
> > I see the same on x86_64-linux
>
> That would be surprising, nothing has changed since they were installed.  Are
> you sure it's not gnat.dg/stack_check1.adb instead?  It passes on my machine,
> both 32-bit and 64-bit mode, but I can imagine that this may be different on
> yours.

Running target unix//-m32
FAIL: gnat.dg/null_pointer_deref1.adb execution test

the 64bit variant passes.

the log just states

raised STORAGE_ERROR : stack overflow (or erroneous memory access)

Richard.


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #5 from ebotcazou at gcc dot gnu dot org  2009-11-04 11:57 -------
> Running target unix//-m32
> FAIL: gnat.dg/null_pointer_deref1.adb execution test
>
> the 64bit variant passes.
>
> the log just states
>
> raised STORAGE_ERROR : stack overflow (or erroneous memory access)

OK, thanks for the clarification.  Which kernel do you run?  Does the following
patch help?

Index: config/i386/linux-unwind.h
===================================================================
--- config/i386/linux-unwind.h  (revision 153778)
+++ config/i386/linux-unwind.h  (working copy)
@@ -172,6 +172,25 @@ x86_fallback_frame_state (struct _Unwind
   fs->signal_frame = 1;
   return _URC_NO_REASON;
 }
+
+#define MD_FROB_UPDATE_CONTEXT x86_frob_update_context
+
+/* Fix up for kernels that have vDSO, but don't have S flag in it.  */
+
+static void
+x86_frob_update_context (struct _Unwind_Context *context,
+                        _Unwind_FrameState *fs ATTRIBUTE_UNUSED)
+{
+  unsigned char *pc = context->ra;
+
+  /* movl $__NR_rt_sigreturn,%eax ; {int $0x80 | syscall}  */
+  if (*(unsigned char *)(pc+0) == 0xb8
+      && *(unsigned int *)(pc+1) == 173
+      && (*(unsigned short *)(pc+5) == 0x80cd
+         || *(unsigned short *)(pc+5) == 0x050f))
+    _Unwind_SetSignalFrame (context, 1);
+}
+
 #endif /* not glibc 2.0 */
 #endif /* ifdef __x86_64__  */
 #endif /* ifdef inhibit_libc  */


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #6 from rguenther at suse dot de  2009-11-04 13:12 -------
Subject: Re:  64-bit null_pointer_deref1 gnat.dg test consumes
 all available memory

On Wed, 4 Nov 2009, ebotcazou at gcc dot gnu dot org wrote:

> ------- Comment #5 from ebotcazou at gcc dot gnu dot org  2009-11-04 11:57 -------
> > Running target unix//-m32
> > FAIL: gnat.dg/null_pointer_deref1.adb execution test
> >
> > the 64bit variant passes.
> >
> > the log just states
> >
> > raised STORAGE_ERROR : stack overflow (or erroneous memory access)
>
> OK, thanks for the clarification.  Which kernel do you run?  Does the following
> patch help?

I run 2.6.16.42-0.6-smp, that is some old SLES10 kernel.

I'll test if the patch helps.

Richard.

> Index: config/i386/linux-unwind.h
> ===================================================================
> --- config/i386/linux-unwind.h  (revision 153778)
> +++ config/i386/linux-unwind.h  (working copy)
> @@ -172,6 +172,25 @@ x86_fallback_frame_state (struct _Unwind
>    fs->signal_frame = 1;
>    return _URC_NO_REASON;
>  }
> +
> +#define MD_FROB_UPDATE_CONTEXT x86_frob_update_context
> +
> +/* Fix up for kernels that have vDSO, but don't have S flag in it.  */
> +
> +static void
> +x86_frob_update_context (struct _Unwind_Context *context,
> +                        _Unwind_FrameState *fs ATTRIBUTE_UNUSED)
> +{
> +  unsigned char *pc = context->ra;
> +
> +  /* movl $__NR_rt_sigreturn,%eax ; {int $0x80 | syscall}  */
> +  if (*(unsigned char *)(pc+0) == 0xb8
> +      && *(unsigned int *)(pc+1) == 173
> +      && (*(unsigned short *)(pc+5) == 0x80cd
> +         || *(unsigned short *)(pc+5) == 0x050f))
> +    _Unwind_SetSignalFrame (context, 1);
> +}
> +
>  #endif /* not glibc 2.0 */
>  #endif /* ifdef __x86_64__  */
>  #endif /* ifdef inhibit_libc  */
>
>
>


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929


[Bug ada/41929] 64-bit null_pointer_deref1 gnat.dg test consumes all available memory

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #7 from rguenther at suse dot de  2009-11-04 21:51 -------
Subject: Re:  64-bit null_pointer_deref1 gnat.dg test consumes
 all available memory

On Wed, 4 Nov 2009, rguenther at suse dot de wrote:

> ------- Comment #6 from rguenther at suse dot de  2009-11-04 13:12 -------
> Subject: Re:  64-bit null_pointer_deref1 gnat.dg test consumes
>  all available memory
>
> On Wed, 4 Nov 2009, ebotcazou at gcc dot gnu dot org wrote:
>
> > ------- Comment #5 from ebotcazou at gcc dot gnu dot org  2009-11-04 11:57 -------
> > > Running target unix//-m32
> > > FAIL: gnat.dg/null_pointer_deref1.adb execution test
> > >
> > > the 64bit variant passes.
> > >
> > > the log just states
> > >
> > > raised STORAGE_ERROR : stack overflow (or erroneous memory access)
> >
> > OK, thanks for the clarification.  Which kernel do you run?  Does the following
> > patch help?
>
> I run 2.6.16.42-0.6-smp, that is some old SLES10 kernel.
>
> I'll test if the patch helps.

It fixed the failure for me.

Richard.


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41929