Page MenuHomePhabricator

[DFSan] Don't unmap during dfsan_flush().
ClosedPublic

Authored by morehouse on Aug 13 2020, 5:05 PM.

Details

Summary

Unmapping and remapping is dangerous since another thread could touch
the shadow memory while it is unmapped. But there is really no need to
unmap anyway, since mmap(MAP_FIXED) will happily clobber the existing
mapping with zeroes. This is thread-safe since the mmap() is done under
the same kernel lock as page faults are done.

Diff Detail

Event Timeline

morehouse created this revision.Aug 13 2020, 5:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 5:05 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
morehouse requested review of this revision.Aug 13 2020, 5:05 PM
morehouse updated this revision to Diff 285528.Aug 13 2020, 5:14 PM
  • Add note about use in multithreaded environment.
vitalybuka accepted this revision.Aug 13 2020, 8:42 PM
This revision is now accepted and ready to land.Aug 13 2020, 8:42 PM
kcc added a comment.Aug 14 2020, 9:05 AM

Would it be possible to add a threaded test that fails w/o this change?
LGTM otherwise, thanks!

  • Add multithreaded dfsan_flush() test.
This revision was landed with ongoing or failed builds.Aug 14 2020, 11:44 AM
This revision was automatically updated to reflect the committed changes.