Commit b749f4b1 authored by Pavel Emelyanov's avatar Pavel Emelyanov

ptrace: Fix to use new (final) SEIZE functionality

Since 3.4-rc the seize-devel flag is removed, the stop event
is renamed (great) and the way si_code should be parsed has
been fixed.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 32dc4c57
......@@ -22,7 +22,7 @@
#define PTRACE_EVENT_EXEC 4
#define PTRACE_EVENT_VFORK_DONE 5
#define PTRACE_EVENT_EXIT 6
#define PTRACE_EVENT_STOP 7
#define PTRACE_EVENT_STOP 128
#define PTRACE_O_TRACESYSGOOD 0x00000001
#define PTRACE_O_TRACEFORK 0x00000002
......
......@@ -171,7 +171,7 @@ retry_signal:
goto err;
}
if (siginfo.si_code >> 8 != PTRACE_EVENT_STOP)
if (((siginfo.si_code & 0xffff) >> 8) != PTRACE_EVENT_STOP)
goto retry_signal;
/*
......@@ -218,7 +218,7 @@ retry_signal:
goto err;
}
if (siginfo.si_code >> 8 != PTRACE_EVENT_STOP) {
if (((siginfo.si_code & 0xffff) >> 8) != PTRACE_EVENT_STOP) {
pr_err("si_code doesn't match (pid: %d si_code: %d)\n",
pid, siginfo.si_code);
goto err;
......
......@@ -51,8 +51,7 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
int ret, ret2;
struct proc_pid_stat_small ps;
ret = ptrace(PTRACE_SEIZE, pid, NULL,
(void *)(unsigned long)PTRACE_SEIZE_DEVEL);
ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
/*
* It's ugly, but the ptrace API doesn't allow to distinguish
......@@ -114,7 +113,7 @@ try_again:
goto err;
}
if ((si.si_code >> 8) != PTRACE_EVENT_STOP) {
if (((si.si_code & 0xffff)>> 8) != PTRACE_EVENT_STOP) {
/*
* Kernel notifies us about the task being seized received some
* event other than the STOP, i.e. -- a signal. Let the task
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment