kernel - Fix race between procfs / proc sysctls and exec, refactor PHOLD/etc
* During a [v]fork/exec sequence the exec will replace the VM space of the
target process. A concurrent 'ps' operation could access the target
process's vmspace as it was being ripped out, resulting in memory
corruption.
* The P_INEXEC test in procfs was insufficient, the exec code itself must
also wait for procfs's PHOLD() on the process to go away before it can
proceed. This should properly interlock the entire operation.
* Can occur with procfs or non-procfs ps's (via proc sysctls).
* Possibly related to the seg-fault issue we have where the user stack gets
corrupted.
* Also revamp PHOLD()/PRELE() and add PSTALL(), changing all manual while()
loops waiting on p->p_lock to use PSTALL().
These functions now integrate a wakeup request flag into p->p_lock
using atomic ops and no longer tsleep() for 1 tick (or hz ticks, or
whatever). Wakeups are issued proactively.