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.
This commit is contained in:
parent
e001171515
commit
2d3fe26ede
@ -560,7 +560,7 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff)
|
||||
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, void *retaddr, const Ver_Entry *ve,
|
||||
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) {
|
||||
|
@ -276,7 +276,7 @@ typedef struct Struct_DoneList {
|
||||
|
||||
struct Struct_RtldLockState {
|
||||
int lockstate;
|
||||
jmp_buf env;
|
||||
sigjmp_buf env;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -259,7 +259,7 @@ lock_restart_for_upgrade(RtldLockState *lockstate)
|
||||
case RTLD_LOCK_WLOCKED:
|
||||
break;
|
||||
case RTLD_LOCK_RLOCKED:
|
||||
longjmp(lockstate->env, 1);
|
||||
siglongjmp(lockstate->env, 1);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
Loading…
Reference in New Issue
Block a user