)]}'
{
  "commit": "15e5ecdcd7ea69e63387346bd235fbeb3e3597df",
  "tree": "6b76e9c0bebb43617f2f90e9603e8e667f47224c",
  "parents": [
    "f7a95c879e3c1b0be90f539279946fd28970fe86"
  ],
  "author": {
    "name": "Bart Van Assche",
    "email": "bvanassche@google.com",
    "time": "Wed Oct 19 12:56:10 2022 -0700"
  },
  "committer": {
    "name": "Bart Van Assche",
    "email": "bvanassche@google.com",
    "time": "Thu Nov 10 09:08:21 2022 -0800"
  },
  "message": "init: Fix a race condition in KillProcessGroup()\n\nMultiple tests in CtsInitTestCases, e.g. RebootTest#StopServicesSIGKILL,\ncan trigger the following race condition:\n* A service is started. This involves calling fork() and also to call\n  RunService() in the child process. RunService() calls setpgid().\n* Service::Stop() is called and calls KillProcessGroup().\n  KillProcessGroup() calls kill(-pgid, SIGKILL) before the child process\n  has called setpgid(). pgid is the process ID of the child process. The\n  kill() call fails because setpgid() has not yet been called.\n\nFix this race condition by adding a setpgid() call in the parent process\nand by waiting from the parent until the child has called setsid() if a\nconsole is attached.\n\nBug: 213617178\nTest: Cuttlefish + atest \u0027CtsInitTestCases\u0027\nChange-Id: I6931cd579e607c247b4f79a5b375455ca3d52e29\nSigned-off-by: Bart Van Assche \u003cbvanassche@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c260c0713c93c1aefbab15870c593f39b2161f9b",
      "old_mode": 33188,
      "old_path": "init/service.cpp",
      "new_id": "85ac2fc90bf3f7af8716f28bbacbc872e2f82a99",
      "new_mode": 33188,
      "new_path": "init/service.cpp"
    },
    {
      "type": "modify",
      "old_id": "b2c9909ed44779dc98bb1dfd501c139b3db7d15d",
      "old_mode": 33188,
      "old_path": "init/service.h",
      "new_id": "2c2778dd6d6fec62cd562fc19cec1741aff1a64a",
      "new_mode": 33188,
      "new_path": "init/service.h"
    },
    {
      "type": "modify",
      "old_id": "a14969e9862f471e5bc3238ce0ceace31140cb72",
      "old_mode": 33188,
      "old_path": "init/service_utils.cpp",
      "new_id": "9585d056ec6f2a10073b11fa380c0fdec7574c96",
      "new_mode": 33188,
      "new_path": "init/service_utils.cpp"
    },
    {
      "type": "modify",
      "old_id": "65a2012ffadf5b394725d5d47058b28a00de6fa6",
      "old_mode": 33188,
      "old_path": "init/service_utils.h",
      "new_id": "c66f2b48a841813430d581e9cfa9c270c3833fb4",
      "new_mode": 33188,
      "new_path": "init/service_utils.h"
    }
  ]
}
