diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 12 | ||||
-rw-r--r-- | sysdeps/i386/dl-lookupcfg.h | 4 | ||||
-rw-r--r-- | sysdeps/i386/dl-machine.h | 8 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-lookupcfg.h | 4 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-machine.h | 8 |
5 files changed, 31 insertions, 5 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index d738988..7a0fe8d 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -105,13 +105,23 @@ typedef struct link_map *lookup_t; satisfied by any symbol in the executable. Some architectures do not support copy relocations. In this case we define the macro to zero so that the code for handling them gets automatically optimized - out. */ + out. ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA means address of protected + data defined in the shared library may be external, i.e., due to copy + relocation. */ #define ELF_RTYPE_CLASS_PLT 1 #ifndef DL_NO_COPY_RELOCS # define ELF_RTYPE_CLASS_COPY 2 #else # define ELF_RTYPE_CLASS_COPY 0 #endif +/* If DL_EXTERN_PROTECTED_DATA is defined, address of protected data + defined in the shared library may be external, i.e., due to copy + relocation. */ +#ifdef DL_EXTERN_PROTECTED_DATA +# define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 4 +#else +# define ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA 0 +#endif /* ELF uses the PF_x macros to specify the segment permissions, mmap uses PROT_xxx. In most cases the three macros have the values 1, 2, diff --git a/sysdeps/i386/dl-lookupcfg.h b/sysdeps/i386/dl-lookupcfg.h index 9310296..310f261 100644 --- a/sysdeps/i386/dl-lookupcfg.h +++ b/sysdeps/i386/dl-lookupcfg.h @@ -20,6 +20,10 @@ #include_next <dl-lookupcfg.h> +/* Address of protected data defined in the shared library may be + external due to copy relocation. */ +#define DL_EXTERN_PROTECTED_DATA + struct link_map; extern void internal_function _dl_unmap (struct link_map *map); diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index ce5f50f..04f9247 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -206,13 +206,17 @@ _dl_start_user:\n\ TLS variable, so undefined references should not be allowed to define the value. ELF_RTYPE_CLASS_COPY iff TYPE should not be allowed to resolve to one - of the main executable's symbols, as for a COPY reloc. */ + of the main executable's symbols, as for a COPY reloc. + ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA iff TYPE describes relocation may + against protected data whose address be external due to copy relocation. + */ # define elf_machine_type_class(type) \ ((((type) == R_386_JMP_SLOT || (type) == R_386_TLS_DTPMOD32 \ || (type) == R_386_TLS_DTPOFF32 || (type) == R_386_TLS_TPOFF32 \ || (type) == R_386_TLS_TPOFF || (type) == R_386_TLS_DESC) \ * ELF_RTYPE_CLASS_PLT) \ - | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY)) + | (((type) == R_386_COPY) * ELF_RTYPE_CLASS_COPY) \ + | (((type) == R_386_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA)) /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ #define ELF_MACHINE_JMP_SLOT R_386_JMP_SLOT diff --git a/sysdeps/x86_64/dl-lookupcfg.h b/sysdeps/x86_64/dl-lookupcfg.h index 9310296..310f261 100644 --- a/sysdeps/x86_64/dl-lookupcfg.h +++ b/sysdeps/x86_64/dl-lookupcfg.h @@ -20,6 +20,10 @@ #include_next <dl-lookupcfg.h> +/* Address of protected data defined in the shared library may be + external due to copy relocation. */ +#define DL_EXTERN_PROTECTED_DATA + struct link_map; extern void internal_function _dl_unmap (struct link_map *map); diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index fa9b3af..cae6db3 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -170,7 +170,10 @@ _dl_start_user:\n\ TLS variable, so undefined references should not be allowed to define the value. ELF_RTYPE_CLASS_COPY iff TYPE should not be allowed to resolve to one - of the main executable's symbols, as for a COPY reloc. */ + of the main executable's symbols, as for a COPY reloc. + ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA iff TYPE describes relocation may + against protected data whose address be external due to copy relocation. + */ #define elf_machine_type_class(type) \ ((((type) == R_X86_64_JUMP_SLOT \ || (type) == R_X86_64_DTPMOD64 \ @@ -178,7 +181,8 @@ _dl_start_user:\n\ || (type) == R_X86_64_TPOFF64 \ || (type) == R_X86_64_TLSDESC) \ * ELF_RTYPE_CLASS_PLT) \ - | (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY)) + | (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY) \ + | (((type) == R_X86_64_GLOB_DAT) * ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA)) /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ #define ELF_MACHINE_JMP_SLOT R_X86_64_JUMP_SLOT |