From owner-p4-projects@FreeBSD.ORG Wed Feb 7 18:28:31 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D539616A402; Wed, 7 Feb 2007 18:28:30 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B0CB16A400 for ; Wed, 7 Feb 2007 18:28:30 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 5A9A313C471 for ; Wed, 7 Feb 2007 18:28:30 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l17ISUGO036230 for ; Wed, 7 Feb 2007 18:28:30 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l17ISTsb036227 for perforce@freebsd.org; Wed, 7 Feb 2007 18:28:29 GMT (envelope-from rdivacky@FreeBSD.org) Date: Wed, 7 Feb 2007 18:28:29 GMT Message-Id: <200702071828.l17ISTsb036227@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 114193 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Feb 2007 18:28:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=114193 Change 114193 by rdivacky@rdivacky_witten on 2007/02/07 18:27:32 Dont "return" in linux_clone() after we forked the new process in a case of problems. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#34 edit .. //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#28 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#34 (text+ko) ==== @@ -610,6 +610,10 @@ if ((args->flags & 0xffffff00) == THREADING_FLAGS) ff |= RFTHREAD; + if (args->flags & CLONE_PARENT_SETTID) + if (args->parent_tidptr == NULL) + return (EINVAL); + error = fork1(td, ff, 0, &p2); if (error) return (error); @@ -629,15 +633,9 @@ KASSERT(em != NULL, ("clone: emuldata not found.\n")); /* and adjust it */ if (args->flags & CLONE_PARENT_SETTID) { - if (args->parent_tidptr == NULL) { - EMUL_UNLOCK(&emul_lock); - return (EINVAL); - } error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid)); - if (error) { - EMUL_UNLOCK(&emul_lock); - return (error); - } + if (error) + printf(LMSG("copyout failed!")); } if (args->flags & CLONE_THREAD) { @@ -679,52 +677,56 @@ int idx; error = copyin((void *)td->td_frame->tf_rsi, &info, sizeof(struct l_user_desc)); - if (error) - return (error); + if (error) { + printf(LMSG("copyin failed!")); + } else { - idx = info.entry_number; + idx = info.entry_number; - /* - * looks like we're getting the idx we returned - * in the set_thread_area() syscall - */ - if (idx != 6 && idx != GUGS32_SEL) - return (EINVAL); + /* + * looks like we're getting the idx we returned + * in the set_thread_area() syscall + */ + if (idx != 6 && idx != GUGS32_SEL) { + printf(LMSG("resetting idx!")); + idx = 6; /* or GUGS32_SEL? */ + } - /* this doesnt happen in practice */ - if (idx == 6) { - /* we might copy out the entry_number as GUGS32_SEL */ - info.entry_number = GUGS32_SEL; - error = copyout(&info, (void *) td->td_frame->tf_rsi, sizeof(struct l_user_desc)); - if (error) - return (error); - } + /* this doesnt happen in practice */ + if (idx == 6) { + /* we might copy out the entry_number as GUGS32_SEL */ + info.entry_number = GUGS32_SEL; + error = copyout(&info, (void *) td->td_frame->tf_rsi, sizeof(struct l_user_desc)); + if (error) + printf(LMSG("copyout failed!")); + } - a[0] = LDT_entry_a(&info); - a[1] = LDT_entry_b(&info); + a[0] = LDT_entry_a(&info); + a[1] = LDT_entry_b(&info); - memcpy(&sd, &a, sizeof(a)); + memcpy(&sd, &a, sizeof(a)); #ifdef DEBUG - if (ldebug(clone)) - printf("Segment created in clone with CLONE_SETTLS: " - "lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, " - "type: %i, dpl: %i, p: %i, xx: %i, long: %i, " - "def32: %i, gran: %i\n", - sd.sd_lobase, - sd.sd_hibase, - sd.sd_lolimit, - sd.sd_hilimit, - sd.sd_type, - sd.sd_dpl, - sd.sd_p, - sd.sd_xx, - sd.sd_long, - sd.sd_def32, - sd.sd_gran); + if (ldebug(clone)) + printf("Segment created in clone with CLONE_SETTLS: " + "lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, " + "type: %i, dpl: %i, p: %i, xx: %i, long: %i, " + "def32: %i, gran: %i\n", + sd.sd_lobase, + sd.sd_hibase, + sd.sd_lolimit, + sd.sd_hilimit, + sd.sd_type, + sd.sd_dpl, + sd.sd_p, + sd.sd_xx, + sd.sd_long, + sd.sd_def32, + sd.sd_gran); #endif - td2->td_pcb->pcb_gsbase = (register_t)info.base_addr; - td2->td_pcb->pcb_gs32p = (caddr_t)&gdt[GUGS32_SEL]; - memcpy(&td2->td_pcb->pcb_gs32sd, &sd, sizeof(sd)); + td2->td_pcb->pcb_gsbase = (register_t)info.base_addr; + td2->td_pcb->pcb_gs32p = (caddr_t)&gdt[GUGS32_SEL]; + memcpy(&td2->td_pcb->pcb_gs32sd, &sd, sizeof(sd)); + } } #ifdef DEBUG ==== //depot/projects/linuxolator/src/sys/i386/linux/linux_machdep.c#28 (text+ko) ==== @@ -423,6 +423,10 @@ if ((args->flags & 0xffffff00) == THREADING_FLAGS) ff |= RFTHREAD; + if (args->flags & CLONE_PARENT_SETTID) + if (args->parent_tidptr == NULL) + return (EINVAL); + error = fork1(td, ff, 0, &p2); if (error) return (error); @@ -442,15 +446,9 @@ KASSERT(em != NULL, ("clone: emuldata not found.\n")); /* and adjust it */ if (args->flags & CLONE_PARENT_SETTID) { - if (args->parent_tidptr == NULL) { - EMUL_UNLOCK(&emul_lock); - return (EINVAL); - } error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid)); - if (error) { - EMUL_UNLOCK(&emul_lock); - return (error); - } + if (error) + printf(LMSG("copyout failed!")); } if (args->flags & CLONE_THREAD) { @@ -492,34 +490,37 @@ struct segment_descriptor sd; error = copyin((void *)td->td_frame->tf_esi, &info, sizeof(struct l_user_desc)); - if (error) - return (error); + if (error) { + printf(LMSG("copyin failed!")); + } else { - idx = info.entry_number; + idx = info.entry_number; - /* - * looks like we're getting the idx we returned - * in the set_thread_area() syscall - */ - if (idx != 6 && idx != 3) - return (EINVAL); + /* + * looks like we're getting the idx we returned + * in the set_thread_area() syscall + */ + if (idx != 6 && idx != 3) { + printf(LMSG("resetting idx!")); + idx = 3; + } - /* this doesnt happen in practice */ - if (idx == 6) { - /* we might copy out the entry_number as 3 */ - info.entry_number = 3; - error = copyout(&info, (void *) td->td_frame->tf_esi, sizeof(struct l_user_desc)); - if (error) - return (error); - } + /* this doesnt happen in practice */ + if (idx == 6) { + /* we might copy out the entry_number as 3 */ + info.entry_number = 3; + error = copyout(&info, (void *) td->td_frame->tf_esi, sizeof(struct l_user_desc)); + if (error) + printf(LMSG("copyout failed!")); + } - a[0] = LDT_entry_a(&info); - a[1] = LDT_entry_b(&info); + a[0] = LDT_entry_a(&info); + a[1] = LDT_entry_b(&info); - memcpy(&sd, &a, sizeof(a)); + memcpy(&sd, &a, sizeof(a)); #ifdef DEBUG - if (ldebug(clone)) - printf("Segment created in clone with CLONE_SETTLS: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase, + if (ldebug(clone)) + printf("Segment created in clone with CLONE_SETTLS: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase, sd.sd_hibase, sd.sd_lolimit, sd.sd_hilimit, @@ -531,9 +532,10 @@ sd.sd_gran); #endif - /* set %gs */ - td2->td_pcb->pcb_gsd = sd; - td2->td_pcb->pcb_gs = GSEL(GUGS_SEL, SEL_UPL); + /* set %gs */ + td2->td_pcb->pcb_gsd = sd; + td2->td_pcb->pcb_gs = GSEL(GUGS_SEL, SEL_UPL); + } } #ifdef DEBUG