@@ -285,6 +285,45 @@ INTERCEPTOR(int, unlinkat, int fd, const char *pathname, int flag) {
285
285
return REAL (unlinkat)(fd, pathname, flag);
286
286
}
287
287
288
+ INTERCEPTOR (int , stat, const char *pathname, struct stat *s) {
289
+ __rtsan_notify_intercepted_call (" stat" );
290
+ return REAL (stat)(pathname, s);
291
+ }
292
+
293
+ INTERCEPTOR (int , lstat, const char *pathname, struct stat *s) {
294
+ __rtsan_notify_intercepted_call (" lstat" );
295
+ return REAL (lstat)(pathname, s);
296
+ }
297
+
298
+ INTERCEPTOR (int , fstat, int fd, struct stat *s) {
299
+ __rtsan_notify_intercepted_call (" fstat" );
300
+ return REAL (fstat)(fd, s);
301
+ }
302
+
303
+ #if !SANITIZER_APPLE // deprecated for darwin
304
+ INTERCEPTOR (int , stat64, const char *pathname, struct stat64 *s) {
305
+ __rtsan_notify_intercepted_call (" stat64" );
306
+ return REAL (stat64)(pathname, s);
307
+ }
308
+
309
+ INTERCEPTOR (int , lstat64, const char *pathname, struct stat64 *s) {
310
+ __rtsan_notify_intercepted_call (" lstat64" );
311
+ return REAL (lstat64)(pathname, s);
312
+ }
313
+
314
+ INTERCEPTOR (int , fstat64, int fd, struct stat64 *s) {
315
+ __rtsan_notify_intercepted_call (" fstat64" );
316
+ return REAL (fstat64)(fd, s);
317
+ }
318
+ #define RTSAN_MAYBE_INTERCEPT_STAT64 INTERCEPT_FUNCTION (stat64)
319
+ #define RTSAN_MAYBE_INTERCEPT_LSTAT64 INTERCEPT_FUNCTION (lstat64)
320
+ #define RTSAN_MAYBE_INTERCEPT_FSTAT64 INTERCEPT_FUNCTION (fstat64)
321
+ #else
322
+ #define RTSAN_MAYBE_INTERCEPT_STAT64
323
+ #define RTSAN_MAYBE_INTERCEPT_LSTAT64
324
+ #define RTSAN_MAYBE_INTERCEPT_FSTAT64
325
+ #endif
326
+
288
327
// Streams
289
328
290
329
INTERCEPTOR (FILE *, fopen, const char *path, const char *mode) {
@@ -1437,6 +1476,12 @@ void __rtsan::InitializeInterceptors() {
1437
1476
RTSAN_MAYBE_INTERCEPT_READLINKAT;
1438
1477
INTERCEPT_FUNCTION (unlink);
1439
1478
INTERCEPT_FUNCTION (unlinkat);
1479
+ INTERCEPT_FUNCTION (stat);
1480
+ INTERCEPT_FUNCTION (lstat);
1481
+ INTERCEPT_FUNCTION (fstat);
1482
+ RTSAN_MAYBE_INTERCEPT_STAT64;
1483
+ RTSAN_MAYBE_INTERCEPT_LSTAT64;
1484
+ RTSAN_MAYBE_INTERCEPT_FSTAT64;
1440
1485
INTERCEPT_FUNCTION (fopen);
1441
1486
RTSAN_MAYBE_INTERCEPT_FOPEN64;
1442
1487
RTSAN_MAYBE_INTERCEPT_FREOPEN64;
0 commit comments