diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-06-18 16:50:39 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2021-10-07 10:26:48 -0700 |
commit | 349b0441dab375099b1d7f6909c1742286a67da9 (patch) | |
tree | 398336e60fdfc9d0ea7b52b2b63d2c37b5996ac5 /elf/dl-lookup.c | |
parent | 1bd888d0b705fa5ab7b443724288f7ba12939533 (diff) | |
download | glibc-349b0441dab375099b1d7f6909c1742286a67da9.tar.gz glibc-349b0441dab375099b1d7f6909c1742286a67da9.tar.xz glibc-349b0441dab375099b1d7f6909c1742286a67da9.zip |
Add run-time check for indirect external access
When performing symbol lookup for references in executable without indirect external access: 1. Disallow copy relocations in executable against protected data symbols in a shared object with indirect external access. 2. Disallow non-zero symbol values of undefined function symbols in executable, which are used as the function pointer, against protected function symbols in a shared object with indirect external access. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/dl-lookup.c')
-rw-r--r-- | elf/dl-lookup.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index eea217eb28..430359af39 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -24,6 +24,7 @@ #include <ldsodefs.h> #include <dl-hash.h> #include <dl-machine.h> +#include <dl-protected.h> #include <sysdep-cancel.h> #include <libc-lock.h> #include <tls.h> @@ -527,6 +528,10 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash, if (__glibc_unlikely (dl_symbol_visibility_binds_local_p (sym))) goto skip; + if (ELFW(ST_VISIBILITY) (sym->st_other) == STV_PROTECTED) + _dl_check_protected_symbol (undef_name, undef_map, ref, map, + type_class); + switch (ELFW(ST_BIND) (sym->st_info)) { case STB_WEAK: |