bug-gnulib
[Top][All Lists]
Advanced

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

Re: c-stack vs. older platforms


From: Eric Blake
Subject: Re: c-stack vs. older platforms
Date: Thu, 5 Jun 2008 22:24:25 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Bruno Haible <bruno <at> clisp.org> writes:

> > are there any platforms where switching to c-stack would cause a 
> > regression in m4's stack detection abilities if we don't port m4's 
fallbacks 
> > for supporting older APIs?
> > 
> > [1]http://git.savannah.gnu.org/gitweb/?p=m4.git;a=blob;f=src/stackovf.c
> 
> Looking at m4's current code requirements:
> 
>   - sigvec/SV_ONSTACK is pointless; it was last needed on SunOS4. The only
>     platform nowadays without sigaction is mingw.
> 
>   - sigaltstack is present and works on
>       Linux, FreeBSD, NetBSD, AIX, HP-UX 11.11, IRIX, OSF/1, Solaris, and
>       (more or less) MacOS X.
>     It is not available on
>       OpenBSD, HP-UX 11.23, Cygwin, mingw, BeOS.

Actually, sigaltstack is in OpenBSD 4.0.  I've tested that both m4 and c-stack 
reported a stack overflow message on OpenBSD 4.0.  But with both OpenBSD 4.0 
and Linux glibc 2.3.4, I noticed that config.h's 
HAVE_XSI_STACK_OVERFLOW_HEURISTIC was undefined with c-stack, so it seems like 
_any_ segv, rather than true overflows, would be reported on those platforms (I 
guess I'll have to enhance and rerun my tests with an intentional non-overflow 
segv to verify).  Or maybe c-stack.m4's test case is too restrictive.

> 
>   - But the most constraining requirement is how to get the fault address:
>       - 'ip->si_addr' works only on
>           Linux >= 2.4, HP-UX, OSF/1, Solaris.
>         (The same code would also work on FreeBSD, NetBSD, OpenBSD if you
>         were catching SIGBUS in addition to SIGSEGV.)
>       - The "struct sigcontext *scp, char *addr" code is useless, it never
>         works. (It would work on FreeBSD if you were catching SIGBUS, not
>         only SIGSEGV.)
> 
> So m4's current code (approximately) only works on Linux >= 2.4, HP-UX, OSF/1,
> Solaris. And these are the same platforms on which 'c-stack' works, I believe.

Thanks.  I don't feel as worried about swapping over to c-stack, then.  And it 
is always the case that if someone pipes up with a regression (and more 
importantly, an alternative that will work on their platform), we can revisit 
the issue at that point.  And by using gnulib's c-stack, other projects will 
also benefit.

-- 
Eric Blake







reply via email to

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