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: Eric Blake
Subject: Re: next snapshot in preparation for m4 1.4.12
Date: Tue, 02 Sep 2008 13:20:43 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Tom G. Christensen on 9/2/2008 9:28 AM:
>> So, with my typo fixed, can you once again try those debugging steps, to
>> see if the breakpoint in overflow_handler trips?
>>
> It does not.

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:

static long
recurse (char *p)
{
  char array[500];
  array[0] = 1;
  return *p + recurse (array);
}

Whereas libsigsegv's version goes to greater lengths to try to force a
pure stack overflow:

volatile int *
recurse_1 (int n, volatile int *p)
{
  if (n < INT_MAX)
    *recurse_1 (n + 1, p) += n;
  return p;
}

int
recurse (volatile int n)
{
  return *recurse_1 (n, &n);
}

I wonder if switching to libsigsegv's version will solve it.  In the
meantime, I would be curious to see the disassembly of recurse, to see if
anything obvious appears as to why p==0 rather than a valid stack address
before the final stack frame.  In gdb, you can get this with 'disas recurse'.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAki9kgsACgkQ84KuGfSFAYCWewCgyWhATWUWKLkMsCwi1XczSO0j
PSUAn2Fyt5z4o5MeMAzx6r8RYvS0ps+r
=EDOX
-----END PGP SIGNATURE-----




reply via email to

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