Uprobes executes the original instruction at a probed location out of
line. For this, we allocate a page (per mm) upon the first uprobe hit,
in the process' user address space, divide it into slots that are used
to store the actual instructions to be singlestepped.
Care is taken to ensure that the allocation is in an unmapped area as
close to the top of the user address space as possible, with appropriate
permission settings to keep selinux like frameworks happy.
Upon a uprobe hit, a free slot is acquired, and is released after the
singlestep completes.
[ Folded a fix for build issue on powerpc fixed and reported by Stephen
Rothwell]
Lots of improvements courtesy suggestions/inputs from Peter and Oleg.
Signed-off-by: Jim Keniston <jkenisto@us.ibm.com> Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>