Fix LOR that occurs because proctree_lock was acquired while holding
emuldata lock by moving the code upwards outside the emul_lock coverage. Submitted by: rdivacky
This commit is contained in:
parent
84fbdf86b3
commit
a9ccaccfc3
@ -592,6 +592,14 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
|
||||
sx_xlock(&proctree_lock);
|
||||
PROC_LOCK(p2);
|
||||
proc_reparent(p2, td->td_proc->p_pptr);
|
||||
PROC_UNLOCK(p2);
|
||||
sx_xunlock(&proctree_lock);
|
||||
}
|
||||
|
||||
/* create the emuldata */
|
||||
error = linux_proc_init(td, p2->p_pid, args->flags);
|
||||
/* reference it - no need to check this */
|
||||
@ -610,14 +618,6 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
|
||||
}
|
||||
}
|
||||
|
||||
if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
|
||||
sx_xlock(&proctree_lock);
|
||||
PROC_LOCK(p2);
|
||||
proc_reparent(p2, td->td_proc->p_pptr);
|
||||
PROC_UNLOCK(p2);
|
||||
sx_xunlock(&proctree_lock);
|
||||
}
|
||||
|
||||
if (args->flags & CLONE_THREAD) {
|
||||
/* XXX: linux mangles pgrp and pptr somehow
|
||||
* I think it might be this but I am not sure.
|
||||
|
@ -439,6 +439,14 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
|
||||
sx_xlock(&proctree_lock);
|
||||
PROC_LOCK(p2);
|
||||
proc_reparent(p2, td->td_proc->p_pptr);
|
||||
PROC_UNLOCK(p2);
|
||||
sx_xunlock(&proctree_lock);
|
||||
}
|
||||
|
||||
/* create the emuldata */
|
||||
error = linux_proc_init(td, p2->p_pid, args->flags);
|
||||
/* reference it - no need to check this */
|
||||
@ -457,14 +465,6 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
|
||||
}
|
||||
}
|
||||
|
||||
if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
|
||||
sx_xlock(&proctree_lock);
|
||||
PROC_LOCK(p2);
|
||||
proc_reparent(p2, td->td_proc->p_pptr);
|
||||
PROC_UNLOCK(p2);
|
||||
sx_xunlock(&proctree_lock);
|
||||
}
|
||||
|
||||
if (args->flags & CLONE_THREAD) {
|
||||
/* XXX: linux mangles pgrp and pptr somehow
|
||||
* I think it might be this but I am not sure.
|
||||
|
Loading…
Reference in New Issue
Block a user