The following reply was made to PR misc/151861; it has been noted by GNATS.

From: Kostik Belousov <kostik...@gmail.com>
To: Jaakko Heinonen <j...@freebsd.org>
Cc: Alexander Kabaev <kab...@gmail.com>,
        Arjan van Leeuwen <freebsd-maintai...@opera.com>,
        bug-follo...@freebsd.org, k...@freebsd.org
Subject: Re: misc/151861: dlclose() of library causes separately opened 
libraries to unload as well
Date: Wed, 3 Nov 2010 22:27:50 +0200

 --45BN1MGjfyYG1snq
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Wed, Nov 03, 2010 at 08:48:24PM +0200, Jaakko Heinonen wrote:
 > On 2010-11-03, Kostik Belousov wrote:
 > > By intermediate I mean private intermediate state in my working tree.
 > > Below is the patch augmented with the change to not call ref_dag()
 > > from init_dag().
 >=20
 > I prefer this one. Could you also add assert(root->dag_inited); to
 > ref_dag() and unref_dag()?
 
 This is reasonable but IMHO risky asserts.
 I added them as requested, will see how it going.
 
 Any further suggestions or objections ? If not, I will commit this tomorrow
 morning.
 
 diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
 index f1ffc3e..bf21586 100644
 --- a/libexec/rtld-elf/rtld.c
 +++ b/libexec/rtld-elf/rtld.c
 @@ -1276,7 +1276,7 @@ init_dag(Obj_Entry *root)
      DoneList donelist;
 =20
      if (root->dag_inited)
 -          return;
 +      return;
      donelist_init(&donelist);
      init_dag1(root, root, &donelist);
      root->dag_inited =3D true;
 @@ -1290,7 +1290,6 @@ init_dag1(Obj_Entry *root, Obj_Entry *obj, DoneList *=
 dlp)
      if (donelist_check(dlp, obj))
        return;
 =20
 -    obj->refcount++;
      objlist_push_tail(&obj->dldags, root);
      objlist_push_tail(&root->dagmembers, obj);
      for (needed =3D obj->needed;  needed !=3D NULL;  needed =3D needed->ne=
 xt)
 @@ -2031,6 +2030,7 @@ dlopen(const char *name, int mode)
            assert(*old_obj_tail =3D=3D obj);
            result =3D load_needed_objects(obj, RTLD_LO_DLOPEN);
            init_dag(obj);
 +          ref_dag(obj);
            if (result !=3D -1)
                result =3D rtld_verify_versions(&obj->dagmembers);
            if (result !=3D -1 && ld_tracing)
 @@ -2054,10 +2054,8 @@ dlopen(const char *name, int mode)
             * already loaded as a dependency, initialize the dag
             * starting at it.
             */
 -          if (obj->dl_refcount =3D=3D 1)
 -              init_dag(obj);
 -          else
 -              ref_dag(obj);
 +          init_dag(obj);
 +          ref_dag(obj);
 =20
            if (ld_tracing)
                goto trace;
 @@ -3085,6 +3083,7 @@ ref_dag(Obj_Entry *root)
  {
      Objlist_Entry *elm;
 =20
 +    assert(root->dag_inited);
      STAILQ_FOREACH(elm, &root->dagmembers, link)
        elm->obj->refcount++;
  }
 @@ -3094,6 +3093,7 @@ unref_dag(Obj_Entry *root)
  {
      Objlist_Entry *elm;
 =20
 +    assert(root->dag_inited);
      STAILQ_FOREACH(elm, &root->dagmembers, link)
        elm->obj->refcount--;
  }
 
 --45BN1MGjfyYG1snq
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (FreeBSD)
 
 iEYEARECAAYFAkzRxcYACgkQC3+MBN1Mb4i2OwCfZBkstpjnLsrNvOrdin/1W2C/
 UDoAnAjHo3/SWSm7ZC46+Vvoa7ZGI33J
 =EVSb
 -----END PGP SIGNATURE-----
 
 --45BN1MGjfyYG1snq--
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to