toolchain/gcc: backport libsanitizer struct termio fix for glibc 2.43

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@null-ptr.net>
This commit is contained in:
Dustin Lundquist
2026-06-02 12:38:32 -07:00
committed by Robert Marko
parent b3601af4e4
commit f93228427a
@@ -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);