[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:15:19 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);
----------------
vitalybuka wrote:
Should this write `res + 1` or `res`?
I can't find documentation to check if termninating 0 is part of res or not.
https://github.com/llvm/llvm-project/pull/83679
More information about the llvm-commits
mailing list