[compiler-rt] [compiler-rt] intercept macOs's freadlink call. (PR #83679)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 00:04:09 PDT 2024


================
@@ -10299,6 +10299,25 @@ INTERCEPTOR(SSIZE_T, pwritev2, int fd, __sanitizer_iovec *iov, int iovcnt,
 #define INIT_PWRITEV2
 #endif
 
+#if SANITIZER_INTERCEPT_FREADLINK
+INTERCEPTOR(SSIZE_T, freadlink, int fd, char *buf, SIZE_T bufsiz) {
+  void *ctx;
+  COMMON_INTERCEPTOR_ENTER(ctx, freadlink, fd, buf, bufsiz);
+  COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
+  SSIZE_T res = REAL(freadlink)(fd, buf, bufsiz);
+  if (res > 0)
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res);
+  if (res >= 0 && fd > 0)
+    COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd);
+  return res;
+}
+
+#  define INIT_FREADLINK COMMON_INTERCEPT_FUNCTION(freadlink)
+#else
+#  define INIT_FREADLINK
+>>>>>>> a3b9d381f6e1 ([compiler-rt] intercept macOs's freadlink call.)
----------------
vitalybuka wrote:

">>>>" is this from conflict resolution?

https://github.com/llvm/llvm-project/pull/83679


More information about the llvm-commits mailing list