kernel - Make pcb_onfault more robust.
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 11 Oct 2012 19:12:25 +0000 (12:12 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 11 Oct 2012 19:12:25 +0000 (12:12 -0700)
commit93ad6da25762a0c741b5f653bdd58afe310c4899
tree7c6ac57c681ad5ce37580ea26a3e58234ca4748c
parent30277d08ae734bc94f1b2b52f967d0e386ef23f2
kernel - Make pcb_onfault more robust.

* Record the expected kernel stack pointer along with the pcb_onfault
  action.  Adjust the trap code to only take the action if the frame's
  stack pointer matches the recorded expected stack pointer.

  Otherwise this might be a recursive trap and we definitely do NOT want
  to execute the on-fault stuff in that situation.

* Prior to these changes recursive traps during uiomove()s could result
  in a kernel stack so corrupt that finding the actual cause of the panic
  becomes impossible.  This is believed to be making life difficult for us
  trying to track down a particular i386 panic.

* On x86-64 we had to increase the size of the pcb structure.  kgdb on
  kernel cores and live kernels will be effected (needs recompile).
12 files changed:
sys/kern/lwkt_ipiq.c
sys/platform/pc32/i386/bcopy.s
sys/platform/pc32/i386/genassym.c
sys/platform/pc32/i386/support.s
sys/platform/pc32/i386/trap.c
sys/platform/pc32/i386/vm_machdep.c
sys/platform/pc32/include/pcb.h
sys/platform/pc64/include/pcb.h
sys/platform/pc64/x86_64/genassym.c
sys/platform/pc64/x86_64/support.s
sys/platform/pc64/x86_64/trap.c
sys/platform/pc64/x86_64/vm_machdep.c