[compiler-rt] [compiler-rt][rtsan] fix ioctl interception for musl. (PR #131464)

David CARLIER via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 15 11:07:23 PDT 2025


https://github.com/devnexen created https://github.com/llvm/llvm-project/pull/131464

None

>From e3194286cfa4272d3736baf960685709a583504b Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Sat, 15 Mar 2025 18:06:24 +0000
Subject: [PATCH] [compiler-rt][rtsan] fix ioctl interception for musl.

---
 compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
index 5bbefa3ce43f1..f093862462796 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
@@ -202,7 +202,11 @@ INTERCEPTOR(int, fcntl, int filedes, int cmd, ...) {
   return REAL(fcntl)(filedes, cmd, arg);
 }
 
+#if SANITIZER_MUSL
+INTERCEPTOR(int, ioctl, int filedes, int request, ...) {
+#else
 INTERCEPTOR(int, ioctl, int filedes, unsigned long request, ...) {
+#endif
   __rtsan_notify_intercepted_call("ioctl");
 
   // See fcntl for discussion on why we use intptr_t



More information about the llvm-commits mailing list