a2cf7d
commit f55e312bcd6582b5ff68fdcc1781c7017796dc91
a2cf7d
Author: Florian Weimer <fweimer@redhat.com>
a2cf7d
Date:   Thu Nov 28 14:42:11 2019 +0100
a2cf7d
a2cf7d
    libio: Disable vtable validation for pre-2.1 interposed handles [BZ #25203]
a2cf7d
    
a2cf7d
    Commit c402355dfa7807b8e0adb27c009135a7e2b9f1b0 ("libio: Disable
a2cf7d
    vtable validation in case of interposition [BZ #23313]") only covered
a2cf7d
    the interposable glibc 2.1 handles, in libio/stdfiles.c.  The
a2cf7d
    parallel code in libio/oldstdfiles.c needs similar detection logic.
a2cf7d
    
a2cf7d
    Fixes (again) commit db3476aff19b75c4fdefbe65fcd5f0a90588ba51
a2cf7d
    ("libio: Implement vtable verification [BZ #20191]").
a2cf7d
    
a2cf7d
    Change-Id: Ief6f9f17e91d1f7263421c56a7dc018f4f595c21
a2cf7d
    (cherry picked from commit cb61630ed712d033f54295f776967532d3f4b46a)
a2cf7d
a2cf7d
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
a2cf7d
index f3dda89004..9fe809bd68 100644
a2cf7d
--- a/libio/oldstdfiles.c
a2cf7d
+++ b/libio/oldstdfiles.c
a2cf7d
@@ -87,6 +87,11 @@ _IO_check_libio (void)
a2cf7d
 	stdout->_vtable_offset = stderr->_vtable_offset =
a2cf7d
 	((int) sizeof (struct _IO_FILE)
a2cf7d
 	 - (int) sizeof (struct _IO_FILE_complete));
a2cf7d
+
a2cf7d
+      if (_IO_stdin_.vtable != &_IO_old_file_jumps
a2cf7d
+	  || _IO_stdout_.vtable != &_IO_old_file_jumps
a2cf7d
+	  || _IO_stderr_.vtable != &_IO_old_file_jumps)
a2cf7d
+	IO_set_accept_foreign_vtables (&_IO_vtable_check);
a2cf7d
     }
a2cf7d
 }
a2cf7d