[PATCH] toolchain/gcc: backport libsanitizer struct termio fix for glibc 2.43
Dustin Lundquist
dustin at null-ptr.net
Tue Jun 2 12:38:32 PDT 2026
glibc 2.43 no longer exposes struct termio (the old UNIX System V
terminal struct) through <termios.h>. This breaks the GCC 14
libsanitizer build which uses sizeof(struct termio) and registers
ioctl interceptors for the legacy TCGETA/TCSETA/TCSETAF/TCSETAW
ioctls that operated on struct termio.
GCC 15 already dropped these references. Backport that removal to
the GCC 14 patch series.
Signed-off-by: Dustin Lundquist <dustin at null-ptr.net>
---
...0-libsanitizer-fix-termio-glibc-2.40.patch | 53 +++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 toolchain/gcc/patches-14.x/240-libsanitizer-fix-termio-glibc-2.40.patch
diff --git a/toolchain/gcc/patches-14.x/240-libsanitizer-fix-termio-glibc-2.40.patch b/toolchain/gcc/patches-14.x/240-libsanitizer-fix-termio-glibc-2.40.patch
new file mode 100644
index 0000000000..b2ceac73ce
--- /dev/null
+++ b/toolchain/gcc/patches-14.x/240-libsanitizer-fix-termio-glibc-2.40.patch
@@ -0,0 +1,53 @@
+From: Backport from GCC 15
+
+libsanitizer: remove struct termio and legacy ioctl interceptors for glibc
+
+glibc 2.43 no longer exposes struct termio (the old UNIX System V
+terminal struct) through <termios.h>. The old TCGETA/TCSETA/TCSETAF/
+TCSETAW ioctls that operated on struct termio are legacy interfaces
+superseded by the POSIX TCGETS/TCSETS family using struct termios.
+
+GCC 15 already dropped these; this patch backports that removal to GCC 14.
+
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -479,9 +479,6 @@
+ unsigned struct_input_id_sz = sizeof(struct input_id);
+ unsigned struct_mtpos_sz = sizeof(struct mtpos);
+ unsigned struct_rtentry_sz = sizeof(struct rtentry);
+-#if SANITIZER_GLIBC || SANITIZER_ANDROID
+- unsigned struct_termio_sz = sizeof(struct termio);
+-#endif
+ unsigned struct_vt_consize_sz = sizeof(struct vt_consize);
+ unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes);
+ unsigned struct_vt_stat_sz = sizeof(struct vt_stat);
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -1012,7 +1012,6 @@
+ extern unsigned struct_input_absinfo_sz;
+ extern unsigned struct_input_id_sz;
+ extern unsigned struct_mtpos_sz;
+-extern unsigned struct_termio_sz;
+ extern unsigned struct_vt_consize_sz;
+ extern unsigned struct_vt_sizes_sz;
+ extern unsigned struct_vt_stat_sz;
+--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
++++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+@@ -338,17 +338,9 @@
+ _(SOUND_PCM_WRITE_CHANNELS, WRITE, sizeof(int));
+ _(SOUND_PCM_WRITE_FILTER, WRITE, sizeof(int));
+ _(TCFLSH, NONE, 0);
+-#if SANITIZER_GLIBC
+- _(TCGETA, WRITE, struct_termio_sz);
+-#endif
+ _(TCGETS, WRITE, struct_termios_sz);
+ _(TCSBRK, NONE, 0);
+ _(TCSBRKP, NONE, 0);
+-#if SANITIZER_GLIBC
+- _(TCSETA, READ, struct_termio_sz);
+- _(TCSETAF, READ, struct_termio_sz);
+- _(TCSETAW, READ, struct_termio_sz);
+-#endif
+ _(TCSETS, READ, struct_termios_sz);
+ _(TCSETSF, READ, struct_termios_sz);
+ _(TCSETSW, READ, struct_termios_sz);
More information about the openwrt-devel
mailing list