delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/08/21/14:11:46

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=zg4nvZFRbRW8G29Wq75zPVL3RdyTiBPQ1E7txV4ekAY=;
b=MvHo3gn3SXfUc+Uw6X+bBq79a5Az1ZyYUicsZEae3J2RzVczt0vKDnTY2bLUScPo+X
9TAHi41v/iIk2+ZzZq89px00ILx/RMRYlgeqDdA+Tkzx9oOQD5o1aLddve31IloE3BpN
P7EaK0UtXbJK9Hf/LQ62w/i1Bcsgcr3mrm/z/M36fOvXckpvFyJBNzwwoKON0Q10iAMD
0xXtag48QY23RG9CLiFYKQa8jmPz3983YXhHkWIzRQp4+Q5nGrH7badnsJQnrmqpi5zh
ZX+je9AFvojNou+8PufMR6/DmRbE/wEnK11UktkoXWMM41GZjwsaiMm287OYDkh46rEQ
sQng==
MIME-Version: 1.0
X-Received: by 10.107.27.195 with SMTP id b186mr9876898iob.140.1440180695060;
Fri, 21 Aug 2015 11:11:35 -0700 (PDT)
In-Reply-To: <9b5a08e9-6c0c-4a4c-a21c-4376212ff994@googlegroups.com>
References: <CAA2C=vA6taarO7vJhQkrqSbozn=KeKhDwh7w1E3bysAC3QJk+g AT mail DOT gmail DOT com>
<CAA2C=vCr3P9qnLZoW+YmaRCpQUf5XNmKYZh+eULi1mnb1rdnNw AT mail DOT gmail DOT com>
<9b5a08e9-6c0c-4a4c-a21c-4376212ff994 AT googlegroups DOT com>
Date: Fri, 21 Aug 2015 21:11:34 +0300
Message-ID: <CAA2C=vB4MvyB=c8VWKaOcdg4bDEFN==uX=_KHorade6uv7e8_g@mail.gmail.com>
Subject: Re: dlopen() failure with ELOOP with legitimate dxe
From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
To: djgpp AT delorie DOT com
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 8/21/15, Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via
djgpp AT delorie DOT com] <djgpp AT delorie DOT com> wrote:
> On Friday, August 21, 2015 at 5:26:09 PM UTC+2, Ozkan Sezer
> (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com] wrote:
>> On 8/21/15, Ozkan Sezer <sezeroz AT gmail DOT com> wrote:
>> > There is a bug in dlopen() preventing dlopen()ing a dxe.
>> > Here is the scenario, what we experienced with q2dos:
>> >
>> > ref_soft.dxe -> has no dependency dxes
>> > ref_gl.dxe -> depends on gl.dxe (present)
>> > gl.dxe -> depends on glide3x.dxe (not present)
>> >
>> > Start the exe, dlopen()s ref_soft.dxe -> OK, runs just fine.
>> >
>> > Do a dlclose() ref_soft.dxe, and attempt to dlopen() ref_gl.dxe:
>> > fails, no surprise, (dlerror() misleadingly says ENOENT, but ok)
>> >
>> > The failure triggers dlopen()ing of ref_soft.dxe again: it fails
>> > with ELOOP which is NOT expected because the dxe is there and it
>> > is legitimate and it loaded and ran successfully the first time.
>> >
>> > As far as I can see, the "Load the dependencies" loop around line
>> > 237 of dlopen.c does not reset stk_top upon failure which should
>> > be the reason for failure of further dlopen() attempts?
>> >
>>
>> Applied the following change  to dlopen.c and the failure is gone:
>>
>> Index: dlopen.c
>> ===================================================================
>> RCS file: /cvs/djgpp/djgpp/src/libc/dxe/dlopen.c,v
>> retrieving revision 1.8
>> diff -u -p -r1.8 dlopen.c
>> --- dlopen.c	27 Jun 2015 12:21:06 -0000	1.8
>> +++ dlopen.c	21 Aug 2015 15:16:41 -0000
>> @@ -243,8 +243,10 @@ found:
>>      tmp.next = stk_top;
>>      stk_top = &tmp;
>>
>> -    if (dlopen(scan, RTLD_GLOBAL) == NULL)
>> +    if (dlopen(scan, RTLD_GLOBAL) == NULL) {
>> +      stk_top = tmp.next;
>>        goto unrecoverable;
>> +    }
>>
>>      stk_top = tmp.next;
>>
>>
>> Comments?  OK to apply?
>>
>> --
>> O.S.
>
> Looks OK to me.  If the patch is applied it should also be applied to the
> v2_05_1 branch so the library can be recompiled with this new fix before
> DJGPP 2.05 becomes official.
>
> Regards,
> Juan M. Guerrero
>

Patch applied to both HEAD and to v2_05_1
Thanks.

--
O.S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019