bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: AIX stackoverflow detection hang [was: Reporting m4 bug]


From: Neha Jain33
Subject: RE: AIX stackoverflow detection hang [was: Reporting m4 bug]
Date: Mon, 11 Jul 2022 05:48:08 +0000

Hi Bruno and Eric,

Thanks for the reply, I will wait for the next build and will check if I am 
still seeing hang issue or not.

-----Original Message-----
From: Bruno Haible <bruno@clisp.org> 
Sent: Monday, 11 July, 2022 3:05 AM
To: Neha Jain33 <nehajain29@in.ibm.com>
Cc: Eric Blake <eblake@redhat.com>; bug-m4@gnu.org; Srirama R Kucherlapati 
<sriram.rk@in.ibm.com>
Subject: [EXTERNAL] Re: AIX stackoverflow detection hang [was: Reporting m4 bug]

Thanks for the report.
And thanks for the CC, Eric.

> > stopped in is_mapped at line 621 in file ""
> > is_mapped(addr = 9), line 621 in "stackvma.c"
> > is_unmapped(addr1 = 4, addr2 = 15), line 768 in "stackvma.c"
> > mincore_is_near_this(addr = 10, vma = 0x0000000111001fb8), line 793 in 
> > "stackvma.c"
> > unnamed block in sigsegv.sigsegv_handler(sig = 11, sip = 
> > 0x0000000111002310, ucp = 0x0000000111002060), line 973 in "sigsegv.c"
> > unnamed block in sigsegv.sigsegv_handler(sig = 11, sip = 
> > 0x0000000111002310, ucp = 0x0000000111002060), line 973 in "sigsegv.c"
> > sigsegv.sigsegv_handler(sig = 11, sip = 0x0000000111002310, ucp = 
> > 0x0000000111002060), line 973 in "sigsegv.c"
> > main(), line 183 in "test-sigsegv-catch-stackoverflow2.c"
> > 
> > code snippet
> > location:/home/buildusr/rpmbuild/BUILD/m4-1.4.19/64bit/lib/stackvma.
> > c seems like its stuck here in for loop
> > 
> >   754   for (;;)
> >     755     {
> >     756       uintptr_t addr_stepsize;
> >     757       uintptr_t i;
> >     758       uintptr_t addr;
> >     759
> >     760       stepsize = stepsize / 2;
> >     761       if (stepsize == 0)
> >     762         break;
> >     763       addr_stepsize = stepsize * pagesize;
> >     764       for (i = stepsize, addr = addr1 + addr_stepsize;
> >     765            i < count;
> >     766            i += 2 * stepsize, addr += 2 * addr_stepsize)
> >     767         /* Here addr = addr1 + i * pagesize.  */
> >     768         if (is_mapped (addr))
> >     769           return 0;
> >     770     }

The comments, a few lines above, explain that this loop can be slow. In 64-bit 
mode, it can even be *very* slow.

But fortunately AIX 7 comes with a better primitive for enumerating the VMAs, 
through the /proc file system. I have now added code in stackvma.c to try this 
faster method first, before falling back on the slower mincore- based approach:
https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=19435dc207e9279d744435ce72466f765c5358e2
 

In a week, there should be a new m4 snapshot available, that includes this 
change. You can get it from https://gitlab.com/gnu-m4/ci-distcheck  .
I expect that it will fix the test hang that you have seen.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]