about summary refs log tree commit diff
path: root/libio/obprintf.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-06-23 20:01:40 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-06-23 20:01:52 +0200
commitdb3476aff19b75c4fdefbe65fcd5f0a90588ba51 (patch)
tree5cefd4971a0e6b5d5f9eacf6d3532c6aedc7b352 /libio/obprintf.c
parent64ba17317dc9343f0958755ad04af71ec3da637b (diff)
downloadglibc-db3476aff19b75c4fdefbe65fcd5f0a90588ba51.tar.gz
glibc-db3476aff19b75c4fdefbe65fcd5f0a90588ba51.tar.xz
glibc-db3476aff19b75c4fdefbe65fcd5f0a90588ba51.zip
libio: Implement vtable verification [BZ #20191]
This commit puts all libio vtables in a dedicated, read-only ELF
section, so that they are consecutive in memory.  Before any indirect
jump, the vtable pointer is checked against the section boundaries,
and the process is terminated if the vtable pointer does not fall into
the special ELF section.

To enable backwards compatibility, a special flag variable
(_IO_accept_foreign_vtables), protected by the pointer guard, avoids
process termination if libio stream object constructor functions have
been called earlier.  Such constructor functions are called by the GCC
2.95 libstdc++ library, and this mechanism ensures compatibility with
old binaries.  Existing callers inside glibc of these functions are
adjusted to call the original functions, not the wrappers which enable
vtable compatiblity.

The compatibility mechanism is used to enable passing FILE * objects
across a static dlopen boundary, too.
Diffstat (limited to 'libio/obprintf.c')
-rw-r--r--libio/obprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libio/obprintf.c b/libio/obprintf.c
index aa17b46da8..d7144e8e39 100644
--- a/libio/obprintf.c
+++ b/libio/obprintf.c
@@ -91,7 +91,7 @@ _IO_obstack_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n)
 
 
 /* the jump table.  */
-const struct _IO_jump_t _IO_obstack_jumps attribute_hidden =
+const struct _IO_jump_t _IO_obstack_jumps libio_vtable attribute_hidden =
 {
   JUMP_INIT_DUMMY,
   JUMP_INIT(finish, NULL),