diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp index f000deb3039a8..24e0857b96650 100644 --- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp @@ -807,6 +807,17 @@ INTERCEPTOR(int, epoll_pwait, int epfd, struct epoll_event *events, #define RTSAN_MAYBE_INTERCEPT_EPOLL_PWAIT #endif // SANITIZER_INTERCEPT_EPOLL +#if SANITIZER_INTERCEPT_PPOLL +INTERCEPTOR(int, ppoll, struct pollfd *fds, nfds_t n, const struct timespec *ts, + const sigset_t *set) { + __rtsan_notify_intercepted_call("ppoll"); + return REAL(ppoll)(fds, n, ts, set); +} +#define RTSAN_MAYBE_INTERCEPT_PPOLL INTERCEPT_FUNCTION(ppoll) +#else +#define RTSAN_MAYBE_INTERCEPT_PPOLL +#endif + #if SANITIZER_INTERCEPT_KQUEUE INTERCEPTOR(int, kqueue, void) { __rtsan_notify_intercepted_call("kqueue"); @@ -1000,6 +1011,7 @@ void __rtsan::InitializeInterceptors() { RTSAN_MAYBE_INTERCEPT_EPOLL_CTL; RTSAN_MAYBE_INTERCEPT_EPOLL_WAIT; RTSAN_MAYBE_INTERCEPT_EPOLL_PWAIT; + RTSAN_MAYBE_INTERCEPT_PPOLL; RTSAN_MAYBE_INTERCEPT_KQUEUE; RTSAN_MAYBE_INTERCEPT_KEVENT; RTSAN_MAYBE_INTERCEPT_KEVENT64; diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp index b3fb32ee8dcd4..5859ec7b5fb61 100644 --- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp @@ -1056,6 +1056,21 @@ TEST_F(EpollTest, EpollPWaitDiesWhenRealtime) { } #endif // SANITIZER_INTERCEPT_EPOLL +#if SANITIZER_INTERCEPT_PPOLL +TEST(TestRtsanInterceptors, PpollDiesWhenRealtime) { + struct pollfd fds[1]; + fds[0].fd = 0; + fds[0].events = POLLIN; + + timespec ts = {0}; + + auto Func = [&fds, &ts]() { ppoll(fds, 1, &ts, nullptr); }; + + ExpectRealtimeDeath(Func, "ppoll"); + ExpectNonRealtimeSurvival(Func); +} +#endif + #if SANITIZER_INTERCEPT_KQUEUE TEST(TestRtsanInterceptors, KqueueDiesWhenRealtime) { auto Func = []() { kqueue(); };