diff options
author | Florian Weimer <fweimer@redhat.com> | 2018-02-21 10:37:22 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-02-21 10:37:22 +0100 |
commit | 52a01100ad011293197637e42b5be1a479a2f4ae (patch) | |
tree | 8bfbd570b7eda10ee7de5fcb8ce430c1043af0f0 /elf/dl-load.c | |
parent | b5bf62e40c5ff4e3906572f257dcda77b393ffa0 (diff) | |
download | glibc-52a01100ad011293197637e42b5be1a479a2f4ae.tar.gz glibc-52a01100ad011293197637e42b5be1a479a2f4ae.tar.xz glibc-52a01100ad011293197637e42b5be1a479a2f4ae.zip |
elf: Remove ad-hoc restrictions on dlopen callers [BZ #22787]
This looks like a post-exploitation hardening measure: If an attacker is able to redirect execution flow, they could use that to load a DSO which contains additional code (or perhaps make the stack executable). However, the checks are not in the correct place to be effective: If they are performed before the critical operation, an attacker with sufficient control over execution flow could simply jump directly to the code which performs the operation, bypassing the check. The check would have to be executed unconditionally after the operation and terminate the process in case a caller violation was detected. Furthermore, in _dl_check_caller, there was a fallback reading global writable data (GL(dl_rtld_map).l_map_start and GL(dl_rtld_map).l_text_end), which could conceivably be targeted by an attacker to disable the check, too. Other critical functions (such as system) remain completely unprotected, so the value of these additional checks does not appear that large. Therefore this commit removes this functionality.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r-- | elf/dl-load.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c index 7554a99b5a..a5e3a25462 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -33,7 +33,6 @@ #include "dynamic-link.h" #include <abi-tag.h> #include <stackinfo.h> -#include <caller.h> #include <sysdep.h> #include <stap-probe.h> #include <libc-pointer-arith.h> @@ -1183,12 +1182,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, if (__glibc_unlikely ((stack_flags &~ GL(dl_stack_flags)) & PF_X)) { - if (__glibc_unlikely (__check_caller (RETURN_ADDRESS (0), allow_ldso) != 0)) - { - errstring = N_("invalid caller"); - goto call_lose; - } - /* The stack is presently not executable, but this module requires that it be executable. We must change the protection of the variable which contains the flags used in |