Commit b1845ff5 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

ptrace: don't send SIGTRAP on exec if SEIZED

ptrace_event(PTRACE_EVENT_EXEC) sends SIGTRAP if PT_TRACE_EXEC is not
set.  This is because this SIGTRAP predates PTRACE_O_TRACEEXEC option,
we do not need/want this with PT_SEIZED which can set the options during
attach.
Suggested-by: default avatarPedro Alves <palves@redhat.com>
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Chris Evans <scarybeasts@gmail.com>
Cc: Indan Zupancic <indan@nul.nu>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Pedro Alves <palves@redhat.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 15cab952
...@@ -199,8 +199,9 @@ static inline void ptrace_event(int event, unsigned long message) ...@@ -199,8 +199,9 @@ static inline void ptrace_event(int event, unsigned long message)
if (unlikely(ptrace_event_enabled(current, event))) { if (unlikely(ptrace_event_enabled(current, event))) {
current->ptrace_message = message; current->ptrace_message = message;
ptrace_notify((event << 8) | SIGTRAP); ptrace_notify((event << 8) | SIGTRAP);
} else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) { } else if (event == PTRACE_EVENT_EXEC) {
/* legacy EXEC report via SIGTRAP */ /* legacy EXEC report via SIGTRAP */
if ((current->ptrace & (PT_PTRACED|PT_SEIZED)) == PT_PTRACED)
send_sig(SIGTRAP, current, 0); send_sig(SIGTRAP, current, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment