This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Don't unpoison buffer in getpw/getgr functions
ClosedPublic

Authored by vitalybuka on Feb 4 2019, 6:48 PM.

Details

Summary

Buffer should be referenced by results so used parts will be unpoisoned with unpoison_group and unpoison_passwd.

This fixes TSAN performance issue made us to disable this interceptors.

Event Timeline

vitalybuka created this revision.Feb 4 2019, 6:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2019, 6:48 PM
Herald added subscribers: Restricted Project, krytarowski, kubamracek, srhines. · View Herald Transcript

fixed not linux test

Check more fields

Fix pw_fields check

eugenis added inline comments.Feb 5 2019, 12:05 PM
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
1830

This might cause TSan problems if some of these fields point to a static string constant. Let's hope this is not the case.

compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc
2

why not android?

vitalybuka updated this revision to Diff 185389.Feb 5 2019, 1:45 PM
vitalybuka marked an inline comment as done.

Android #if defined

vitalybuka marked an inline comment as done.Feb 5 2019, 1:46 PM
vitalybuka added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
1830

it returns non const pointers, so it would be bad.

compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc
2

I've added Android conditions, but I'd like to re-enable them in separate patch.

eugenis accepted this revision.Feb 6 2019, 2:06 PM

LGTM

This revision is now accepted and ready to land.Feb 6 2019, 2:06 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2019, 4:08 PM