This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Correct a behavior on the shared TSD registry
ClosedPublic

Authored by cryptoad on Jun 25 2019, 11:59 AM.

Details

Summary

There is an error in the shared TSD registry logic when looking for a
TSD in the slow path. There is an unlikely event when a TSD's precedence
was 0 after attempting a tryLock which indicated that it was grabbed
by another thread in between. We dealt with that case by continuing to
the next iteration, but that meant that the Index was not increased
and we ended up trying to lock the same TSD.
This would manifest in heavy contention, and in the end we would still
lock a TSD, but that was a wasted iteration.
So, do not continue, just skip the TSD as a potential candidate.

This is in both the standalone & non-standalone versions.

Event Timeline

cryptoad created this revision.Jun 25 2019, 11:59 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 25 2019, 11:59 AM
Herald added subscribers: Restricted Project, delcypher. · View Herald Transcript
cryptoad updated this revision to Diff 206500.Jun 25 2019, 12:00 PM

Remove unchanged files from CL.

Harbormaster completed remote builds in B33899: Diff 206500.
This revision is now accepted and ready to land.Jun 25 2019, 12:05 PM
This revision was automatically updated to reflect the committed changes.
lib/scudo/standalone/wrappers_c_checks.h