diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/dlfcn.h | 27 | ||||
-rw-r--r-- | include/link.h | 75 |
2 files changed, 86 insertions, 16 deletions
diff --git a/include/dlfcn.h b/include/dlfcn.h index bfa1b9041b..460c037ed1 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -7,9 +7,24 @@ #define __RTLD_SPROF 0x40000000 #define __RTLD_OPENEXEC 0x20000000 #define __RTLD_CALLMAP 0x10000000 +#define __RTLD_AUDIT 0x08000000 #define __LM_ID_CALLER -2 +#ifdef SHARED +/* Locally stored program arguments. */ +extern int __dlfcn_argc attribute_hidden; +extern char **__dlfcn_argv attribute_hidden; +#else +/* These variables are defined and initialized in the startup code. */ +extern int __libc_argc attribute_hidden; +extern char **__libc_argv attribute_hidden; + +# define __dlfcn_argc __libc_argc +# define __dlfcn_argv __libc_argv +#endif + + /* Now define the internal interfaces. */ #define __libc_dlopen(name) \ @@ -29,18 +44,8 @@ extern int _dl_addr (const void *address, Dl_info *info, libc_hidden_proto (_dl_addr) #endif -/* Open the shared object NAME, relocate it, and run its initializer if it - hasn't already been run. MODE is as for `dlopen' (see <dlfcn.h>). If - the object is already opened, returns its existing map. */ -extern void *_dl_open (const char *name, int mode, const void *caller, - Lmid_t nsid) - internal_function; -libc_hidden_proto (_dl_open) - /* Close an object previously opened by _dl_open. */ -extern void _dl_close (void *map) - internal_function; -libc_hidden_proto (_dl_close) +extern void _dl_close (void *map) attribute_hidden; /* Look up NAME in shared object HANDLE (which may be RTLD_DEFAULT or RTLD_NEXT). WHO is the calling function, for RTLD_NEXT. Returns diff --git a/include/link.h b/include/link.h index 3078b72a87..49e0e1b041 100644 --- a/include/link.h +++ b/include/link.h @@ -34,6 +34,7 @@ #include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */ #include <bits/link.h> +#include <bits/linkmap.h> #include <dl-lookupcfg.h> #include <tls.h> /* Defines USE_TLS. */ @@ -199,6 +200,10 @@ struct link_map should be called on this link map when relocation finishes. */ unsigned int l_used:1; /* Nonzero if the DSO is used. */ + unsigned int l_auditing:1; /* Nonzero if the DSO is used in auditing. */ + unsigned int l_audit_any_plt:1; /* Nonzero if at least one audit module + is interested in the PLT interception.*/ + /* Array with version names. */ unsigned int l_nversions; struct r_found_version *l_versions; @@ -207,7 +212,14 @@ struct link_map struct r_search_path_struct l_rpath_dirs; /* Collected results of relocation while profiling. */ - ElfW(Addr) *l_reloc_result; + struct reloc_result + { + ElfW(Addr) addr; + struct link_map *bound; + unsigned int boundndx; + uint32_t enterexit; + unsigned int flags; + } *l_reloc_result; /* Pointer to the version information if available. */ ElfW(Versym) *l_versyms; @@ -263,11 +275,7 @@ struct link_map { const ElfW(Sym) *sym; int type_class; -#ifdef DL_LOOKUP_RETURNS_MAP struct link_map *value; -#else - ElfW(Addr) value; -#endif const ElfW(Sym) *ret; } l_lookup_cache; @@ -297,8 +305,65 @@ struct link_map done. */ ElfW(Addr) l_relro_addr; size_t l_relro_size; + + /* Audit information. This array apparent must be the last in the + structure. Never add something after it. */ + struct auditstate + { + uintptr_t cookie; + unsigned int bindflags; + } l_audit[0]; + }; + +/* Version numbers for la_version handshake interface. */ +#define LAV_CURRENT 1 + +/* Activity types signaled through la_activity. */ +enum + { + LA_ACT_CONSISTENT, + LA_ACT_ADD, + LA_ACT_DELETE + }; + +/* Values representing origin of name for dynamic loading. */ +enum + { + LA_SER_ORIG = 0x01, /* Original name. */ + LA_SER_LIBPATH = 0x02, /* Directory from LD_LIBRARY_PATH. */ + LA_SER_RUNPATH = 0x04, /* Directory from RPATH/RUNPATH. */ + LA_SER_CONFIG = 0x08, /* Found through ldconfig. */ + LA_SER_DEFAULT = 0x40, /* Default directory. */ + LA_SER_SECURE = 0x80 /* Unused. */ + }; + +/* Values for la_objopen return value. */ +enum + { + LA_FLG_BINDTO = 0x01, /* Audit symbols bound to this object. */ + LA_FLG_BINDFROM = 0x02 /* Audit symbols bound from this object. */ }; +/* Values for la_symbind flags parameter. */ +enum + { + LA_SYMB_NOPLTENTER = 0x01, /* la_pltenter will not be called. */ + LA_SYMB_NOPLTEXIT = 0x02, /* la_pltexit will not be called. */ + LA_SYMB_STRUCTCALL = 0x04, /* Return value is a structure. */ + LA_SYMB_DLSYM = 0x08, /* Binding due to dlsym call. */ + LA_SYMB_ALTVALUE = 0x10 /* Value has been changed by a previous + la_symbind call. */ + }; + +#if __ELF_NATIVE_CLASS == 32 +# define symbind symbind32 +# define pltenter plt +#elif __ELF_NATIVE_CLASS == 64 +# define symbind symbind64 +#else +# error "__ELF_NATIVE_CLASS must be defined" +#endif + struct dl_phdr_info { ElfW(Addr) dlpi_addr; |