Skip to content

[sanitizer_common] Remove interceptors for deprecated struct termio #137403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

tstellar
Copy link
Collaborator

This struct will be removed from glibc-2.42 and has been deprecated for a very long time.

Fixes #137321

This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes llvm#137321
@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Tom Stellard (tstellar)

Changes

This struct will be removed from glibc-2.42 and has been deprecated for a very long time.

Fixes #137321


Full diff: https://github.com/llvm/llvm-project/pull/137403.diff

3 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc (-8)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp (-3)
  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (-1)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
index f88f914b1d149..bc8f02826c614 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
@@ -342,17 +342,9 @@ static void ioctl_table_fill() {
   _(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);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index b4d87ab6228e5..7a89bf1c74985 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -494,9 +494,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
   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);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 348bb4f27aec3..fdc52aa56c493 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -1063,7 +1063,6 @@ extern unsigned struct_hd_geometry_sz;
 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;

@tstellar tstellar requested a review from vitalybuka April 25, 2025 21:53
@trcrsired
Copy link

just remove it, including on android

@tstellar
Copy link
Collaborator Author

This isn't quite enough to fix the build. There are also uses of TCGETA, TCSETA, TCSETAF, and TCSETAW macros that reference struct termio. I'm not sure if these should be removed or if asm.h needs to be updated to use struct termios instead.

@tstellar
Copy link
Collaborator Author

This isn't quite enough to fix the build. There are also uses of TCGETA, TCSETA, TCSETAF, and TCSETAW macros that reference struct termio. I'm not sure if these should be removed or if asm.h needs to be updated to use struct termios instead.

I'm having a little trouble reproducing this, so I'm going to merge this PR and then create a follow up to fix this issue once I figure it out.

@tstellar tstellar merged commit 59978b2 into llvm:main Apr 28, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from Needs Fix to Done in LLVM Release Status Apr 28, 2025
@tstellar
Copy link
Collaborator Author

/cherry-pick 59978b2

@llvmbot
Copy link
Member

llvmbot commented Apr 28, 2025

/pull-request #137707

@hpax
Copy link

hpax commented Apr 29, 2025

Please see my comment on #137321

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#137403)

This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes llvm#137321
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#137403)

This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes llvm#137321
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…lvm#137403)

This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes llvm#137321
andreas-schwab added a commit to andreas-schwab/llvm-project that referenced this pull request May 7, 2025
The termio ioctls are no longer used after commit 59978b2
("[sanitizer_common] Remove interceptors for deprecated struct termio
(llvm#137403)"), remove them.  Fixes this build error:

../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:765:27: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  765 |   unsigned IOCTL_TCGETA = TCGETA;
      |                           ^~~~~~
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:769:27: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  769 |   unsigned IOCTL_TCSETA = TCSETA;
      |                           ^~~~~~
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:770:28: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  770 |   unsigned IOCTL_TCSETAF = TCSETAF;
      |                            ^~~~~~~
../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:771:28: error: invalid application of ‘sizeof’ to incomplete type ‘__sanitizer::termio’
  771 |   unsigned IOCTL_TCSETAW = TCSETAW;
      |                            ^~~~~~~
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
…lvm#137403)

This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes llvm#137321
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
…lvm#137403)

This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes llvm#137321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
7 participants