freebsd-dev/lib/libthr
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
..
arch Merging of projects/armv6, part 2 2012-08-15 03:08:29 +00:00
support Merge from tbemd, with a small amount of rework: 2010-09-13 01:43:10 +00:00
sys __error could be called too early before libthr is initialized, test 2006-07-12 03:44:05 +00:00
thread The getcontext() from the __fillcontextx() call in the 2013-05-28 04:54:16 +00:00
libthr.3 mdoc: order prologue macros consistently by Dd/Dt/Os 2010-04-14 19:08:06 +00:00
Makefile Oops, don't remove -fexceptions flag. 2010-10-08 01:53:33 +00:00
pthread.map Add accept4() system call. 2013-05-01 20:10:21 +00:00