Fix video playing and network connections in realplayer (and most likely

other stuff) in the osrelease=2.6.16 case:
 - implement CLONE_PARENT semantic
 - fix TLS loading in clone CLONE_SETTLS
 - lock proc in the currently disabled part of CLONE_THREAD

I suggest to not unload the linux module after testing this, there are
some "<defunct>" processes hanging around after exiting (they aren't
with osrelease=2.4.2) and they may panic your kernel when unloading the
linux module. They are in state Z and some of them consume CPU according
to ps. But I don't trust the CPU part, the idle threads gets too much CPU
that this may be possible (accumulating idle, X and 2 defunct processes
results in 104.7%, this looks to much to be a rounding error).

Noticed by:	Intron <mag@intron.ac>
Submitted by:	rdivacky (in collaboration with Intron)
Tested by:	Intron, netchild
Reviewed by:	jhb (previous version)
This commit is contained in:
netchild 2006-08-27 18:51:32 +00:00
parent ebafba1057
commit c1c941b5f5

View File

@ -414,24 +414,24 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
}
}
if (args->flags & CLONE_PARENT) {
#ifdef DEBUG
printf("linux_clone: CLONE_PARENT\n");
#endif
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.
*/
#ifdef notyet
PROC_LOCK(p2);
p2->p_pgrp = td->td_proc->p_pgrp;
p2->p_pptr = td->td_proc->p_pptr;
PROC_UNLOCK(p2);
#endif
exit_signal = 0;
#ifdef DEBUG
printf("linux_clone: CLONE_THREADS\n");
#endif
}
if (args->flags & CLONE_CHILD_SETTID)
@ -443,6 +443,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
em->child_clear_tid = args->child_tidptr;
else
em->child_clear_tid = NULL;
EMUL_UNLOCK(&emul_lock);
PROC_LOCK(p2);
@ -502,13 +503,9 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
sd.sd_gran);
#endif
/* this is taken from i386 version of cpu_set_user_tls() */
critical_enter();
/* set %gs */
td2->td_pcb->pcb_gsd = sd;
PCPU_GET(fsgs_gdt)[1] = sd;
load_gs(GSEL(GUGS_SEL, SEL_UPL));
critical_exit();
td2->td_pcb->pcb_gs = GSEL(GUGS_SEL, SEL_UPL);
}
#ifdef DEBUG