glibc/elf/Versions
Florian Weimer 6f85dbf102 Detect ld.so and libc.so version inconsistency during startup
The files NEWS, include/link.h, and sysdeps/generic/ldsodefs.h
contribute to the version fingerprint used for detection.  The
fingerprint can be further refined using the --with-extra-version-id
configure argument.

_dl_call_libc_early_init is replaced with _dl_lookup_libc_early_init.
The new function is used store a pointer to libc.so's
__libc_early_init function in the libc_map_early_init member of the
ld.so namespace structure.  This function pointer can then be called
directly, so the separate invocation function is no longer needed.

The versioned symbol lookup needs the symbol versioning data
structures, so the initialization of libc_map and libc_map_early_init
is now done from _dl_check_map_versions, after this information
becomes available.  (_dl_map_object_from_fd does not set this up
in time, so the initialization code had to be moved from there.)
This means that the separate initialization code can be removed from
dl_main because _dl_check_map_versions covers all maps, including
the initial executable loaded by the kernel.  The lookup still happens
before relocation and the invocation of IFUNC resolvers, so IFUNC
resolvers are protected from ABI mismatch.

The __libc_early_init function pointer is not protected because
so little code runs between the pointer write and the invocation
(only dynamic linker code and IFUNC resolvers).

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-24 17:35:57 +02:00

89 lines
2.2 KiB
Plaintext

libc {
GLIBC_2.0 {
%ifdef EXPORT_UNWIND_FIND_FDE
__deregister_frame_info; __register_frame_info;
%endif
}
GLIBC_2.1 {
# functions used in other libraries
_dl_mcount_wrapper; _dl_mcount_wrapper_check;
}
GLIBC_2.2.4 {
dl_iterate_phdr;
}
%ifdef EXPORT_UNWIND_FIND_FDE
# Needed for SHLIB_COMPAT calls using this version.
GLIBC_2.2.5 {
}
GCC_3.0 {
__deregister_frame_info_bases; __register_frame_info_bases;
__register_frame_info_table_bases; _Unwind_Find_FDE;
}
%endif
GLIBC_2.35 {
_dl_find_object;
}
GLIBC_ABI_DT_RELR {
# This symbol is used only for empty version map and will be removed
# by scripts/versions.awk.
__placeholder_only_for_empty_version_map;
}
GLIBC_PRIVATE {
# A pattern is needed here because the suffix is dynamically generated.
__libc_early_init_*;
# Internal error handling support. Interposes the functions in ld.so.
_dl_signal_exception; _dl_catch_exception;
_dl_signal_error; _dl_catch_error;
}
}
ld {
GLIBC_2.0 {
_r_debug;
}
GLIBC_2.1 {
# functions used in other libraries
_dl_mcount;
# historically used by Garbage Collectors
__libc_stack_end;
}
GLIBC_2.3 {
# runtime interface to TLS
__tls_get_addr;
}
GLIBC_2.4 {
# stack canary
__stack_chk_guard;
}
GLIBC_2.34 {
__rtld_version_placeholder;
}
GLIBC_PRIVATE {
# Those are in the dynamic linker, but used by libc.so.
__libc_enable_secure;
_dl_allocate_tls; _dl_allocate_tls_init;
_dl_argv; _dl_find_dso_for_object; _dl_get_tls_static_info;
_dl_deallocate_tls; _dl_make_stack_executable;
_dl_rtld_di_serinfo; _dl_starting_up; _dl_fatal_printf;
_dl_audit_symbind_alt; _dl_audit_preinit;
_rtld_global; _rtld_global_ro;
# Only here for gdb while a better method is developed.
_dl_debug_state;
# Pointer protection.
__pointer_chk_guard;
# Internal error handling support.
_dl_exception_create; _dl_exception_create_format; _dl_exception_free;
# Internal error handling support. Interposed by libc.so.
_dl_signal_exception; _dl_catch_exception;
_dl_signal_error; _dl_catch_error;
# Set value of a tunable.
__tunable_get_val;
}
}