freebsd-skq/sys/amd64/amd64
Bruce Evans a4b8c657a3 Use a critical region to protect pushing of the parent's npx state to the
pcb for fork().  It was possible for the state to be saved twice when an
interrupt handler saved it concurrently.  This corrupted (reset) the state
because fnsave has the (in)convenient side effect of doing an implicit
fninit.  Mundane null pointer bugs were not possible, because we save to
an "arbitrary" process's pcb and not to the "right" place (npxproc).

Push the parent's %gs to the pcb for fork().  Changes to %gs before
fork() were not preserved in the child unless an accidental context
switch did the pushing.  Updated the list of pcb contents which is
supposed to inhibit bugs like this.  pcb_dr*, pcb_gs and pcb_ext were
missing.  Copying is correct for pcb_dr*, and pcb_ext is already
handled specially (although XXX'ly).

Reducing the savectx() call to an npxsave() call in rev.1.80 was a
mistake.  The above bugs are duplicated in many places, including in
savectx() itself.

The arbitraryness of the parent process pointer for the fork()
subroutines, the pcb pointer for savectx(), and the save87 pointer
for npxsave(), is illusory.  These functions don't work "right" unless
the pointers are precisely curproc, curpcb, and the address of npxproc's
save87 area, respectively, although the special context in which they
are called allows savectx(&dumppcb) to sort of work and npxsave(&dummy)
to work.  cpu_fork() just doesn't work unless the parent process
pointer is curproc, or the caller has pushed %gs to the pcb, or %gs
happens to already be in the pcb.
2001-05-13 07:44:14 +00:00
..
amd64_mem.c Overhaul of the SMP code. Several portions of the SMP kernel support have 2001-04-27 19:28:25 +00:00
amd64-gdbstub.c Remove count for NSIO. The only places it was used it were incorrect. 2001-01-31 10:54:45 +00:00
apic_vector.S Overhaul of the SMP code. Several portions of the SMP kernel support have 2001-04-27 19:28:25 +00:00
atomic.c Introduce atomic_cmpset_int() and atomic_cmpset_long() from SMPng a 2000-09-06 11:21:14 +00:00
autoconf.c Revert consequences of changes to mount.h, part 2. 2001-04-29 02:45:39 +00:00
bios.c Remove stray #include "isa.h" 2001-01-29 08:33:55 +00:00
busdma_machdep.c - Catch up to the new swi API changes: 2001-02-09 17:46:35 +00:00
cpu_switch.S Remove the leading underscore from all symbols defined in x86 asm 2001-02-25 06:29:04 +00:00
db_disasm.c
db_interface.c - Split out the support for per-CPU data from the SMP code. UP kernels 2001-05-10 17:45:49 +00:00
db_trace.c - One can now specify the decimal pid of a process to trace as a parameter. 2001-04-09 21:43:45 +00:00
elf_machdep.c Change incorrect NULLs to 0s 1999-12-21 11:14:12 +00:00
exception.s Remove the leading underscore from all symbols defined in x86 asm 2001-02-25 06:29:04 +00:00
exception.S Remove the leading underscore from all symbols defined in x86 asm 2001-02-25 06:29:04 +00:00
fpu.c Fixed panics in npx exception handling. When using IRQ13 exception 2001-05-02 13:06:58 +00:00
genassym.c Revert consequences of changes to mount.h, part 2. 2001-04-29 02:45:39 +00:00
identcpu.c Stop doing runtime checking on i386 cpus for cpu class. The cpu is 2001-01-16 09:10:34 +00:00
in_cksum.c Ansify and fix warnings. 2000-09-29 16:53:39 +00:00
initcpu.c Switch from save/disable/restore_intr() to critical_enter/exit(). 2001-03-28 03:06:10 +00:00
legacy.c Use the MI ithread helper functions in the x86 interrupt code. 2001-02-09 17:47:44 +00:00
locore.s Kill the 4MB kernel limit dead. [I hope :-)]. 2001-03-15 05:10:06 +00:00
locore.S Kill the 4MB kernel limit dead. [I hope :-)]. 2001-03-15 05:10:06 +00:00
machdep.c Revert part of last commit. Instead of using %fs for KSD/TSD, we'll 2001-05-12 22:54:53 +00:00
mem.c Send the remains (such as I have located) of "block major numbers" to 2001-03-26 12:41:29 +00:00
mp_machdep.c Undo part of the tangle of having sys/lock.h and sys/mutex.h included in 2001-05-01 08:13:21 +00:00
mpboot.S Remove the leading underscore from all symbols defined in x86 asm 2001-02-25 06:29:04 +00:00
mptable.c Undo part of the tangle of having sys/lock.h and sys/mutex.h included in 2001-05-01 08:13:21 +00:00
nexus.c Use the MI ithread helper functions in the x86 interrupt code. 2001-02-09 17:47:44 +00:00
pmap.c Undo part of the tangle of having sys/lock.h and sys/mutex.h included in 2001-05-01 08:13:21 +00:00
prof_machdep.c Previous commit changing SYSCTL_HANDLER_ARGS violated KNF. 2000-07-04 11:25:35 +00:00
support.s Remove a leading underscore that prevented I386_CPU kernels from 2001-04-26 13:57:03 +00:00
support.S Remove a leading underscore that prevented I386_CPU kernels from 2001-04-26 13:57:03 +00:00
swtch.s Remove the leading underscore from all symbols defined in x86 asm 2001-02-25 06:29:04 +00:00
sys_machdep.c - Use sched_lock and critical regions to ensure that LDT updates are thread 2001-05-10 17:03:03 +00:00
trap.c Simplify the vm fault trap handling code a bit by using if-else instead of 2001-05-11 23:50:08 +00:00
tsc.c Add in a missing call to forward_hardclock() in the SMP case. 2001-04-28 01:37:44 +00:00
vm_machdep.c Use a critical region to protect pushing of the parent's npx state to the 2001-05-13 07:44:14 +00:00