[compiler-rt] [sanitizer] Remove usage of termios ioctl constants on Linux (PR #149140)

Florian Weimer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 10:20:59 PDT 2025


================
@@ -482,4 +482,17 @@
 #  define SANITIZER_START_BACKGROUND_THREAD_IN_ASAN_INTERNAL 0
 #endif
 
+#if SANITIZER_LINUX
+#    if SANITIZER_GLIBC
+// Workaround for
+// glibc/commit/3d3572f59059e2b19b8541ea648a6172136ec42e
+// Linux: Keep termios ioctl constants strictly internal
+#      if __GLIBC_PREREQ(2, 41)
+#        define SANITIZER_TERMIOS_IOCTL_CONSTANTS 0
+#      else
+#        define SANITIZER_TERMIOS_IOCTL_CONSTANTS 1
+#      endif
+#    else
+#      define SANITIZER_TERMIOS_IOCTL_CONSTANTS 1
+#    endif
----------------
fweimer-rh wrote:

I assume that unrecognized `ioctl` operations are just passed through, so they would keep working. I'm not sure that sanitizer checking on the argument data is very valuable here because these `ioctl` operations don't have pointers in the `ioctl` data, so all you get is a check on the validity of the `struct termios` structure itself. (There are other `ioctl`s that can accept arrays of data via the argument structure, and those cases would be much more interesting to check.)

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


More information about the llvm-commits mailing list