[LEDE-DEV] [PATCH procd 18/18] utrace: Start the tracee only after uloop initialization

Michal Sojka sojkam1 at fel.cvut.cz
Wed Sep 27 01:59:54 PDT 2017


Without this, early ptrace stops can be missed because they can happen
before the call to uloop_init().

Signed-off-by: Michal Sojka <sojkam1 at fel.cvut.cz>
---
 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.14.1




More information about the Lede-dev mailing list