diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-06-23 20:01:40 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-06-23 20:01:52 +0200 |
commit | db3476aff19b75c4fdefbe65fcd5f0a90588ba51 (patch) | |
tree | 5cefd4971a0e6b5d5f9eacf6d3532c6aedc7b352 /Makerules | |
parent | test-skeleton.c (xrealloc): Support realloc-as-free (diff) | |
download | glibc-db3476aff19b75c4fdefbe65fcd5f0a90588ba51.tar.gz glibc-db3476aff19b75c4fdefbe65fcd5f0a90588ba51.tar.bz2 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 'Makerules')
-rw-r--r-- | Makerules | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -562,6 +562,9 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules PROVIDE(__start___libc_thread_subfreeres = .);\ __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\ PROVIDE(__stop___libc_thread_subfreeres = .);\ + PROVIDE(__start___libc_IO_vtables = .);\ + __libc_IO_vtables : { *(__libc_IO_vtables) }\ + PROVIDE(__stop___libc_IO_vtables = .);\ /DISCARD/ : { *(.gnu.glibc-stub.*) }@' test -s $@T mv -f $@T $@ |