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 @@ ...@@ -22,7 +22,7 @@
#define PTRACE_EVENT_EXEC 4 #define PTRACE_EVENT_EXEC 4
#define PTRACE_EVENT_VFORK_DONE 5 #define PTRACE_EVENT_VFORK_DONE 5
#define PTRACE_EVENT_EXIT 6 #define PTRACE_EVENT_EXIT 6
#define PTRACE_EVENT_STOP 7 #define PTRACE_EVENT_STOP 128
#define PTRACE_O_TRACESYSGOOD 0x00000001 #define PTRACE_O_TRACESYSGOOD 0x00000001
#define PTRACE_O_TRACEFORK 0x00000002 #define PTRACE_O_TRACEFORK 0x00000002
......
...@@ -171,7 +171,7 @@ retry_signal: ...@@ -171,7 +171,7 @@ retry_signal:
goto err; goto err;
} }
if (siginfo.si_code >> 8 != PTRACE_EVENT_STOP) if (((siginfo.si_code & 0xffff) >> 8) != PTRACE_EVENT_STOP)
goto retry_signal; goto retry_signal;
/* /*
...@@ -218,7 +218,7 @@ retry_signal: ...@@ -218,7 +218,7 @@ retry_signal:
goto err; 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", pr_err("si_code doesn't match (pid: %d si_code: %d)\n",
pid, siginfo.si_code); pid, siginfo.si_code);
goto err; goto err;
......
...@@ -51,8 +51,7 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid) ...@@ -51,8 +51,7 @@ int seize_task(pid_t pid, pid_t ppid, pid_t *pgid, pid_t *sid)
int ret, ret2; int ret, ret2;
struct proc_pid_stat_small ps; struct proc_pid_stat_small ps;
ret = ptrace(PTRACE_SEIZE, pid, NULL, ret = ptrace(PTRACE_SEIZE, pid, NULL, 0);
(void *)(unsigned long)PTRACE_SEIZE_DEVEL);
/* /*
* It's ugly, but the ptrace API doesn't allow to distinguish * It's ugly, but the ptrace API doesn't allow to distinguish
...@@ -114,7 +113,7 @@ try_again: ...@@ -114,7 +113,7 @@ try_again:
goto err; 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 * Kernel notifies us about the task being seized received some
* event other than the STOP, i.e. -- a signal. Let the task * 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