freebsd-nq/lib/libc/i386/gen
Konstantin Belousov 55a1911ef2 The getcontext() from the __fillcontextx() call in the
check_deferred_signal() returns twice, since handle_signal() emulates
the return from the normal signal handler by sigreturn(2)ing the
passed context.  Second return is performed on the destroyed stack
frame, because __fillcontextx() has already returned.  This causes
undefined and bad behaviour, usually the victim thread gets SIGSEGV.

Avoid nested frame and the need to return from it by doing direct call
to getcontext() in the check_deferred_signal() and using a new private
libc helper __fillcontextx2() to complement the context with the
extended CPU state if the deferred signal is still present.

The __fillcontextx() is now unused, but is kept to allow older
libthr.so to be used with the new libc.

Mark __fillcontextx() as returning twice [1].

Reported by:	pgj
Pointy hat to:	kib
Discussed with:	dim
Tested by:	pgj, dim
Suggested by:	jilles [1]
MFC after:	1 week
2013-05-28 04:54:16 +00:00
..
_ctx_start.S Add section .note.GNU-stack for assembly files used by 386 and amd64. 2011-01-07 16:08:40 +00:00
_set_tp.c
_setjmp.S Add section .note.GNU-stack for assembly files used by 386 and amd64. 2011-01-07 16:08:40 +00:00
fabs.S Add section .note.GNU-stack for assembly files used by 386 and amd64. 2011-01-07 16:08:40 +00:00
flt_rounds.c
getcontextx.c The getcontext() from the __fillcontextx() call in the 2013-05-28 04:54:16 +00:00
infinity.c
makecontext.c
Makefile.inc Add API for obtaining extended machine context states that cannot be 2012-01-21 18:00:28 +00:00
rfork_thread.S libc/i386: Do not export .cerror. 2012-09-05 21:41:05 +00:00
setjmp.S Despite official i386 ABI does not mandate any stack alignment besides 2011-11-02 18:08:30 +00:00
signalcontext.c
sigsetjmp.S Despite official i386 ABI does not mandate any stack alignment besides 2011-11-02 18:08:30 +00:00