summaryrefslogtreecommitdiff
path: root/include/linux/tracehook.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-07-25 19:45:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-26 12:00:09 -0700
commitfa8e26ccd485216fc45c8c2dd1ec3b7ef1a0a2f8 (patch)
treeb6c3059593d7d185aaf7f5b69c363a48b18c5bb1 /include/linux/tracehook.h
parent0d094efeb1e98010c6b99923f1eb7e17bf1e3a74 (diff)
downloadlwn-fa8e26ccd485216fc45c8c2dd1ec3b7ef1a0a2f8.tar.gz
lwn-fa8e26ccd485216fc45c8c2dd1ec3b7ef1a0a2f8.zip
tracehook: tracehook_expect_breakpoints
This adds tracehook_expect_breakpoints() as a formal hook for the nommu code to use for its, "Is text-poking likely?" check at mmap time. This names the actual semantics the code means to test, and documents it. Signed-off-by: Roland McGrath <roland@redhat.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Reviewed-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/tracehook.h')
-rw-r--r--include/linux/tracehook.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6468ca0fe69b..e113e09b0341 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -52,6 +52,21 @@
struct linux_binprm;
/**
+ * tracehook_expect_breakpoints - guess if task memory might be touched
+ * @task: current task, making a new mapping
+ *
+ * Return nonzero if @task is expected to want breakpoint insertion in
+ * its memory at some point. A zero return is no guarantee it won't
+ * be done, but this is a hint that it's known to be likely.
+ *
+ * May be called with @task->mm->mmap_sem held for writing.
+ */
+static inline int tracehook_expect_breakpoints(struct task_struct *task)
+{
+ return (task_ptrace(task) & PT_PTRACED) != 0;
+}
+
+/**
* tracehook_unsafe_exec - check for exec declared unsafe due to tracing
* @task: current task doing exec
*