[PATCH] os: don't ignore failure from dladdr

Cyril Brulebois kibi at debian.org
Fri Dec 30 17:29:20 PST 2011


Julien Cristau <jcristau at debian.org> (30/12/2011):
> If dladdr returns 0, don't go and use the returned Dl_info, it may
> contain garbage.
> 
> X.Org bug#44315 <https://bugs.freedesktop.org/show_bug.cgi?id=44315>
> 
> Reported-and-tested-by: Cyril Brulebois <kibi at debian.org>
> Signed-off-by: Julien Cristau <jcristau at debian.org>
> ---
>  os/backtrace.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/os/backtrace.c b/os/backtrace.c
> index 58b4b1f..298bf18 100644
> --- a/os/backtrace.c
> +++ b/os/backtrace.c
> @@ -46,7 +46,11 @@ void xorg_backtrace(void)
>      ErrorF("\nBacktrace:\n");
>      size = backtrace(array, 64);
>      for (i = 0; i < size; i++) {
> -	dladdr(array[i], &info);
> +	int rc = dladdr(array[i], &info);
> +	if (rc == 0) {
> +	    ErrorF("%d: ?? [%p]\n", i, array[i]);
> +	    continue;
> +	}
>  	mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)";
>  	if (info.dli_saddr)
>  	    ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod,
> -- 

Reviewed-by: Cyril Brulebois <kibi at debian.org>

I'll probably propose that commit along with the ia64 build fix for a
pull later today.

Mraw,
KiBi.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111231/00b07102/attachment.pgp>


More information about the xorg-devel mailing list