diff options
-rw-r--r-- | include/linux/ptrace.h | 16 | ||||
-rw-r--r-- | include/linux/tracehook.h | 4 |
2 files changed, 9 insertions, 11 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 | */ |
179 | static inline int ptrace_event(int event, unsigned long message) | 177 | static 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 | /** |
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h index 7d38571b0c05..3b68aa842a92 100644 --- a/include/linux/tracehook.h +++ b/include/linux/tracehook.h | |||
@@ -201,9 +201,7 @@ static inline void tracehook_report_exec(struct linux_binfmt *fmt, | |||
201 | struct linux_binprm *bprm, | 201 | struct linux_binprm *bprm, |
202 | struct pt_regs *regs) | 202 | struct pt_regs *regs) |
203 | { | 203 | { |
204 | if (!ptrace_event(PTRACE_EVENT_EXEC, 0) && | 204 | ptrace_event(PTRACE_EVENT_EXEC, 0); |
205 | unlikely(current->ptrace & PT_PTRACED)) | ||
206 | send_sig(SIGTRAP, current, 0); | ||
207 | } | 205 | } |
208 | 206 | ||
209 | /** | 207 | /** |