bug-m4
[Top][All Lists]
Advanced

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

Re: next snapshot in preparation for m4 1.4.12


From: Tom G. Christensen
Subject: Re: next snapshot in preparation for m4 1.4.12
Date: Sun, 7 Sep 2008 12:47:55 +0200
User-agent: Mutt/1.4.2.2i

On Tue, Sep 02, 2008 at 01:20:43PM -0600, Eric Blake wrote:
> Which means I think we have isolated the bug to the recurse function.
> Gnulib's version must be doing something that actually manages to recurse
> with p == 0 in the final stack frame, then segv's dereferencing NULL
> rather than triggering stack overflow:
> 
<snip recurse functions>
> I wonder if switching to libsigsegv's version will solve it.
>
After a bit of fidling I can say that it won't.
I replaced the recurse function in the m4 conftest with the ones from
libsigsegv and it still dumps core.

I've spent some time staring at m4s c-stack conftest program and a
similar one from libsigsegv and after some trial and error I've isolated
a change which will cause the m4 c-stack conftest to run succesfully.

--- conftest-1.c        2008-09-02 16:42:49.000000000 +0200
+++ conftest-3.c        2008-09-07 12:12:32.630000000 +0200
@@ -74,13 +74,14 @@
         static int
         c_stack_action ()
         {
+          char mystack[SIGSTKSZ];
           stack_t st;
           struct sigaction act;
           int r;
  
           st.ss_flags = 0;
-          st.ss_sp = alternate_signal_stack.buffer;
-          st.ss_size = sizeof alternate_signal_stack.buffer;
+          st.ss_sp = mystack;
+          st.ss_size = sizeof (mystack);
           r = sigaltstack (&st, 0);
           if (r != 0)
             return r;

$ cc -woff 728 -o conftest-3 -g conftest-3.c
$ ./conftest-3
$ echo $?
0
$

Apparently using a union to define the alternate stack like c-stack does
has some issues.
Looking briefly at libsigsegv it seems to never use the union style but
instead always uses a definition similar to the above.

-tgc




reply via email to

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