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

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 10.182.24.196 with SMTP id w4mr6467705obf.19.1440179356836;
Fri, 21 Aug 2015 10:49:16 -0700 (PDT)
X-Received: by 10.182.81.72 with SMTP id y8mr152971obx.15.1440179356808; Fri,
21 Aug 2015 10:49:16 -0700 (PDT)
Newsgroups: comp.os.msdos.djgpp
Date: Fri, 21 Aug 2015 10:49:16 -0700 (PDT)
In-Reply-To: <CAA2C=vCr3P9qnLZoW+YmaRCpQUf5XNmKYZh+eULi1mnb1rdnNw@mail.gmail.com>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.192.116.175;
posting-account=OsAajgoAAADdKJnkJkmhzqP0jo6I_P_0
NNTP-Posting-Host: 109.192.116.175
References: <CAA2C=vA6taarO7vJhQkrqSbozn=KeKhDwh7w1E3bysAC3QJk+g AT mail DOT gmail DOT com>
<CAA2C=vCr3P9qnLZoW+YmaRCpQUf5XNmKYZh+eULi1mnb1rdnNw AT mail DOT gmail DOT com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9b5a08e9-6c0c-4a4c-a21c-4376212ff994@googlegroups.com>
Subject: Re: dlopen() failure with ELOOP with legitimate dxe
From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Injection-Date: Fri, 21 Aug 2015 17:49:16 +0000
Bytes: 3280
Lines: 53
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
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 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

- Raw text -


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