aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author启瑞 <qirui.001@bytedance.com>2022-04-25 10:17:37 +0800
committerTony Luck <tony.luck@intel.com>2022-04-25 09:17:35 -0700
commit596cddca9d4328d548ca6673ded2732b65665b57 (patch)
tree0cd6d8da26d397d0240f8a55901d2da034485e99
parent6b9ba1649d053505a67db5bc70f00a8d390cb553 (diff)
downloadras-tools-596cddca9d4328d548ca6673ded2732b65665b57.tar.gz
hornet: fix the missed page offine when ptrace detached
When we detached the pftraced process, we miss out isolating the poisoned page. Adding a goto statement to make sure this. Signed-off-by: 启瑞 <qirui.001@bytedance.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--hornet.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hornet.c b/hornet.c
index dea8c0c..02f985d 100644
--- a/hornet.c
+++ b/hornet.c
@@ -209,6 +209,7 @@ int main(int argc, char **argv)
int status;
long lo, hi, phys, virt;
struct user_regs_struct regs;
+ int ret = 0;
progname = argv[0];
@@ -265,11 +266,12 @@ int main(int argc, char **argv)
if (trace) {
sleep(1);
check_ptrace(PTRACE_DETACH, pid, NULL, NULL);
- return 0;
+ goto end;
}
if (kill(pid, SIGCONT) == -1) {
fprintf(stderr, "%s: cannot resume process\n", progname);
- return 1;
+ ret = 1;
+ goto end;
}
if (pflag) {
while (kill(pid, 0) != -1)
@@ -280,6 +282,8 @@ int main(int argc, char **argv)
if (WIFSIGNALED(status) && WTERMSIG(status) == SIGBUS)
printf("%s: process terminated by SIGBUS\n", progname);
}
+
+end:
wfile("/sys/devices/system/memory/hard_offline_page", phys);
- return 0;
+ return ret;
}