This is an archive of the discontinued LLVM Phabricator instance.

[msan] Rewrite strto* interceptors and add a few more.
ClosedPublic

Authored by earthdok on Jan 27 2014, 11:24 AM.

Details

Reviewers
eugenis
Summary

Express the strto* interceptors though macros. This removes a lot of
duplicate code and fixes a couple of copypasto bugs (where "res" was declared of
a different type than the actual return type). Also, add a few more interceptors
for strto*_l.

Diff Detail

Event Timeline

I started similarly rewriting the strto* tests in tests/msan_test.cc, but it turns out that the tests in this file are not run as part of check-msan. What's up with that?

Also, who uses the __-prefixed versions? Should we add them for the newly added functions as well?

libstdc++ depends on these:

__strtof_l
__strtod_l
strtoul
strtold_l

Please add all of them for completeness.
Also, could you move this to sanitizer_common_interceptors.inc, while you are at it?

Also, could you move this to sanitizer_common_interceptors.inc, while you are at it?

Maybe in a separate CL. But what would that achieve? These interceptors wouldn't have any effect in ASan (and there's already a conflicting implementation of strol).

eugenis accepted this revision.Jan 28 2014, 3:08 AM

The fact that there is an strtol interceptor in asan means there is _something_ to achieve, right? :)
Common interceptors would do READ on the input string, and let us catch asan bugs and tsan data races on that memory.
ASan interceptor has interesting look ahead logic that should also be merged to the common interceptor.

OK to do it in a separate commit later.
LGTM.

earthdok updated this revision to Unknown Object (????).Jan 28 2014, 5:49 AM

rewrite tests

earthdok closed this revision.Dec 5 2014, 9:38 AM