Skip to content

Commit

Permalink
Revert "[Sanitizers] Intercept timer_create" (#113710)
Browse files Browse the repository at this point in the history
Reverts #112285
  • Loading branch information
fmayer authored Oct 25, 2024
1 parent 4161ca2 commit 2ec5c69
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 52 deletions.
3 changes: 0 additions & 3 deletions compiler-rt/lib/hwasan/hwasan_platform_interceptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@
#undef SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID 0

#undef SANITIZER_INTERCEPT_TIMER_CREATE
#define SANITIZER_INTERCEPT_TIMER_CREATE 0

#undef SANITIZER_INTERCEPT_GETITIMER
#define SANITIZER_INTERCEPT_GETITIMER 0

Expand Down
23 changes: 0 additions & 23 deletions compiler-rt/lib/msan/tests/msan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4881,27 +4881,4 @@ TEST(MemorySanitizer, throw_catch) {
// pass
}
}

#if defined(__linux__)
TEST(MemorySanitizer, timer_create) {
timer_t timer;
EXPECT_POISONED(timer);
int res = timer_create(CLOCK_REALTIME, nullptr, &timer);
ASSERT_EQ(0, res);
EXPECT_NOT_POISONED(timer);

// Make sure the timer is usable.
struct itimerspec cur_value {};
cur_value.it_value.tv_sec = 1;
EXPECT_EQ(0, timer_settime(timer, 0, &cur_value, nullptr));

timer_t timer2;
EXPECT_POISONED(timer2);
// Use an invalid clock_id to make timer_create fail.
res = timer_create(INT_MAX, nullptr, &timer2);
ASSERT_EQ(-1, res);
EXPECT_POISONED(timer2);
timer_delete(timer);
}
#endif
} // namespace
19 changes: 0 additions & 19 deletions compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2289,24 +2289,6 @@ INTERCEPTOR(int, pthread_getcpuclockid, uptr thread,
#define INIT_CLOCK_GETCPUCLOCKID
#endif

#if SANITIZER_INTERCEPT_TIMER_CREATE
INTERCEPTOR(int, timer_create, __sanitizer_clockid_t clockid, void *sevp,
__sanitizer_timer_t *timer) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, timer_create, clockid, sevp, timer);
int res = REAL(timer_create)(clockid, sevp, timer);
if (!res && timer) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, timer, sizeof *timer);
}
return res;
}

# define INIT_TIMER_CREATE \
COMMON_INTERCEPT_FUNCTION_GLIBC_VER_MIN(timer_create, "GLIBC_2.3.3");
#else
# define INIT_TIMER_CREATE
#endif

#if SANITIZER_INTERCEPT_GETITIMER
INTERCEPTOR(int, getitimer, int which, void *curr_value) {
void *ctx;
Expand Down Expand Up @@ -10284,7 +10266,6 @@ static void InitializeCommonInterceptors() {
INIT_SETPWENT;
INIT_CLOCK_GETTIME;
INIT_CLOCK_GETCPUCLOCKID;
INIT_TIMER_CREATE;
INIT_GETITIMER;
INIT_TIME;
INIT_GLOB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@
(SI_FREEBSD || SI_NETBSD || SI_LINUX || SI_SOLARIS)
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID \
(SI_LINUX || SI_FREEBSD || SI_NETBSD)
// TODO: This should be SI_POSIX, adding Linux first until I have time
// to verify all timer_t typedefs on other platforms.
#define SANITIZER_INTERCEPT_TIMER_CREATE SI_LINUX
#define SANITIZER_INTERCEPT_GETITIMER SI_POSIX
#define SANITIZER_INTERCEPT_TIME SI_POSIX
#define SANITIZER_INTERCEPT_GLOB (SI_GLIBC || SI_SOLARIS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1517,10 +1517,6 @@ extern const int si_SEGV_ACCERR;

#define SIGACTION_SYMNAME sigaction

# if SANITIZER_LINUX
typedef void *__sanitizer_timer_t;
# endif

#endif // SANITIZER_LINUX || SANITIZER_APPLE

#endif

0 comments on commit 2ec5c69

Please sign in to comment.