[PATCH] MIPS LDSO: pass sym_ref parameter to _dl_find_hash() to support PROTECTED symbols

Carmelo AMOROSO carmelo.amoroso at st.com
Mon Apr 18 06:45:55 UTC 2011


On 4/15/2011 7:25 PM, maksim.rayskiy at gmail.com wrote:
> From: Maksim Rayskiy <mrayskiy at broadcom.com>
> 
> _dl_find_hash() relies on sym_ref parameter to check if the looked-up symbol
> is protected. The code fixes a case when _dl_perform_mips_global_got_relocations()
> was calling _dl_find_hash() without providing sym_ref parameter.
> The bug was causing hangs if a library exporting non-protected symbol was earlier in
> link order than library with the same symbol declared as protected.
> 
> Signed-off-by: Maksim Rayskiy <mrayskiy at broadcom.com>
> ---
>  ldso/ldso/mips/elfinterp.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
> index 2886f33..82f740d 100644
> --- a/ldso/ldso/mips/elfinterp.c
> +++ b/ldso/ldso/mips/elfinterp.c
> @@ -378,8 +378,11 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy)
>  					*got_entry += (unsigned long) tpnt->loadaddr;
>  			}
>  			else {
> +				struct symbol_ref sym_ref;
> +				sym_ref.sym = sym;
> +				sym_ref.tpnt = NULL;
>  				*got_entry = (unsigned long) _dl_find_hash(strtab +
> -					sym->st_name, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
> +					sym->st_name, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, &sym_ref);
>  			}
>  
>  			got_entry++;

Applied, thanks.

Carmelo



More information about the uClibc mailing list