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