mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
@ -64,7 +64,7 @@ _IO_strn_overflow (_IO_FILE *fp, int c)
|
||||
}
|
||||
|
||||
|
||||
const struct _IO_jump_t _IO_strn_jumps attribute_hidden =
|
||||
const struct _IO_jump_t _IO_strn_jumps libio_vtable attribute_hidden =
|
||||
{
|
||||
JUMP_INIT_DUMMY,
|
||||
JUMP_INIT(finish, _IO_str_finish),
|
||||
|
Reference in New Issue
Block a user