From owner-freebsd-i386@FreeBSD.ORG Tue Aug 16 18:20:22 2005 Return-Path: X-Original-To: freebsd-i386@hub.freebsd.org Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6BE9E16A420 for ; Tue, 16 Aug 2005 18:20:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 39B2D43D46 for ; Tue, 16 Aug 2005 18:20:22 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j7GIKMwq073486 for ; Tue, 16 Aug 2005 18:20:22 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j7GIKLP7073485; Tue, 16 Aug 2005 18:20:21 GMT (envelope-from gnats) Date: Tue, 16 Aug 2005 18:20:21 GMT Message-Id: <200508161820.j7GIKLP7073485@freefall.freebsd.org> To: freebsd-i386@FreeBSD.org From: John Baldwin Cc: Subject: Re: i386/84842: i386_set_ioperm(2) timing issue X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John Baldwin List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2005 18:20:22 -0000 The following reply was made to PR i386/84842; it has been noted by GNATS. From: John Baldwin To: bug-followup@FreeBSD.org, arundel@h3c.de Cc: bde@FreeBSD.org Subject: Re: i386/84842: i386_set_ioperm(2) timing issue Date: Tue, 16 Aug 2005 14:12:09 -0400 What about replacing the setting of TDF_NEEDRESCHED() in i386_extend_pcb() with a call to ltr()? Actually, it takes more work than a ltr() as you have to update the TSS descriptor in the GDT for the current CPU before you do the ltr(). Maybe something like this: Index: i386/sys_machdep.c =================================================================== RCS file: /usr/cvs/src/sys/i386/i386/sys_machdep.c,v retrieving revision 1.102 diff -u -r1.102 sys_machdep.c --- i386/sys_machdep.c 23 Jun 2005 21:56:45 -0000 1.102 +++ i386/sys_machdep.c 16 Aug 2005 18:08:49 -0000 @@ -267,9 +267,11 @@ KASSERT(td->td_pcb->pcb_ext == 0, ("already have a TSS!")); mtx_lock_spin(&sched_lock); td->td_pcb->pcb_ext = ext; - - /* switch to the new TSS after syscall completes */ - td->td_flags |= TDF_NEEDRESCHED; + + /* Switch to the new TSS. */ + private_tss |= PCPU_GET(cpumask); + *PCPU_GET(tss_gdt) = ext->ext_tssd; + ltr(GSEL(GPROC0_SEL, SEL_KPL)); mtx_unlock_spin(&sched_lock); return 0; Index: include/pcb_ext.h =================================================================== RCS file: /usr/cvs/src/sys/i386/include/pcb_ext.h,v retrieving revision 1.9 diff -u -r1.9 pcb_ext.h --- include/pcb_ext.h 20 Mar 2002 05:48:58 -0000 1.9 +++ include/pcb_ext.h 16 Aug 2005 18:10:11 -0000 @@ -44,6 +44,7 @@ }; #ifdef _KERNEL +int private_tss; int i386_extend_pcb(struct thread *); -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org