NetBSD Problem Report #49813

From www@NetBSD.org  Sat Apr  4 17:12:27 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 35743A654B
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  4 Apr 2015 17:12:27 +0000 (UTC)
Message-Id: <20150404171225.E7E02A65B9@mollari.NetBSD.org>
Date: Sat,  4 Apr 2015 17:12:25 +0000 (UTC)
From: stassats@gmail.com
Reply-To: stassats@gmail.com
To: gnats-bugs@NetBSD.org
Subject: dladdr on non-existent address may cause a deadlock
X-Send-Pr-Version: www-1.0

>Number:         49813
>Category:       lib
>Synopsis:       dladdr on non-existent address may cause a deadlock
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 04 17:15:00 +0000 2015
>Closed-Date:    Mon Apr 06 12:43:29 +0000 2015
>Last-Modified:  Mon Apr 06 12:43:29 +0000 2015
>Originator:     Stas
>Release:        6.1.6
>Organization:
>Environment:
>Description:
In the dladdr function in
http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/ld.elf_so/rtld.c?rev=1.173.4.1&content-type=text/x-cvsweb-markup
(can't figure out how to link to a specific line, here's a github link: https://github.com/jsonn/src/blob/c44251ea512cf59e9825553cb119f9eeeacfd250/libexec/ld.elf_so/rtld.c#L1270-1272 )

presumably, it should be lookup_mutex_exit, not _enter, otherwise it will cause a deadlock.
>How-To-Repeat:
#include <dlfcn.h>
#include <stdlib.h>

int main ()
{
  Dl_info dlinfo;
  dladdr(1234, &dlinfo);
  exit(0);
}

=>

#0  0x00007f7ff7c0d51a in ___lwp_park50 () from /usr/libexec/ld.elf_so
#1  0x00007f7ff7c0582c in _rtld_exclusive_enter () from /usr/libexec/ld.elf_so
#2  0x00007f7ff7c06dae in _rtld_exit () from /usr/libexec/ld.elf_so
#3  0x00007f7ff78cc0e7 in __cxa_finalize () from /usr/lib/libc.so.12
#4  0x00007f7ff78cbe3e in exit () from /usr/lib/libc.so.12
#5  0x000000000040095f in main ()
>Fix:

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 06 Apr 2015 12:43:29 +0000
State-Changed-Why:
fixed in rtld.c 1.176


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.