[compiler-rt] r225986 - [Msan] Fix strlen() and strnlen() interceptors to work on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Wed Jan 14 06:59:47 PST 2015
Author: vkutuzov
Date: Wed Jan 14 08:59:46 2015
New Revision: 225986
URL: http://llvm.org/viewvc/llvm-project?rev=225986&view=rev
Log:
[Msan] Fix strlen() and strnlen() interceptors to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D6928
Modified:
compiler-rt/trunk/lib/msan/msan_interceptors.cc
Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=225986&r1=225985&r2=225986&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Wed Jan 14 08:59:46 2015
@@ -318,6 +318,8 @@ INTERCEPTOR(char *, stpcpy, char *dest,
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 *, __strdup, char *src)
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);
More information about the llvm-commits
mailing list