diff options
author | netchild <netchild@FreeBSD.org> | 2007-02-23 22:39:26 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2007-02-23 22:39:26 +0000 |
commit | 902cc4aebabcbc802991bdb0b03f04e600fd8452 (patch) | |
tree | ee0d5379699a26a3d09a50992f83344be0588450 /sys/compat | |
parent | d0c562e57ca3e3905157ccbd79fa4efa843088c3 (diff) | |
download | FreeBSD-src-902cc4aebabcbc802991bdb0b03f04e600fd8452.zip FreeBSD-src-902cc4aebabcbc802991bdb0b03f04e600fd8452.tar.gz |
MFp4 (114193 (i386 part), 114194, 114195, 114200):
- Dont "return" in linux_clone() after we forked the new process in a case
of problems.
- Move the copyout of p2->p_pid outside the emul_lock coverage in
linux_clone().
- Cache the em->pdeath_signal in a local variable and move the copyout
out of the emul_lock coverage.
- Move the free() out of the emul_shared_lock coverage in a preparation
to switch emul_lock to non-sleepable lock (mutex).
Submitted by: rdivacky
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_emul.c | 12 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.c | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c index 2a42f70..c2f6db1 100644 --- a/sys/compat/linux/linux_emul.c +++ b/sys/compat/linux/linux_emul.c @@ -186,9 +186,11 @@ linux_proc_exit(void *arg __unused, struct proc *p) LIST_REMOVE(em, threads); em->shared->refs--; - if (em->shared->refs == 0) + if (em->shared->refs == 0) { + EMUL_SHARED_WUNLOCK(&emul_shared_lock); free(em->shared, M_LINUX); - EMUL_SHARED_WUNLOCK(&emul_shared_lock); + } else + EMUL_SHARED_WUNLOCK(&emul_shared_lock); if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; @@ -273,9 +275,11 @@ linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) PROC_UNLOCK(p); em->shared->refs--; - if (em->shared->refs == 0) + if (em->shared->refs == 0) { + EMUL_SHARED_WUNLOCK(&emul_shared_lock); free(em->shared, M_LINUX); - EMUL_SHARED_WUNLOCK(&emul_shared_lock); + } else + EMUL_SHARED_WUNLOCK(&emul_shared_lock); free(em, M_LINUX); } diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 02d86f9..f5504dc 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1642,6 +1642,7 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args) struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; struct linux_emuldata *em; + int pdeath_signal; #ifdef DEBUG if (ldebug(prctl)) @@ -1661,10 +1662,11 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args) case LINUX_PR_GET_PDEATHSIG: em = em_find(p, EMUL_DOLOCK); KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - error = copyout(&em->pdeath_signal, - (void *)(register_t)args->arg2, - sizeof(em->pdeath_signal)); + pdeath_signal = em->pdeath_signal; EMUL_UNLOCK(&emul_lock); + error = copyout(&pdeath_signal, + (void *)(register_t)args->arg2, + sizeof(pdeath_signal)); break; case LINUX_PR_SET_NAME: /* |