[PATCH] D18020: [sanitizer] Add strlen to the common interceptors

Derek Bruening via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 13:29:27 PDT 2016


bruening added inline comments.

================
Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:205
@@ +204,3 @@
+INTERCEPTOR(SIZE_T, strlen, const char *s) {
+  if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED)
+    return internal_strlen(s);
----------------
bruening wrote:
> samsonov wrote:
> > I don't think you need it here: looks like this will be handled by COMMON_INTERCEPTOR_ENTER macro.
> Some common interceptors have their own init check which is what this is based on, but most don't and it does seem to be superfluous.  Perhaps I will send send a separate CL removing the existing checks.
Note that this is not quite the same as the COMMON_INTERCEPTOR_ENTER, because REAL(strlen) is not initialized until InitializeCommonInterceptors() is called (on Linux at least).  Thus any use of strlen prior to that point needs to use internal_strlen(), not REAL(strlen).  Given that nothing broke since this was committed, perhaps we can assume that nothing needs strlen that early.



Repository:
  rL LLVM

http://reviews.llvm.org/D18020





More information about the llvm-commits mailing list