summaryrefslogtreecommitdiff
path: root/libio/iopopen.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/iopopen.c
parent64ba17317dc9343f0958755ad04af71ec3da637b (diff)
downloadglibc-db3476aff19b75c4fdefbe65fcd5f0a90588ba51.tar.gz
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/iopopen.c')
-rw-r--r--libio/iopopen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libio/iopopen.c b/libio/iopopen.c
index 9ddde23494..d85370c01f 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -287,9 +287,9 @@ _IO_new_popen (const char *command, const char *mode)
new_f->fpx.file.file._lock = &new_f->lock;
#endif
fp = &new_f->fpx.file.file;
- _IO_init (fp, 0);
+ _IO_init_internal (fp, 0);
_IO_JUMPS (&new_f->fpx.file) = &_IO_proc_jumps;
- _IO_new_file_init (&new_f->fpx.file);
+ _IO_new_file_init_internal (&new_f->fpx.file);
#if !_IO_UNIFIED_JUMPTABLES
new_f->fpx.file.vtable = NULL;
#endif
@@ -344,7 +344,7 @@ _IO_new_proc_close (_IO_FILE *fp)
return wstatus;
}
-static const struct _IO_jump_t _IO_proc_jumps = {
+static const struct _IO_jump_t _IO_proc_jumps libio_vtable = {
JUMP_INIT_DUMMY,
JUMP_INIT(finish, _IO_new_file_finish),
JUMP_INIT(overflow, _IO_new_file_overflow),