Date: Tue, 16 Aug 2005 18:20:21 GMT From: John Baldwin <jhb@FreeBSD.org> To: freebsd-i386@FreeBSD.org Subject: Re: i386/84842: i386_set_ioperm(2) timing issue Message-ID: <200508161820.j7GIKLP7073485@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/84842; it has been noted by GNATS. From: John Baldwin <jhb@FreeBSD.org> 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 <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508161820.j7GIKLP7073485>