This is the mail archive of the
mailing list for the glibc project.
Re: Consensus on MT-, AS- and AC-Safety docs.
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Rich Felker <dalias at aerifal dot cx>, Carlos O'Donell <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, Torvald Riegel <triegel at redhat dot com>, Alexandre Oliva <aoliva at redhat dot com>
- Date: Wed, 27 Nov 2013 13:34:22 +0000
- Subject: Re: Consensus on MT-, AS- and AC-Safety docs.
- Authentication-results: sourceware.org; auth=none
- References: <528A7C8F dot 8060805 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1311182312130 dot 8831 at digraph dot polyomino dot org dot uk> <528BA2DA dot 3090608 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1311192205550 dot 8742 at digraph dot polyomino dot org dot uk> <20131120204655 dot GL24286 at brightrain dot aerifal dot cx> <5295CD1D dot 7080501 at redhat dot com>
On Wed, 27 Nov 2013, Florian Weimer wrote:
> On 11/20/2013 09:46 PM, Rich Felker wrote:
> > All AS-safe functions have the potential to modify errno (since all
> > functions in the standard library do); many are even required to
> > modify it. When using any library function in a signal handler, it's
> > the programmer's responsibility to save errno and restore its value
> > before returning.
> I think we should do that in the code that wraps the signal handler call, to
> address this class of errors once and for all. Is this feasible?
On many architectures the signal trampoline is provided by the kernel and
so has no access to libc implementation details like errno. As far as I
understand, even when provided by libc all it does is call the sigreturn
syscall and provide appropriate unwind information for the registers the
kernel saved on the stack - that is, there is no userspace code called
before the signal handler that would have a chance to save errno.
Joseph S. Myers