mirror of
https://sourceware.org/git/glibc.git
synced 2025-09-02 16:01:20 +03:00
Prevent loader from loading itself
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2011-05-30 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
* elf/rtld.c (dl_main): Don't allow the loader to load itself.
|
||||||
|
|
||||||
2011-05-29 Ulrich Drepper <drepper@gmail.com>
|
2011-05-29 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
[BZ #12350]
|
[BZ #12350]
|
||||||
|
@@ -1076,6 +1076,14 @@ of this helper program; chances are you did not intend to run this program.\n\
|
|||||||
/* Now the map for the main executable is available. */
|
/* Now the map for the main executable is available. */
|
||||||
main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
main_map = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||||
|
|
||||||
|
if (GL(dl_rtld_map).l_info[DT_SONAME] != NULL
|
||||||
|
&& main_map->l_info[DT_SONAME] != NULL
|
||||||
|
&& strcmp ((const char *) D_PTR (&GL(dl_rtld_map), l_info[DT_STRTAB])
|
||||||
|
+ GL(dl_rtld_map).l_info[DT_SONAME]->d_un.d_val,
|
||||||
|
(const char *) D_PTR (main_map, l_info[DT_STRTAB])
|
||||||
|
+ main_map->l_info[DT_SONAME]->d_un.d_val) == 0)
|
||||||
|
_dl_fatal_printf ("loader cannot load itself\n");
|
||||||
|
|
||||||
phdr = main_map->l_phdr;
|
phdr = main_map->l_phdr;
|
||||||
phnum = main_map->l_phnum;
|
phnum = main_map->l_phnum;
|
||||||
/* We overwrite here a pointer to a malloc()ed string. But since
|
/* We overwrite here a pointer to a malloc()ed string. But since
|
||||||
|
Reference in New Issue
Block a user