From owner-svn-src-all@freebsd.org Mon Aug 10 17:02:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21DC899E044; Mon, 10 Aug 2015 17:02:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC9F7284; Mon, 10 Aug 2015 17:02:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7AH2hC4035537; Mon, 10 Aug 2015 17:02:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7AH2hak035535; Mon, 10 Aug 2015 17:02:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201508101702.t7AH2hak035535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 10 Aug 2015 17:02:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286582 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Aug 2015 17:02:44 -0000 Author: kib Date: Mon Aug 10 17:02:42 2015 New Revision: 286582 URL: https://svnweb.freebsd.org/changeset/base/286582 Log: 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 Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_rtld.c head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_rtld.c ============================================================================== --- head/lib/libthr/thread/thr_rtld.c Mon Aug 10 16:32:47 2015 (r286581) +++ head/lib/libthr/thread/thr_rtld.c Mon Aug 10 17:02:42 2015 (r286582) @@ -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); } Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Mon Aug 10 16:32:47 2015 (r286581) +++ head/lib/libthr/thread/thr_sig.c Mon Aug 10 17:02:42 2015 (r286582) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -257,7 +258,7 @@ handle_signal(struct sigaction *actp, in /* reschedule cancellation */ check_cancel(curthread, &uc2); errno = err; - __sys_sigreturn(&uc2); + syscall(SYS_sigreturn, &uc2); } void