)]}'
{
  "commit": "0e9f0a4abfd80f8adca624538d479d95159b16d8",
  "tree": "6b9910140f4755cd95970a5c559e8f00d60dfede",
  "parents": [
    "e3bd058f62896ec7a2c605ed62a0a811e9147947"
  ],
  "author": {
    "name": "Tejun Heo",
    "email": "tj@kernel.org",
    "time": "Wed Mar 23 10:37:01 2011 +0100"
  },
  "committer": {
    "name": "Tejun Heo",
    "email": "tj@kernel.org",
    "time": "Wed Mar 23 10:37:01 2011 +0100"
  },
  "message": "ptrace: Always put ptracee into appropriate execution state\n\nCurrently, __ptrace_unlink() wakes up the tracee iff it\u0027s in\nTASK_TRACED.  For unlinking from PTRACE_DETACH, this is correct as the\ntracee is guaranteed to be in TASK_TRACED or dead; however, unlinking\nalso happens when the ptracer exits and in this case the ptracee can\nbe in any state and ptrace might be left running even if the group it\nbelongs to is stopped.\n\nThis patch updates __ptrace_unlink() such that GROUP_STOP_PENDING is\nreinstated regardless of the ptracee\u0027s current state as long as it\u0027s\nalive and makes sure that signal_wake_up() is called if execution\nstate transition is necessary.\n\nTest case follows.\n\n  #include \u003cunistd.h\u003e\n  #include \u003ctime.h\u003e\n  #include \u003csys/types.h\u003e\n  #include \u003csys/ptrace.h\u003e\n  #include \u003csys/wait.h\u003e\n\n  static const struct timespec ts1s \u003d { .tv_sec \u003d 1 };\n\n  int main(void)\n  {\n\t  pid_t tracee;\n\t  siginfo_t si;\n\n\t  tracee \u003d fork();\n\t  if (tracee \u003d\u003d 0) {\n\t\t  while (1) {\n\t\t\t  nanosleep(\u0026ts1s, NULL);\n\t\t\t  write(1, \".\", 1);\n\t\t  }\n\t  }\n\n\t  ptrace(PTRACE_ATTACH, tracee, NULL, NULL);\n\t  waitid(P_PID, tracee, \u0026si, WSTOPPED);\n\t  ptrace(PTRACE_CONT, tracee, NULL, (void *)(long)si.si_status);\n\t  waitid(P_PID, tracee, \u0026si, WSTOPPED);\n\t  ptrace(PTRACE_CONT, tracee, NULL, (void *)(long)si.si_status);\n\t  write(1, \"exiting\", 7);\n\t  return 0;\n  }\n\nBefore the patch, after the parent process exits, the child is left\nrunning and prints out \".\" every second.\n\n  exiting..... (continues)\n\nAfter the patch, the group stop initiated by the implied SIGSTOP from\nPTRACE_ATTACH is re-established when the parent exits.\n\n  exiting\n\nSigned-off-by: Tejun Heo \u003ctj@kernel.org\u003e\nReported-by: Oleg Nesterov \u003coleg@redhat.com\u003e\nAcked-by: Oleg Nesterov \u003coleg@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e6098434b5335090f91e831f97bd8de42d9d0fea",
      "old_mode": 33188,
      "old_path": "kernel/ptrace.c",
      "new_id": "43485866749ade678fd613ececdd973914ebc670",
      "new_mode": 33188,
      "new_path": "kernel/ptrace.c"
    }
  ]
}
