aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/mips/gen/getcontextx.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2013-05-28 04:54:16 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2013-05-28 04:54:16 +0000
commit55a1911ef268cd0915f9e1ab1b24488716d47562 (patch)
tree7276aafc4c54d0b15dc950d0d6e67bba3398f4f5 /lib/libc/mips/gen/getcontextx.c
parentad600fe1aae5f90b9e335978bb025e6d56323e6a (diff)
downloadsrc-55a1911ef268cd0915f9e1ab1b24488716d47562.tar.gz
src-55a1911ef268cd0915f9e1ab1b24488716d47562.zip
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
Notes
Notes: svn path=/head/; revision=251047
Diffstat (limited to 'lib/libc/mips/gen/getcontextx.c')
-rw-r--r--lib/libc/mips/gen/getcontextx.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/mips/gen/getcontextx.c b/lib/libc/mips/gen/getcontextx.c
index 307978a466dd..54f851384811 100644
--- a/lib/libc/mips/gen/getcontextx.c
+++ b/lib/libc/mips/gen/getcontextx.c
@@ -40,6 +40,13 @@ __getcontextx_size(void)
}
int
+__fillcontextx2(char *ctx)
+{
+
+ return (0);
+}
+
+int
__fillcontextx(char *ctx)
{
ucontext_t *ucp;