Do not set the pcb_ext field until the private TSS has been completely
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 28 Feb 2006 18:30:22 +0000 (18:30 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 28 Feb 2006 18:30:22 +0000 (18:30 +0000)
commitdf0118164e298366a3f564bd5b08405c93fb7907
treebb34735d6c3a910724454d4bcc5c7a05215df01b
parentaa0d550a72ba06d0d09c4009e3498be354315edb
Do not set the pcb_ext field until the private TSS has been completely
initialized, otherwise an interrupt can come along and preempt, then
attempt to restore using the incompletely initialized TSS.

Do not free the pcb_ext data until after we have switched back to
the common TSS, otherwise a blockage in kmem_free() may cause a
premature thread switch with the now invalid private TSS.

Do not depend on need_user_resched() to set a private TSS prior to returning
from a system call, it may optimize itself into a NOP and not actually set
the private TSS prior to our return to userland.  Instead, active the
new private TSS manually by doing a forced thread switch to ourselves.

Reported-by: Sascha Wildner <saw@online.de>
sys/i386/i386/sys_machdep.c
sys/i386/i386/vm_machdep.c
sys/platform/pc32/i386/sys_machdep.c
sys/platform/pc32/i386/vm_machdep.c