[PATCH] [BZ #18422] elf/tst-audit tests fail without PLT entries
H.J. Lu
hjl.tools@gmail.com
Tue May 26 13:03:00 GMT 2015
On Tue, May 26, 2015 at 1:00 AM, Andreas Schwab <schwab@suse.de> wrote:
> "Carlos O'Donell" <carlos@redhat.com> writes:
>
>> In summary:
>> - My next worry is about free of calloc'd data that is now using dl-minimal.c
>
> Anything allocated with dl-minimal must strictly be kept inside ld.so
> and never be freed.
The calloc call is made at:
if (__glibc_unlikely (consider_profiling)
&& l->l_info[DT_PLTRELSZ] != NULL)
{
/* Allocate the array which will contain the already found
relocations. If the shared object lacks a PLT (for example
if it only contains lead function) the l_info[DT_PLTRELSZ]
will be NULL. */
size_t sizeofrel = l->l_info[DT_PLTREL]->d_un.d_val == DT_RELA
? sizeof (ElfW(Rela))
: sizeof (ElfW(Rel));
size_t relcount = l->l_info[DT_PLTRELSZ]->d_un.d_val / sizeofrel;
l->l_reloc_result = calloc (sizeof (l->l_reloc_result[0]), relcount);
if (l->l_reloc_result == NULL)
{
errstring = N_("\
%s: out of memory to store relocation results for %s\n");
_dl_fatal_printf (errstring, RTLD_PROGNAME, l->l_name);
}
}
ld.so never frees l->l_reloc_result.
--
H.J.
More information about the Libc-alpha
mailing list