From: Michal Sojka Date: Wed, 27 Sep 2017 08:59:54 +0000 (+0200) Subject: utrace: Start the tracee only after uloop initialization X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=commitdiff_plain;h=260a4cd046c64bf8794db2431913c1b4a4ee4800 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 --- 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);