tsan: disable getpwent interceptors

There interceptors do not seem to be strictly necessary for tsan.
But we see cases where the interceptors consume 70% of execution time.
Memory blocks passed to fgetgrent_r are "written to" by tsan several times.
First, there is some recursion (getgrnam_r calls fgetgrent_r), and each
function "writes to" the buffer. Then, the same memory is "written to"
twice, first as buf and then as pwbufp (both of them refer to the same addresses).

llvm-svn: 216904
This commit is contained in:
Dmitry Vyukov 2014-09-02 12:51:11 +00:00
parent 1841219abd
commit 8bbb17dcc3
2 changed files with 17 additions and 2 deletions

View File

@ -1037,7 +1037,8 @@ INTERCEPTOR(int, ioctl, int d, unsigned request, void *arg) {
#endif
#if SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS || \
SANITIZER_INTERCEPT_GETPWENT || SANITIZER_INTERCEPT_FGETPWENT
SANITIZER_INTERCEPT_GETPWENT || SANITIZER_INTERCEPT_FGETPWENT || \
SANITIZER_INTERCEPT_GETPWENT_R || SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS
static void unpoison_passwd(void *ctx, __sanitizer_passwd *pwd) {
if (pwd) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, pwd, sizeof(*pwd));
@ -1084,7 +1085,9 @@ static void unpoison_group(void *ctx, __sanitizer_group *grp) {
}
}
#endif // SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS ||
// SANITIZER_INTERCEPT_GETPWENT || SANITIZER_INTERCEPT_FGETPWENT
// SANITIZER_INTERCEPT_GETPWENT || SANITIZER_INTERCEPT_FGETPWENT ||
// SANITIZER_INTERCEPT_GETPWENT_R ||
// SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS
#if SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS
INTERCEPTOR(__sanitizer_passwd *, getpwnam, const char *name) {

View File

@ -1973,6 +1973,18 @@ static void HandleRecvmsg(ThreadState *thr, uptr pc,
#include "sanitizer_common/sanitizer_platform_interceptors.h"
// Causes interceptor recursion (getaddrinfo() and fopen())
#undef SANITIZER_INTERCEPT_GETADDRINFO
// There interceptors do not seem to be strictly necessary for tsan.
// But we see cases where the interceptors consume 70% of execution time.
// Memory blocks passed to fgetgrent_r are "written to" by tsan several times.
// First, there is some recursion (getgrnam_r calls fgetgrent_r), and each
// function "writes to" the buffer. Then, the same memory is "written to"
// twice, first as buf and then as pwbufp (both of them refer to the same
// addresses).
#undef SANITIZER_INTERCEPT_GETPWENT
#undef SANITIZER_INTERCEPT_GETPWENT_R
#undef SANITIZER_INTERCEPT_FGETPWENT
#undef SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS
#undef SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS
#define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)