bug-m4
[Top][All Lists]
Advanced

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

Re: test-c-stack2.sh failure on HP-UX


From: Bruno Haible
Subject: Re: test-c-stack2.sh failure on HP-UX
Date: Sat, 24 Jan 2009 14:06:21 +0100
User-agent: KMail/1.9.9

Gary V. Vaughan wrote:
> hppa2.0w-hp-hpux11.11-hpc1111 m4 tests pass, gnulib fails: test-c-stack.sh
> ./test-c-stack.sh[7]: 1752 Memory fault(coredump)
> FAIL: test-c-stack.sh

I reproduce this on HP-UX 11.11, without libsigsegv.

$ ./test-c-stack
./test-c-stack: program error
Segmentation fault (core dumped)

The situation on HP-UX 11.11 is that HAVE_XSI_STACK_OVERFLOW_HEURISTIC is not
defined. This is correct: there are two problems with the system here:

1) info->si_code is zero, not a positive number as expected by Paul's code.
2) the mcontext's uc_stack.ss_size field is unusable.

Breakpoint 1, segv_handler (signo=11, info=0x400017a8, context=0x400012d0)
    at c-stack.c:244
244       if (0 < info->si_code)
(gdb) print *info
$1 = {si_signo = 11, si_code = 0, si_errno = 0, si_value = {__svi_int_s = {
      __svi_int = 0}, __sival_ptr = 0x0}, __data = {__proc = {
      __pid = 2047868944, __pdata = {__kill = {__uid = 0}, __SIGCLD = {
          __status = 0}}}, __fault = {__addr = 0x7a100010}, __file = {
      __fd = 2047868944, __band = 0}, __gfault = {__addr = 0x7a100010, 
      __lockpage = 0x0, __dev_id = 0}}, __pad = {0, 0, 0, 0, 0, 0, 0, 0, 0}}
Stack grows, previous stack values are ...0x7a0ffe6c...0x7a0fff6c
Stack apparently ends at 0x7a100000
Failure address 0x7a100010 is plausible.
si_code is 0 - unusual but acceptable.
But  uc_stack = {ss_sp = 0x7a001100, ss_flags = 0, ss_size = 4352}
which is unusable.


I'm committing the change below. With it, the test passes:

PASS: test-c-stack.sh
cannot tell stack overflow from crash; consider installing libsigsegv
SKIP: test-c-stack2.sh


2009-01-24  Bruno Haible  <address@hidden>

        * lib/c-stack.c (segv_handler): If !HAVE_XSI_STACK_OVERFLOW_HEURISTIC,
        set signo = 0 also if info->si_code <= 0. Needed on HP-UX 11.11.
        Reported by Gary V. Vaughan <address@hidden>.

*** lib/c-stack.c.orig  2009-01-24 14:02:12.000000000 +0100
--- lib/c-stack.c       2009-01-24 13:54:39.000000000 +0100
***************
*** 239,259 ****
              void *context __attribute__ ((unused)))
  {
    /* Clear SIGNO if it seems to have been a stack overflow.  */
-   if (0 < info->si_code)
-     {
  #  if ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC
!       /* We can't easily determine whether it is a stack overflow; so
!        assume that the rest of our program is perfect (!) and that
!        this segmentation violation is a stack overflow.
! 
!        Note that although both Linux and Solaris provide
!        sigaltstack, SA_ONSTACK, and SA_SIGINFO, currently only
!        Solaris satisfies the XSI heueristic.  This is because
!        Solaris populates uc_stack with the details of the
!        interrupted stack, while Linux populates it with the details
!        of the current stack.  */
!       signo = 0;
  #  else
        /* If the faulting address is within the stack, or within one
         page of the stack end, assume that it is a stack
         overflow.  */
--- 239,259 ----
              void *context __attribute__ ((unused)))
  {
    /* Clear SIGNO if it seems to have been a stack overflow.  */
  #  if ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC
!   /* We can't easily determine whether it is a stack overflow; so
!      assume that the rest of our program is perfect (!) and that
!      this segmentation violation is a stack overflow.
! 
!      Note that although both Linux and Solaris provide
!      sigaltstack, SA_ONSTACK, and SA_SIGINFO, currently only
!      Solaris satisfies the XSI heueristic.  This is because
!      Solaris populates uc_stack with the details of the
!      interrupted stack, while Linux populates it with the details
!      of the current stack.  */
!   signo = 0;
  #  else
+   if (0 < info->si_code)
+     {
        /* If the faulting address is within the stack, or within one
         page of the stack end, assume that it is a stack
         overflow.  */
***************
*** 278,285 ****
        write (STDERR_FILENO, buf, strlen (buf));
        }
  #   endif
- #  endif
      }
  
    die (signo);
  }
--- 278,285 ----
        write (STDERR_FILENO, buf, strlen (buf));
        }
  #   endif
      }
+ #  endif
  
    die (signo);
  }




reply via email to

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