Pre-resolve symbols required for the deferred signal processing. This

avoids recursion into rtld when leaving libthr critical section for
the deferred signal delivery.

For the same reason, use syscall(2) instead of referencing
__sys_sigreturn(2).  Syscall() is already pre-resolved for fork()
interceptor.

Tested by:	Andre Meiser <ortadur@web.de>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2015-08-10 17:02:42 +00:00
parent 97e2b41abf
commit 3d40192d3d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286582
2 changed files with 9 additions and 1 deletions

View File

@ -185,7 +185,9 @@ _thr_rtld_init(void)
{
struct RtldLockInfo li;
struct pthread *curthread;
ucontext_t *uc;
long dummy = -1;
int uc_len;
curthread = _get_curthread();
@ -231,4 +233,9 @@ _thr_rtld_init(void)
_thr_signal_block(curthread);
_rtld_thread_init(&li);
_thr_signal_unblock(curthread);
uc_len = __getcontextx_size();
uc = alloca(uc_len);
getcontext(uc);
__fillcontextx2((char *)uc);
}

View File

@ -30,6 +30,7 @@
#include <sys/param.h>
#include <sys/types.h>
#include <sys/signalvar.h>
#include <sys/syscall.h>
#include <signal.h>
#include <errno.h>
#include <stdlib.h>
@ -257,7 +258,7 @@ handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp)
/* reschedule cancellation */
check_cancel(curthread, &uc2);
errno = err;
__sys_sigreturn(&uc2);
syscall(SYS_sigreturn, &uc2);
}
void