aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ptrace.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-06-17 10:50:36 -0400
committerOleg Nesterov <oleg@redhat.com>2011-06-22 13:26:28 -0400
commitf3c04b934d429b1ace21866f011b66de328c0dc9 (patch)
tree16ac465b4f5294f71995554ca1e94913fdeda234 /include/linux/ptrace.h
parent643ad8388e189dfd14ef76972cf7dc394b3cbebd (diff)
ptrace: move SIGTRAP on exec(2) logic to ptrace_event()
Move SIGTRAP on exec(2) logic from tracehook_report_exec() to ptrace_event(). This is part of changes to make ptrace_event() smarter and handle ptrace event related details in one place. This doesn't introduce any behavior change. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'include/linux/ptrace.h')
-rw-r--r--include/linux/ptrace.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 18feac6f441e..b546fd6c3506 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -172,17 +172,17 @@ static inline bool ptrace_event_enabled(struct task_struct *task, int event)
172 * Check whether @event is enabled and, if so, report @event and @message 172 * Check whether @event is enabled and, if so, report @event and @message
173 * to the ptrace parent. 173 * to the ptrace parent.
174 * 174 *
175 * Returns nonzero if we did a ptrace notification, zero if not.
176 *
177 * Called without locks. 175 * Called without locks.
178 */ 176 */
179static inline int ptrace_event(int event, unsigned long message) 177static inline void ptrace_event(int event, unsigned long message)
180{ 178{
181 if (likely(!ptrace_event_enabled(current, event))) 179 if (unlikely(ptrace_event_enabled(current, event))) {
182 return false; 180 current->ptrace_message = message;
183 current->ptrace_message = message; 181 ptrace_notify((event << 8) | SIGTRAP);
184 ptrace_notify((event << 8) | SIGTRAP); 182 } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) {
185 return true; 183 /* legacy EXEC report via SIGTRAP */
184 send_sig(SIGTRAP, current, 0);
185 }
186} 186}
187 187
188/** 188/**