)]}'
{
  "log": [
    {
      "commit": "11859d467c035081f8acafeaf0184b670cd41c48",
      "tree": "36afb3b9c9bbff69d83945e7ab08b7687908f74c",
      "parents": [
        "132768084e24119c337e56fd110b97a23e5593c2"
      ],
      "author": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Mon Feb 13 17:59:29 2017 -0800"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Mon Feb 13 17:59:29 2017 -0800"
      },
      "message": "Be more strict about using invalid `pthread_t`s.\n\nAnother release, another attempt to remove the global thread list.\n\nBut this time, let\u0027s admit that it\u0027s not going away. We can switch to using\na read/write lock for the global thread list, and to aborting rather than\nquietly returning ESRCH if we\u0027re given an invalid pthread_t.\n\nThis change affects pthread_detach, pthread_getcpuclockid,\npthread_getschedparam/pthread_setschedparam, pthread_join, and pthread_kill:\ninstead of returning ESRCH when passed an invalid pthread_t, if you\u0027re\ntargeting O or above, they\u0027ll abort with the message \"attempt to use\ninvalid pthread_t\".\n\nNote that this doesn\u0027t change behavior as much as you might think: the old\nlookup only held the global thread list lock for the duration of the lookup,\nso there was still a race between that and the dereference in the caller,\ngiven that callers actually need the tid to pass to some syscall or other,\nand sometimes update fields in the pthread_internal_t struct too.\n\n(This patch replaces such users with calls to pthread_gettid_np, which\nat least makes the TOCTOU window smaller.)\n\nWe can\u0027t check thread-\u003etid against 0 to see whether a pthread_t is still\nvalid because a dead thread gets its thread struct unmapped along with its\nstack, so the dereference isn\u0027t safe.\n\nTaking the affected functions one by one:\n\n    * pthread_getcpuclockid and pthread_getschedparam/pthread_setschedparam\n      should be fine. Unsafe calls to those seem highly unlikely.\n\n    * Unsafe pthread_detach callers probably want to switch to\n      pthread_attr_setdetachstate instead, or using\n      pthread_detach(pthread_self()) from the new thread\u0027s start routine\n      rather than doing the detach in the parent.\n\n    * pthread_join calls should be safe anyway, because a joinable thread\n      won\u0027t actually exit and unmap until it\u0027s joined. If you\u0027re joining an\n      unjoinable thread, the fix is to stop marking it detached. If you\u0027re\n      joining an already-joined thread, you need to rethink your design.\n\n    * Unsafe pthread_kill calls aren\u0027t portably fixable. (And are obviously\n      inherently non-portable as-is.) The best alternative on Android is to\n      use pthread_gettid_np at some point that you know the thread to be\n      alive, and then call kill/tgkill directly.\n\n      That\u0027s still not completely safe because if you\u0027re too late, the tid\n      may have been reused, but then your code is inherently unsafe anyway.\n\nBug: http://b/19636317\nTest: ran tests\nChange-Id: I0372c4428e8a7f1c3af5c9334f5d9c25f2c73f21\n"
    },
    {
      "commit": "bcb152903a26269e2c8ada3b27c787ae875f8812",
      "tree": "7bd88d5a8cde6ac54c1af51a11f5932988ce9215",
      "parents": [
        "f5a4992b7186c01b98cb9400b2b5b490805a87bb"
      ],
      "author": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Tue Feb 07 21:05:30 2017 +0000"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Tue Feb 07 21:05:30 2017 +0000"
      },
      "message": "Revert \"Stop checking the global thread list in several trivial cases.\"\n\nThis reverts commit f5a4992b7186c01b98cb9400b2b5b490805a87bb.\n\nBreaks OMX_ImgEnc in cameraserver (http://b/35088254).\n\nChange-Id: I6dcf12706a184b0b8b72451584567a42dfa1bb4f\n"
    },
    {
      "commit": "f5a4992b7186c01b98cb9400b2b5b490805a87bb",
      "tree": "5e0da95bd6edc7fb861bf0130fcfab4997a9141a",
      "parents": [
        "4a47d2c436e93caff08fb112f39bb24145950279"
      ],
      "author": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Mon Feb 06 14:09:53 2017 -0800"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Mon Feb 06 14:09:53 2017 -0800"
      },
      "message": "Stop checking the global thread list in several trivial cases.\n\nSince removing the global thread is hard, let\u0027s take the different\ngroups of functions individually.\n\nThe existing code was racy anyway, because the thread might still be\non the list but have exited (leaving tid \u003d\u003d 0).\n\nBug: http://b/19636317\nTest: ran tests\nChange-Id: Icc0986ff124d5f9b8a653edf718c549d1563973b\n"
    },
    {
      "commit": "7484c21c4c352a2200d94939fabc10d1bd3f0723",
      "tree": "fe089ec40970a76f11107534632b1fc5789660ed",
      "parents": [
        "b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5"
      ],
      "author": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Thu Feb 02 02:41:38 2017 +0000"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Thu Feb 02 02:41:38 2017 +0000"
      },
      "message": "Revert \"Remove the global thread list.\"\n\nThis reverts commit b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5.\n\nBreaks swiftshader (http:/b/34883464).\n\nChange-Id: I7b21193ba8a78f07d7ac65e41d0fe8516940a83b\n"
    },
    {
      "commit": "b0e8c565a622b5519e03d4416b0b5b1a5f20d7f5",
      "tree": "8362f2754276b72e79a652885be7379127ca6e07",
      "parents": [
        "fb07c36bc061db4ca5d8348ff6bc1e60b6c53191"
      ],
      "author": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Wed Jan 04 14:12:54 2017 -0800"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Sat Jan 07 14:16:46 2017 -0800"
      },
      "message": "Remove the global thread list.\n\nAnother release, another attempt to fix this bug.\n\nThis change affects pthread_detach, pthread_getcpuclockid,\npthread_getschedparam/pthread_setschedparam, pthread_join, and pthread_kill:\ninstead of returning ESRCH when passed an invalid pthread_t, they\u0027ll now SEGV.\n\nNote that this doesn\u0027t change behavior as much as you might think: the old\nlookup only held the global thread list lock for the duration of the lookup,\nso there was still a race between that and the dereference in the caller,\ngiven that callers actually need the tid to pass to some syscall or other,\nand sometimes update fields in the pthread_internal_t struct too.\n\nWe can\u0027t check thread-\u003etid against 0 to see whether a pthread_t is still\nvalid because a dead thread gets its thread struct unmapped along with its\nstack, so the dereference isn\u0027t safe.\n\nTaking the affected functions one by one:\n\n* pthread_getcpuclockid and pthread_getschedparam/pthread_setschedparam\n  should be fine. Unsafe calls to those seem highly unlikely.\n\n* Unsafe pthread_detach callers probably want to switch to\n  pthread_attr_setdetachstate instead, or using pthread_detach(pthread_self())\n  from the new thread\u0027s start routine rather than doing the detach in the\n  parent.\n\n* pthread_join calls should be safe anyway, because a joinable thread won\u0027t\n  actually exit and unmap until it\u0027s joined. If you\u0027re joining an\n  unjoinable thread, the fix is to stop marking it detached. If you\u0027re\n  joining an already-joined thread, you need to rethink your design.\n\n* Unsafe pthread_kill calls aren\u0027t portably fixable. (And are obviously\n  inherently non-portable as-is.) The best alternative on Android is to\n  use pthread_gettid_np at some point that you know the thread to be alive,\n  and then call kill/tgkill directly. That\u0027s still not completely safe\n  because if you\u0027re too late, the tid may have been reused, but then your\n  code is inherently unsafe anyway.\n\nIf we find too much code is still broken, we can come back and disable\nthe global thread list lookups for anything targeting \u003e\u003d O and then have\nanother go at really removing this in P...\n\nBug: http://b/19636317\nTest: N6P boots, bionic tests pass\nChange-Id: Ia92641212f509344b99ee2a9bfab5383147fcba6\n"
    },
    {
      "commit": "673b15e4ee2c6d99b150aedddc0f389e29f98e1b",
      "tree": "edc101b54c689960bdf1262e6378b21082d3e277",
      "parents": [
        "4149dc944bbe3c5f1c14fc998106975e68bdd6bf"
      ],
      "author": {
        "name": "Yabin Cui",
        "email": "yabinc@google.com",
        "time": "Thu Mar 19 14:19:19 2015 -0700"
      },
      "committer": {
        "name": "Yabin Cui",
        "email": "yabinc@google.com",
        "time": "Mon Mar 23 19:03:49 2015 -0700"
      },
      "message": "Let g_thread_list_lock only protect g_thread_list.\n\nAs glibc/netbsd don\u0027t protect access to thread struct members by a global\nlock, we don\u0027t want to do it either. This change reduces the\nresponsibility of g_thread_list_lock to only protect g_thread_list.\n\nBug: 19636317\nChange-Id: I897890710653dac165d8fa4452c7ecf74abdbf2b\n"
    },
    {
      "commit": "9b06cc3c1b2c4e2b08582f3fc9393a05aa589766",
      "tree": "230f8e9cadd5dbd6a854b9e7c63f9707a4f84400",
      "parents": [
        "cf0529946a0ffd07e94785102965656768e455e1"
      ],
      "author": {
        "name": "Jeff Hao",
        "email": "jeffhao@google.com",
        "time": "Thu Aug 15 14:51:16 2013 -0700"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Thu Aug 15 15:34:22 2013 -0700"
      },
      "message": "Fix pthread_getcpuclockid.\n\nclock_gettime was returning EINVAL for the values\nproduced by pthread_getcpuclockid.\n\nBug: 10346183\nChange-Id: Iabe643d7d46110bb311a0367aa0fc737f653208e\n"
    },
    {
      "commit": "9d23e04c43dbb8480bea8be28b8a2f37423bec49",
      "tree": "e403288cf01ce40d6f330da09a317c7ad6dc2cb2",
      "parents": [
        "081318e3550b1a8d8384d98d7c94527681691120"
      ],
      "author": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Fri Feb 15 19:21:51 2013 -0800"
      },
      "committer": {
        "name": "Elliott Hughes",
        "email": "enh@google.com",
        "time": "Tue Feb 19 12:21:41 2013 -0800"
      },
      "message": "Fix pthreads functions that should return ESRCH.\n\nimgtec pointed out that pthread_kill(3) was broken, but most of the\nother functions that ought to return ESRCH for invalid/exited threads\nwere equally broken.\n\nChange-Id: I96347f6195549aee0c72dc39063e6c5d06d2e01f\n"
    }
  ]
}
