+2018-06-26 Florian Weimer <fweimer@redhat.com>
+
+ [BZ #23313]
+ * libio/vtables.c (check_stdfiles_vtables): New ELF constructor.
+
2018-06-29 Daniel Alvarez <dalvarez@redhat.com>
Jakub Sitnicki <jkbs@redhat.com>
[23236] Harden function pointers in _IO_str_fields
[23259] Unsubstituted ${ORIGIN} remains in DT_NEEDED for AT_SECURE
[23264] libc: posix_spawnp wrongly executes ENOEXEC in non compat mode
+ [23313] libio: Disable vtable validation in case of interposition
[23349] Various glibc headers no longer compatible with <linux/time.h>
\f
__libc_fatal ("Fatal error: glibc detected an invalid stdio handle\n");
}
+
+/* Some variants of libstdc++ interpose _IO_2_1_stdin_ etc. and
+ install their own vtables directly, without calling _IO_init or
+ other functions. Detect this by looking at the vtables values
+ during startup, and disable vtable validation in this case. */
+#ifdef SHARED
+__attribute__ ((constructor))
+static void
+check_stdfiles_vtables (void)
+{
+ if (_IO_2_1_stdin_.vtable != &_IO_file_jumps
+ || _IO_2_1_stdout_.vtable != &_IO_file_jumps
+ || _IO_2_1_stderr_.vtable != &_IO_file_jumps)
+ IO_set_accept_foreign_vtables (&_IO_vtable_check);
+}
+#endif