From 889a44cd0d14e98b9915c86e5a4b7de04f22de48 Mon Sep 17 00:00:00 2001 From: 5ec1cff Date: Sun, 12 Nov 2023 21:10:40 +0800 Subject: [PATCH] inject non-stop signal by default --- loader/src/ptracer/monitor.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/loader/src/ptracer/monitor.cpp b/loader/src/ptracer/monitor.cpp index ffe9935..482715c 100644 --- a/loader/src/ptracer/monitor.cpp +++ b/loader/src/ptracer/monitor.cpp @@ -234,12 +234,17 @@ public: LOGI("stop tracing init"); continue; } - // suppress - // TODO: inject signal if (WIFSTOPPED(status)) { if (WPTEVENT(status) == 0) { - LOGW("suppressed signal sent to init: %s %d", - sigabbrev_np(WSTOPSIG(status)), WSTOPSIG(status)); + if (WSTOPSIG(status) != SIGSTOP && WSTOPSIG(status) != SIGTSTP && WSTOPSIG(status) != SIGTTIN && WSTOPSIG(status) != SIGTTOU) { + LOGW("inject signal sent to init: %s %d", + sigabbrev_np(WSTOPSIG(status)), WSTOPSIG(status)); + ptrace(PTRACE_CONT, pid, 0, WSTOPSIG(status)); + } else { + LOGW("suppress stopping signal sent to init: %s %d", + sigabbrev_np(WSTOPSIG(status)), WSTOPSIG(status)); + } + continue; } ptrace(PTRACE_CONT, pid, 0, 0); }