From owner-svn-src-all@FreeBSD.ORG Wed Feb 9 09:20:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C37E106564A; Wed, 9 Feb 2011 09:20:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60D488FC0A; Wed, 9 Feb 2011 09:20:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p199KRqE077702; Wed, 9 Feb 2011 09:20:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p199KRn5077698; Wed, 9 Feb 2011 09:20:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201102090920.p199KRn5077698@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 Feb 2011 09:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218476 - head/libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 09 Feb 2011 09:20:27 -0000 Author: kib Date: Wed Feb 9 09:20:27 2011 New Revision: 218476 URL: http://svn.freebsd.org/changeset/base/218476 Log: Use sigsetjmp/siglongjmp with disabled signal mask access for lock upgrade in rtld. There is no need to care about the mask, which causes a lot of unneeded sigprocmask(2) calls during each symbol lookup. Modified: head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/rtld_lock.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed Feb 9 08:01:45 2011 (r218475) +++ head/libexec/rtld-elf/rtld.c Wed Feb 9 09:20:27 2011 (r218476) @@ -560,7 +560,7 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo RtldLockState lockstate; rlock_acquire(rtld_bind_lock, &lockstate); - if (setjmp(lockstate.env) != 0) + if (sigsetjmp(lockstate.env, 0) != 0) lock_upgrade(rtld_bind_lock, &lockstate); if (obj->pltrel) rel = (const Elf_Rel *) ((caddr_t) obj->pltrel + reloff); @@ -2142,7 +2142,7 @@ dlopen(const char *name, int mode) ld_tracing = (mode & RTLD_TRACE) == 0 ? NULL : "1"; if (ld_tracing != NULL) { rlock_acquire(rtld_bind_lock, &lockstate); - if (setjmp(lockstate.env) != 0) + if (sigsetjmp(lockstate.env, 0) != 0) lock_upgrade(rtld_bind_lock, &lockstate); environ = (char **)*get_program_var_addr("environ", &lockstate); lock_release(rtld_bind_lock, &lockstate); @@ -2264,7 +2264,7 @@ do_dlsym(void *handle, const char *name, req.lockstate = &lockstate; rlock_acquire(rtld_bind_lock, &lockstate); - if (setjmp(lockstate.env) != 0) + if (sigsetjmp(lockstate.env, 0) != 0) lock_upgrade(rtld_bind_lock, &lockstate); if (handle == NULL || handle == RTLD_NEXT || handle == RTLD_DEFAULT || handle == RTLD_SELF) { Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Wed Feb 9 08:01:45 2011 (r218475) +++ head/libexec/rtld-elf/rtld.h Wed Feb 9 09:20:27 2011 (r218476) @@ -276,7 +276,7 @@ typedef struct Struct_DoneList { struct Struct_RtldLockState { int lockstate; - jmp_buf env; + sigjmp_buf env; }; /* Modified: head/libexec/rtld-elf/rtld_lock.c ============================================================================== --- head/libexec/rtld-elf/rtld_lock.c Wed Feb 9 08:01:45 2011 (r218475) +++ head/libexec/rtld-elf/rtld_lock.c Wed Feb 9 09:20:27 2011 (r218476) @@ -259,7 +259,7 @@ lock_restart_for_upgrade(RtldLockState * case RTLD_LOCK_WLOCKED: break; case RTLD_LOCK_RLOCKED: - longjmp(lockstate->env, 1); + siglongjmp(lockstate->env, 1); break; default: assert(0);