[compiler-rt] [compiler-rt][rtsan] Reland posix part of #121616 setbuf, setvbuf. (PR #121658)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 07:04:49 PST 2025


================
@@ -325,6 +325,27 @@ INTERCEPTOR(FILE *, fmemopen, void *buf, size_t size, const char *mode) {
 #define RTSAN_MAYBE_INTERCEPT_FMEMOPEN
 #endif
 
+#if SANITIZER_INTERCEPT_SETVBUF
+INTERCEPTOR(void, setbuf, FILE *stream, char *buf) {
+  __rtsan_notify_intercepted_call("setbuf");
+  return REAL(setbuf)(stream, buf);
+}
+
+INTERCEPTOR(int, setvbuf, FILE *stream, char *buf, int mode, size_t size) {
+  __rtsan_notify_intercepted_call("setvbuf");
+  return REAL(setvbuf)(stream, buf, mode, size);
+}
+#define RTSAN_MAYBE_INTERCEPT_SETBUF INTERCEPT_FUNCTION(setbuf)
+#define RTSAN_MAYBE_INTERCEPT_SETBUFFER INTERCEPT_FUNCTION(setbuffer)
----------------
davidtrevelyan wrote:

Do we still need the `setbuffer` and `setlinebuf` definitions here?

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


More information about the llvm-commits mailing list