@@ -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>
@@ -1130,6 +1133,39 @@ INTERCEPTOR(int, kevent64, int kq, const struct kevent64_s *changelist,
11301133#define RTSAN_MAYBE_INTERCEPT_KEVENT64
11311134#endif // SANITIZER_INTERCEPT_KQUEUE
11321135
1136+ #if SANITIZER_LINUX
1137+ INTERCEPTOR (int , inotify_init) {
1138+ __rtsan_notify_intercepted_call (" inotify_init" );
1139+ return REAL (inotify_init)();
1140+ }
1141+
1142+ INTERCEPTOR (int , inotify_init1, int flags) {
1143+ __rtsan_notify_intercepted_call (" inotify_init1" );
1144+ return REAL (inotify_init1)(flags);
1145+ }
1146+
1147+ INTERCEPTOR (int , inotify_add_watch, int fd, const char *path, uint32_t mask) {
1148+ __rtsan_notify_intercepted_call (" inotify_add_watch" );
1149+ return REAL (inotify_add_watch)(fd, path, mask);
1150+ }
1151+
1152+ INTERCEPTOR (int , inotify_rm_watch, int fd, int wd) {
1153+ __rtsan_notify_intercepted_call (" inotify_rm_watch" );
1154+ return REAL (inotify_rm_watch)(fd, wd);
1155+ }
1156+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT INTERCEPT_FUNCTION (inotify_init)
1157+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1 INTERCEPT_FUNCTION (inotify_init1)
1158+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH \
1159+ INTERCEPT_FUNCTION (inotify_add_watch)
1160+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH \
1161+ INTERCEPT_FUNCTION (inotify_rm_watch)
1162+ #else
1163+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT
1164+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1
1165+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH
1166+ #define RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH
1167+ #endif
1168+
11331169INTERCEPTOR (int , pipe, int pipefd[2 ]) {
11341170 __rtsan_notify_intercepted_call (" pipe" );
11351171 return REAL (pipe)(pipefd);
@@ -1367,6 +1403,11 @@ void __rtsan::InitializeInterceptors() {
13671403 RTSAN_MAYBE_INTERCEPT_KEVENT;
13681404 RTSAN_MAYBE_INTERCEPT_KEVENT64;
13691405
1406+ RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT;
1407+ RTSAN_MAYBE_INTERCEPT_INOTIFY_INIT1;
1408+ RTSAN_MAYBE_INTERCEPT_INOTIFY_ADD_WATCH;
1409+ RTSAN_MAYBE_INTERCEPT_INOTIFY_RM_WATCH;
1410+
13701411 INTERCEPT_FUNCTION (pipe);
13711412 INTERCEPT_FUNCTION (mkfifo);
13721413
0 commit comments