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