From 260a4cd046c64bf8794db2431913c1b4a4ee4800 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 27 Sep 2017 10:59:54 +0200 Subject: [PATCH] utrace: Start the tracee only after uloop initialization Without this, early ptrace stops can be missed because they can happen before the call to uloop_init(). Signed-off-by: Michal Sojka --- trace/trace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trace/trace.c b/trace/trace.c index d022079..76b6b7f 100644 --- a/trace/trace.c +++ b/trace/trace.c @@ -342,6 +342,9 @@ int main(int argc, char **argv, char **envp) return -1; } + /* Initialize uloop to catch all ptrace stops from now on. */ + uloop_init(); + int ptrace_options = PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK | PTRACE_O_TRACECLONE; switch (mode) { case UTRACE: @@ -362,7 +365,6 @@ int main(int argc, char **argv, char **envp) return -1; } - uloop_init(); tracer.proc.pid = child; tracer.proc.cb = tracer_cb; uloop_process_add(&tracer.proc); -- 2.30.2