)]}'
{
  "commit": "dfa2a002f9b8e1762351f7d9500169964e755f08",
  "tree": "78b0662f613d201a5c745648d95c736dfb4dcb78",
  "parents": [
    "02b50413fd2902e6078adac5e3f4939bfef16a6f"
  ],
  "author": {
    "name": "Barret Rhoden",
    "email": "brho@cs.berkeley.edu",
    "time": "Tue Dec 18 13:35:29 2018 -0500"
  },
  "committer": {
    "name": "Barret Rhoden",
    "email": "brho@cs.berkeley.edu",
    "time": "Tue Dec 18 15:30:28 2018 -0500"
  },
  "message": "parlib: Fix the use-after-func issue\n\nSame as in the kernel, the parlib alarm service was touching the waiter\nstruct after the function ran.  We were doing this to know when the\nfunction was complete when we were unsetting the alarm.  However, this\ncomplicates the code of any client, since the completion of the function\nisn\u0027t proof that the struct won\u0027t be reused.\n\nSee commit 47c2cf2efd4e (\"futex: Call unset_alarm() before freeing the\nawaiter\") for a bug caused by this, and commit c62a28c78976 (\"alarm:\nForce unset_alarm to grab the CV lock\")\n\nThe fix is the same as in the kernel - use the tchain-\u003erunning variable\nto track when a handler is running.\n\nWe\u0027re using the CV lock directly - userspace CVs don\u0027t have the same\ninterface as the kernel where you can tell it to use another lock.  And\nwe don\u0027t really need that interface, especially given that userspace CVs\nare typically used for mutexes.\n\nGiven the slight nastiness associated with signalling a uth CV that uses\nthe CV lock, specifically that we want to unlock before waking the\nuthread, I tried skipping the CV completely and just yielding - in\neffect a busy-wait with a uthread_yield (sched_yield actually, which is\nsafe since we\u0027re an MCP if we ever unset during an alarm handler,\nassuming one never unsets during their *own* alarm handle)).  However,\nat least in qemu for some Go tests, some tests timed out too frequently.\nMy guess is that alarms were delayed too much by the busy waiting.\n\nSigned-off-by: Barret Rhoden \u003cbrho@cs.berkeley.edu\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4769f9e02b7bd2057f823de74ff86928528a80ae",
      "old_mode": 33188,
      "old_path": "user/parlib/alarm.c",
      "new_id": "36948a3290794cbe1d28e9a4edd4a748587dbd28",
      "new_mode": 33188,
      "new_path": "user/parlib/alarm.c"
    },
    {
      "type": "modify",
      "old_id": "7b50467a7d82b1941bdb1c2924598d3699314f88",
      "old_mode": 33188,
      "old_path": "user/parlib/include/parlib/alarm.h",
      "new_id": "bf411313f744a23160baae4e2e31506ccbdf3d2f",
      "new_mode": 33188,
      "new_path": "user/parlib/include/parlib/alarm.h"
    }
  ]
}
