@@ -46,6 +46,9 @@ void OSSpinLockLock(volatile OSSpinLock *__lock);
4646#include < pthread.h>
4747#include < stdarg.h>
4848#include < stdio.h>
49+ #if SANITIZER_LINUX
50+ #include < sys/inotify.h>
51+ #endif
4952#include < sys/select.h>
5053#include < sys/socket.h>
5154#include < sys/stat.h>
@@ -1174,6 +1177,39 @@ INTERCEPTOR(int, kevent64, int kq, const struct kevent64_s *changelist,
11741177#define RTSAN_MAYBE_INTERCEPT_KEVENT64
11751178#endif // SANITIZER_INTERCEPT_KQUEUE
11761179
1180+ #if SANITIZER_LINUX
1181+ INTERCEPTOR (int , inotify_init) {
1182+ __rtsan_notify_intercepted_call (" inotify_init" );
1183+ return REAL (inotify_init)();
1184+ }
1185+
1186+ INTERCEPTOR (int , inotify_init1, int flags) {
1187+ __rtsan_notify_intercepted_call (" inotify_init1" );
1188+ return REAL (inotify_init1)(flags);
1189+ }
1190+
1191+ INTERCEPTOR (int , inotify_add_watch, int fd, const char *path, uint32_t mask) {
1192+ __rtsan_notify_intercepted_call (" inotify_add_watch" );
1193+ return REAL (inotify_add_watch)(fd, path, mask);
1194+ }
1195+
1196+ INTERCEPTOR (int , inotify_rm_watch, int fd, int wd) {
1197+ __rtsan_notify_intercepted_call (" inotify_rm_watch" );
1198+ return REAL (inotify_rm_watch)(fd, wd);
1199+ }
1200+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT INTERCEPT_FUNCTION (inotify_init)
1201+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1 INTERCEPT_FUNCTION (inotify_init1)
1202+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH \
1203+ INTERCEPT_FUNCTION (inotify_add_watch)
1204+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH \
1205+ INTERCEPT_FUNCTION (inotify_rm_watch)
1206+ #else
1207+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT
1208+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1
1209+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH
1210+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH
1211+ #endif
1212+
11771213INTERCEPTOR (int , pipe, int pipefd[2 ]) {
11781214 __rtsan_notify_intercepted_call (" pipe" );
11791215 return REAL (pipe)(pipefd);
@@ -1415,6 +1451,11 @@ void __rtsan::InitializeInterceptors() {
14151451 RTSAN_MAYBE_INTERCEPT_KEVENT;
14161452 RTSAN_MAYBE_INTERCEPT_KEVENT64;
14171453
1454+ RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT;
1455+ RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1;
1456+ RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH;
1457+ RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH;
1458+
14181459 INTERCEPT_FUNCTION (pipe);
14191460 INTERCEPT_FUNCTION (mkfifo);
14201461
0 commit comments