summaryrefslogtreecommitdiff
path: root/dlfcn/dlopen.c
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-12-18ld.so: Examine GLRO to detect inactive loader [BZ #20204]Florian Weimer
GLRO (_rtld_global_ro) is read-only after initialization and can therefore not be patched at run time, unlike the hook table addresses and their contents, so this is a desirable hardening feature. The hooks are only needed if ld.so has not been initialized, and this happens only after static dlopen (dlmopen uses a single ld.so object across all namespaces). Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-11-30Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]Florian Weimer
This change moves the main implementation of _dl_catch_error, _dl_signal_error to libc.so, where TLS variables can be used directly. This removes a writable function pointer from the rtld_global variable. For use during initial relocation, minimal implementations of these functions are provided in ld.so. These are eventually interposed by the libc.so implementations. This is implemented by compiling elf/dl-error-skeleton.c twice, via elf/dl-error.c and elf/dl-error-minimal.c. As a side effect of this change, the static version of dl-error.c no longer includes support for the _dl_signal_cerror/_dl_receive_error mechanism because it is only used in ld.so.
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-11-24Remove IS_IN_libdlSiddhesh Poyarekar
Replace with IS_IN (libdl). No changes to generated code on x86_64. * dlfcn/dladdr.c: Use IS_IN. * dlfcn/dladdr1.c: Likewise. * dlfcn/dlclose.c: Likewise. * dlfcn/dlerror.c: Likewise. * dlfcn/dlinfo.c: Likewise. * dlfcn/dlmopen.c: Likewise. * dlfcn/dlopen.c: Likewise. * dlfcn/dlsym.c: Likewise. * dlfcn/dlvsym.c: Likewise.
2014-02-10Use glibc_likely instead __builtin_expect.Ondřej Bílka
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers
2012-02-09Replace FSF snail mail address with URLs.Paul Eggert
2008-09-17* dlfcn/dlopen.c (dlopen_doit): Allow __RTLD_SPROF flag.Ulrich Drepper
Patch by Olivier Fourdan <ofourdan@redhat.com>.
2005-01-13* elf/dl-load.c (_dl_map_object_from_fd): We don't have to allowUlrich Drepper
callers from libc anymore. * elf/dl-open.c (dl_open_worker): Pass __RTLD_AUDIT flag from caller to _dl_map_object_deps. * elf/dl-load.c (_dl_map_object_from_fd): Don't change memory protections when loading auditing modules. * dlfcn/dlopen.c (dlopen_doit): Catch invalid mode arguments and fail.
2005-01-06* csu/elf-init.c (__libc_csu_fini): Don't do anything here. Ulrich Drepper
* sysdeps/generic/libc-start.c: Don't register program destructor here. * dlfcn/Makefile: Add rules to build dlfcn.c. (LDFLAGS-dl.so): Removed. * dlfcn/dlclose.c: _dl_close is now in ld.so, use function pointer table. * dlfcn/dlmopen.c: Likewise for _dl_open. * dlfcn/dlopen.c: Likewise. * dlfcn/dlopenold.c: Likewise. * elf/dl-libc.c: Likewise for _dl_open and _dl_close. * elf/Makefile (routines): Remove dl-open and dl-close. (dl-routines): Add dl-open, dl-close, and dl-trampoline. Add rules to build and run tst-audit1. * elf/tst-audit1.c: New file. * elf/tst-auditmod1.c: New file. * elf/Versions [libc]: Remove _dl_open and _dl_close. * elf/dl-close.c: Change for use inside ld.so instead of libc.so. * elf/dl-open.c: Likewise. * elf/dl-debug.c (_dl_debug_initialize): Allow reinitialization, signaled by nonzero parameter. * elf/dl-init.c: Fix use of r_state. * elf/dl-load.c: Likewise. * elf/dl-close.c: Add auditing checkpoints. * elf/dl-open.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-sym.c: Likewise. * sysdeps/generic/libc-start.c: Likewise. * elf/dl-object.c: Allocate memory for auditing information. * elf/dl-reloc.c: Remove RESOLV. We now always need the map. Correctly initialize slotinfo. * elf/dynamic-link.h: Adjust after removal of RESOLV. * sysdeps/hppa/dl-lookupcfg.h: Likewise. * sysdeps/ia64/dl-lookupcfg.h: Likewise. * sysdeps/powerpc/powerpc64/dl-lookupcfg.h: Removed. * elf/dl-runtime.c (_dl_fixup): Little cleanup. (_dl_profile_fixup): New parameters to point to register struct and variable for frame size. Add auditing checkpoints. (_dl_call_pltexit): New function. Don't define trampoline code here. * elf/rtld.c: Recognize LD_AUDIT. Load modules on startup. Remove all the functions from _rtld_global_ro which only _dl_open and _dl_close needed. Add auditing checkpoints. * elf/link.h: Define symbols for auditing interfaces. * include/link.h: Likewise. * include/dlfcn.h: Define __RTLD_AUDIT. Remove prototypes for _dl_open and _dl_close. Adjust access to argc and argv in libdl. * dlfcn/dlfcn.c: New file. * sysdeps/generic/dl-lookupcfg.h: Remove all content now that RESOLVE is gone. * sysdeps/generic/ldsodefs.h: Add definitions for auditing interfaces. * sysdeps/generic/unsecvars.h: Add LD_AUDIT. * sysdeps/i386/dl-machine.h: Remove trampoline code here. Adjust for removal of RESOLVE. * sysdeps/x86_64/dl-machine.h: Likewise. * sysdeps/generic/dl-trampoline.c: New file. * sysdeps/i386/dl-trampoline.c: New file. * sysdeps/x86_64/dl-trampoline.c: New file. * sysdeps/generic/dl-tls.c: Cleanups. Fixup for dtv_t change. Fix updating of DTV. * sysdeps/generic/libc-tls.c: Likewise. * sysdeps/arm/bits/link.h: Renamed to ... * sysdeps/arm/buts/linkmap.h: ...this. * sysdeps/generic/bits/link.h: Renamed to... * sysdeps/generic/bits/linkmap.h: ...this. * sysdeps/hppa/bits/link.h: Renamed to... * sysdeps/hppa/bits/linkmap.h: ...this. * sysdeps/hppa/i386/link.h: Renamed to... * sysdeps/hppa/i386/linkmap.h: ...this. * sysdeps/hppa/ia64/link.h: Renamed to... * sysdeps/hppa/ia64/linkmap.h: ...this. * sysdeps/hppa/s390/link.h: Renamed to... * sysdeps/hppa/s390/linkmap.h: ...this. * sysdeps/hppa/sh/link.h: Renamed to... * sysdeps/hppa/sh/linkmap.h: ...this. * sysdeps/hppa/x86_64/link.h: Renamed to... * sysdeps/hppa/x86_64/linkmap.h: ...this. 2005-01-06 Ulrich Drepper <drepper@redhat.com> * allocatestack.c (init_one_static_tls): Adjust initialization of DTV entry for static tls deallocation fix. * sysdeps/alpha/tls.h (dtv_t): Change pointer type to be struct which also contains information whether the memory pointed to is static TLS or not. * sysdeps/i386/tls.h: Likewise. * sysdeps/ia64/tls.h: Likewise. * sysdeps/powerpc/tls.h: Likewise. * sysdeps/s390/tls.h: Likewise. * sysdeps/sh/tls.h: Likewise. * sysdeps/sparc/tls.h: Likewise. * sysdeps/x86_64/tls.h: Likewise.
2004-12-22(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper
2007-07-122.5-18.1Jakub Jelinek
2004-10-18Update.cvs/fedora-glibc-20041018T2320Ulrich Drepper
2004-10-18 Jakub Jelinek <jakub@redhat.com> * elf/dl-libc.c (__libc_dlsym_private, __libc_register_dl_open_hook): New functions. (__libc_dlopen_mode): Call __libc_register_dl_open_hook and __libc_register_dlfcn_hook. * dlfcn/Makefile (routines, elide-routines.os): Set. Add rules to build and test tststatic2. * dlfcn/tststatic2.c: New test. * dlfcn/modstatic2.c: New test module. * dlfcn/dladdr.c: Call _dlfcn_hook from libdl.so if not NULL. Define __ prefixed routine in libc.a and in libdl.a just call it. * dlfcn/dladdr1.c: Likewise. * dlfcn/dlclose.c: Likewise. * dlfcn/dlerror.c: Likewise. * dlfcn/dlinfo.c: Likewise. * dlfcn/dlmopen.c: Likewise. * dlfcn/dlopen.c: Likewise. * dlfcn/dlopenold.c: Likewise. * dlfcn/dlsym.c: Likewise. * dlfcn/dlvsym.c: Likewise. * dlfcn/sdladdr.c: New file. * dlfcn/sdladdr1.c: New file. * dlfcn/sdlclose.c: New file. * dlfcn/sdlerror.c: New file. * dlfcn/sdlinfo.c: New file. * dlfcn/sdlopen.c: New file. * dlfcn/sdlsym.c: New file. * dlfcn/sdlvsym.c: New file. * dlfcn/Versions (libdl): Export _dlfcn_hook@GLIBC_PRIVATE. * include/dlfcn.h (DL_CALLER_DECL, DL_CALLER RETURN_ADDRESS): Define. (struct dlfcn_hook): New type. (_dlfcn_hook): New extern decl. (__dlopen, __dlclose, __dlsym, __dlerror, __dladdr, __dladdr1, __dlinfo, __dlmopen, __libc_dlsym_private, __libc_register_dl_open_hook, __libc_register_dlfcn_hook): New prototypes. (__dlvsym): Use DL_CALLER_DECL. * include/libc-symbols.h: Define libdl_hidden_proto and friends. * malloc/arena.c (_dl_open_hook): Extern decl. (ptmalloc_init): Don't call _dl_addr when dlopened from statically linked programs but don't use brk for them either.
2004-10-14[BZ #77]Ulrich Drepper
Update. Add support for namespaces in the dynamic linker. * dlfcn/Makefile (libdl-routines): Add dlmopen. * dlfcn/Versions [libdl, GLIBC_2.3.4]: Add dlmopen. * dlfcn/dlfcn.h: Define Lmid_t, LM_ID_BASE, and LM_ID_NEWLM. Declare dlmopen. Document RTLD_DI_LMID. * dlfcn/dlinfo.c: Handle RTLD_DI_LMID. * dlfcn/dlmopen.c: New file. * dlfcn/dlopen.c: Pass new parameter to _dl_open. * dlfcn/dlopenold.c: Likewise. * elf/dl-addr.c: Adjust for removal of GL(dl_loaded). * elf/dl-caller.c: Likewise. * elf/dl-close.c: Likewise. * elf/dl-conflict.c: Likewise. * elf/dl-debug.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-sym.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise. * elf/dl-depsc: Likewise. Add new parameter to _dl_map_object. * elf/dl-fini.c: Call destructors in all namespaces. * elf/dl-iteratephdr.c: Compute total nloaded. Adjust for removal of GL(dl_loaded). * elf/dl-libc.c: Pass new parameter to _dl_open. Adjust for removal of GL(dl_loaded). * elf/dl-load.c (_dl_map_object_from_fd): Don't load ld.so a second time. Reuse the one from the main namespace in all others. Pass new parameter to _dl_new_object. Adjust for removal of GL(dl_loaded). * elf/dl-object.c: Take new parameter. Use it to initialize l_ns. Adjust for removal of GL(dl_loaded). * elf/dl-open.c (_dl_open): Take new parameter. Adjust for removal of GL(dl_loaded). * elf/dl-support.c: Replace global _dl_loaded etc variables with _dl_ns variable. * include/dlfcn.h: Adjust prototype of _dl_open. Define __LM_ID_CALLER. * include/link.h: Add l_real, l_ns, and l_direct_opencount elements. * sysdeps/generic/dl-tls.c: Bump TLS_STATIC_SURPLUS. Since libc is using TLS we need memory appropriate to the number of namespaces. * sysdeps/generic/ldsodefs.h (struct rtld_global): Replace _dl_loaded, _dl_nloaded, _dl_global_scope, _dl_main_searchlist, and _dl_global_scope_alloc with _dl_ns element. Define DL_NNS. Adjust prototypes of _dl_map_object and member in rtld_global_ro. * malloc/malloc.c: Include <dlfcn.h>. * malloc/arena.c (ptmalloc_init): If libc is not in primary namespace, never use brk. * elf/Makefile: Add rules to build and run tst-dlmopen1 and tst-dlmopen2. * elf/tst-dlmopen1.c: New file. * elf/tst-dlmopen1mod.c: New file. * elf/tst-dlmopen2.c: New file. * elf/dl-close.c: Improve reference counting by tracking direct loads. * elf/dl-lookup.c (add_dependency): Likewise. * elf/dl-open.c (dl_open_worker): Likewise. * elf/rtld.c (dl_main): Likewise. 2004-09-09 GOTO Masanori <gotom@debian.or.jp> [BZ #77] * elf/dl-close.c: Count down l_opencount to check not only for l_reldeps, but also l_initfini. 2004-10-13 Ulrich Drepper <drepper@redhat.com>
2003-09-19Update.Ulrich Drepper
2003-09-19 Jakub Jelinek <jakub@redhat.com> * dlfcn/dlopen.c (dlopen): Add static_link_warning.
2001-07-06Update to LGPL v2.1.Andreas Jaeger
2001-07-06 Paul Eggert <eggert@twinsun.com> * manual/argp.texi: Remove ignored LGPL copyright notice; it's not appropriate for documentation anyway. * manual/libc-texinfo.sh: "Library General Public License" -> "Lesser General Public License". 2001-07-06 Andreas Jaeger <aj@suse.de> * All files under GPL/LGPL version 2: Place under LGPL version 2.1.
2000-11-29Update.Ulrich Drepper
* dlfcn/defaultmod1.c: Add prototypes to avoid warnings. * dlfcn/defaultmod2.c: Likewise. * dlfcn/dlopen.c: Likewise. * dlfcn/dlopenold.c: Likewise. * dlfcn/failtestmod.c: Likewise. * dlfcn/glreflib1.c: Likewise. * dlfcn/glreflib2.c: Likewise. * dlfcn/eval.c: Likewise. Add attributes. * ctype/ctype-extn.c: Define isblank and not __isblank.
2000-07-21Update.Ulrich Drepper
* elf/Makefile (tests): Add nodlopen. Add rules to generate nodlopen. * include/dlfcn.h: Define __RTLD_DLOPEN. * elf/dl-load.c (_dl_map_object_from_fd): If DF_1_NOOPEN is set and this is a dlopen() call, do not load the binary. * dlfcn/dlopen.c: Add __RTLD_DLOPEN to mode passed down to _dl_open. * dlfcn/dlopenold.c: Likewise. * configure.in: Add test for -z nodelete option. * config.make.in: Define have-z-nodelete with libc_cv_z_nodelete. 2000-07-20 Mark Kettenis <kettenis@gnu.org> Make Hesiod NSS module thread-safe. * hesiod/README.hesiod: Update. * hesiod/Versions [GLIBC_2.2]: Add _nss_hesiod_getservbyport_r, _nss_hesiod_setprotoent, _nss_hesiod_endprotoent, _nss_hesiod_getprotobyname_r, and _nss_hesiod_getprotobynumber_r. * hesiod/Makefile (libnss_hesiod-routines): Add hesiod-init and hesiod-proto. * hesiod/nss_hesiod/hesiod-init.c: New file. * hesiod/nss_hesiod/hesiod-pwd.c: Rewritten for thread-safeness. * hesiod/nss_hesiod/hesiod-grp.c: Likewise. * hesiod/nss_hesiod/nss_hesiod.h: New file. * hesiod/nss_hesiod/hesiod-service.c (_nss_hesiod_getservbyport_r): New function. Provide support for looking up services by port number. * hesiod/nss_hesiod/hesiod-proto.c: New file. * hesiod/hesiod.c: Update from BIND 8.2.3-T5B. * hesiod/hesiod.h: Likewise. * hesiod/hesiod_p.h: Likewise. 2000-07-20 Mark Kettenis <kettenis@gnu.org> Fix problems with `struct __res_state' getting too big. * resolv/resolv.h (struct __sockaddr_in): New definition. (struct __res_state): Use __sockaddr_in instead of sockaddr_in in the private parts of the structure to save some space. * resolv/res_send.c (res_nsend): Cast &EXT(statp).nsaddrs[ns] to (struct sockaddr_in *) in call to sock_eq. Use memcpy to copy statp->nsaddr_list[ns] to &EXT(statp).nsaddrs[ns]. 2000-07-20 Ulrich Drepper <drepper@redhat.com> * sysdeps/mach/hurd/dl-sysdep.c: Likewise.
2000-07-18Update.Ulrich Drepper
2000-07-18 Kaz Kylheku <kaz@ashi.footprints.net> * spinlock.c (__pthread_alt_lock, __pthread_alt_timedlock): Fixed bug whereby thr field of waitnode structure would not be correctly set unless a null self pointer is passed to the functions. Eliminated redundant calls to thread_self().
2000-03-27* dlfcn/dlopen.c: Use <shlib-compat.h> macros.Roland McGrath
* dlfcn/dlopenold.c: Likewise. * nss/getXXbyYY_r.c: Likewise. * nss/getXXent_r.c: Likewise. * hurd/hurdinit.c: Likewise. * hurd/compat-20.c: Likewise. * libio/oldiofopen.c: Likewise. * libio/oldiofclose.c: Likewise. * libio/oldiofdopen.c: Likewise. * libio/oldfileops.c: Likewise. * libio/oldstdfiles.c: Likewise. * libio/oldiofsetpos.c: Likewise. * libio/oldiofgetpos.c: Likewise. * libio/oldiofgetpos64.c: Likewise. * libio/oldiofsetpos64.c: Likewise. * libio/oldiopopen.c: Likewise. * libio/oldpclose.c: Likewise. * libio/oldtmpfile.c: Likewise. * libio/freopen.c (freopen): Likewise. * libio/iofclose.c (_IO_new_fclose): Likewise.
2000-02-23Update.Ulrich Drepper
2000-02-23 Andreas Jaeger <aj@suse.de> * dlfcn/dlopen.c: Include <stddef.h> for NULL. * dlfcn/dlsym.c: Likewise. * dlfcn/dlvsym.c: Likewise. * iconv/gconv.c: Likewise.
1999-07-07Update.Ulrich Drepper
* sysdeps/gnu/Makefile (libdl-routines): Add eval. 1999-07-06 Zack Weinberg <zack@rabi.columbia.edu> * dlfcn: New directory. Move the following files from elf: dladdr.c, dlclose.c, dlerror.c, dlfcn.h, dlopen.c, dlopenold.c, dlsym.c, dlvsym.c. * dlfcn/Makefile: New file. * dlfcn/Versions: New file. * dlfcn/dlsym.c: All ELF-specific code split out to new function _dl_sym. * dlfcn/dlvsym.c: All ELF-specific code split out to new function _dl_vsym. * elf/dl-sym.c: New file. _dl_sym and _dl_vsym are implemented here. * dlfcn/dladdr.c: Remove all references to ELF data structures or headers. * dlfcn/dlclose.c: Likewise. * dlfcn/dlerror.c: Likewise. * dlfcn/dlopen.c: Likewise. * dlfcn/dlopenold.c: Likewise. * Makeconfig (dlfcn): New variable - set to `dlfcn' if elf is yes, empty otherwise. (libdl): Set to dlfcn/libdl.so or libdl.a if elf is yes, depending on build-shared. (subdirs): Add $(dlfcn). (rpath-dirs): Add dlfcn. * elf/Makefile: Remove all references to libdl or its components, except the ones relating to the test cases. (routines): Add dl-sym. * elf/Versions (libc): Add _dl_sym and _dl_vsym for GLIBC_2.2. (libdl): Delete. * elf/dl-close.c (_dl_close): Change argument to void *. * elf/dl-open.c (_dl_open): Change return type to void *. * elf/eval.c: Removed. * elf/ldsodefs.h: Move prototypes of _dl_catch_error, _dlerror_run, _dl_open, _dl_close, _dl_addr, and _dl_mcount_wrapper_check to include/dlfcn.h. Delete _CALL_DL_FCT macro. * include/dlfcn.h: Also prototype _dl_sym and _dl_vsym here. Include real header from dlfcn directory. * include/ldsodefs.h: Removed. * grp/initgroups.c: Use DL_CALL_FCT not _CALL_DL_FCT. * nss/getXXbyYY_r.c: Likewise. * nss/getXXent_r.c: Likewise. * iconv/gconv.c: Likewise. Don't include ldsodefs.h. * iconv/gconv_db.c: Likewise. Don't include ldsodefs.h. * iconv/skeleton.c: Don't include ldsodefs.h. * nss/nsswitch.h: Don't include ldsodefs.h. Include dlfcn.h. 1999-07-07 Ulrich Drepper <drepper@cygnus.com>