]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dtrace: update getufpstack implementation to be safer
authorKris Van Hees <kris.van.hees@oracle.com>
Thu, 10 Oct 2013 20:17:13 +0000 (16:17 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Thu, 10 Oct 2013 20:33:31 +0000 (16:33 -0400)
commit00bf80af37248521fb6f24165dd2290bdc34e878
treed31d9d72862c00128c56720c26e684ec2e56c070
parent1e6c9a5bcbfde68912704174860aecf32c902a40
dtrace: update getufpstack implementation to be safer

The dtrace_getufpstack() function was a death trap when called for cases where
current happened to be in a transitional state (no mm) or a kthread.  It was
also using find_vma() when that was not quite necessary.  Finally, it was not
correctly using the saved stack pointer from userspace correctly (in one place
it used old_rsp as appropriate, but in another p->thread.usersp).  The code
has been rewritten to make use of the fact that the only valid stack addresses
that can be in use when this function is called must appear between the current
stack pointer position (old_rsp) and the bottom of the stack (mm->start_stack).
Therefore, no vma is necessary anymore.

The new implementation also ensures that when there is no mm, or we're dealing
with a kthread, the resulting data is still formatted correctly, i.e. with a
PID in the first slot, and zeros in all other slots.

This commit effectively builds on top of the fix applied by Nick Alcock.

Orabug: 17591351

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
dtrace/dtrace_isa.c