• Michael Anthony Knyszek's avatar
    runtime: don't clear lockedExt on locked M when G exits · d0f8a751
    Michael Anthony Knyszek authored
    When a locked M has its G exit without calling UnlockOSThread, then
    lockedExt on it was getting cleared. Unfortunately, this meant that
    during P handoff, if a new M was started, it might get forked (on
    most OSs besides Windows) from the locked M, which could have kernel
    state attached to it.
    
    To solve this, just don't clear lockedExt. At the point where the
    locked M has its G exit, it will also exit in accordance with the
    LockOSThread API. So, we can safely assume that it's lockedExt state
    will no longer be used. For the case of the main thread where it just
    gets wedged instead of exiting, it's probably better for it to keep
    the locked marker since it more accurately represents its state.
    
    Fixed #28979.
    
    Change-Id: I7d3d71dd65bcb873e9758086d2cbcb9a06429b0f
    Reviewed-on: https://go-review.googlesource.com/c/153078
    Run-TryBot: Michael Knyszek <mknyszek@google.com>
    Reviewed-by: 's avatarAustin Clements <austin@google.com>
    d0f8a751
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...