[PATCH] [Msan] Fix strlen() and strnlen() interceptors to work on FreeBSD

Phabricator reviews at reviews.llvm.org
Wed Jan 14 07:01:13 PST 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6928

Files:
  compiler-rt/trunk/lib/msan/msan_interceptors.cc

Index: compiler-rt/trunk/lib/msan/msan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc
@@ -318,6 +318,8 @@
 INTERCEPTOR(char *, strdup, char *src) {
   ENSURE_MSAN_INITED();
   GET_STORE_STACK_TRACE;
+  // On FreeBSD strdup() leverages strlen().
+  InterceptorScope interceptor_scope;
   SIZE_T n = REAL(strlen)(src);
   char *res = REAL(strdup)(src);
   CopyPoison(res, src, n + 1, &stack);
@@ -341,6 +343,8 @@
 INTERCEPTOR(char *, strndup, char *src, SIZE_T n) {
   ENSURE_MSAN_INITED();
   GET_STORE_STACK_TRACE;
+  // On FreeBSD strndup() leverages strnlen().
+  InterceptorScope interceptor_scope;
   SIZE_T copy_size = REAL(strnlen)(src, n);
   char *res = REAL(strndup)(src, n);
   CopyPoison(res, src, copy_size, &stack);

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6928.18150.patch
Type: text/x-patch
Size: 870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150114/7d83540c/attachment.bin>


More information about the llvm-commits mailing list