Page MenuHomePhabricator

[sanitizer] Add strnlen to the common interceptors

Authored by bruening on Mar 23 2016, 8:14 AM.



Adds strnlen to the common interceptors, under the existing flag

Removes the now-duplicate strnlen interceptor from asan and msan.
This adds strnlen to tsan, which previously did not intercept it.

Adds a new test of strnlen to the sanitizer_common test cases.

Diff Detail


Event Timeline

bruening updated this revision to Diff 51420.Mar 23 2016, 8:14 AM
bruening retitled this revision from to [sanitizer] Add strnlen to the common interceptors.
bruening updated this object.
bruening added a reviewer: samsonov.
bruening added subscribers: kcc, llvm-commits, zhaoqin.

(Note that I now have commit access and so will be able to commit this myself.)

samsonov accepted this revision.Mar 23 2016, 10:29 AM
samsonov edited edge metadata.

LGTM with a nit below.

114 ↗(On Diff #51420)

I think SANITIZER_INTERCEPT_STRNLEN will not be defined at this point (sanitizer_common/ is #included later). Maybe we can just delete this terrible function and use internal_strnlen() everywhere instead. It won't be that much of a slowdown.

This revision is now accepted and ready to land.Mar 23 2016, 10:29 AM
bruening added inline comments.Mar 23 2016, 11:18 AM
114 ↗(On Diff #51420)

No, it is defined: SANITIZER_INTERCEPT_STRNLEN is defined in sanitizer_platform_interceptors.h, not in
sanitizer_platform_interceptors.h is #included in asan_interceptors.h, which is #included at the top of this file.

vitalybuka accepted this revision.Mar 23 2016, 1:48 PM
vitalybuka edited edge metadata.
samsonov added inline comments.Mar 23 2016, 1:51 PM
114 ↗(On Diff #51420)

Ah, good, thanks! It's fine to submit this change as-is then.

This revision was automatically updated to reflect the committed changes.