Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Mar 2006 14:17:53 +0100
From:      Rudolf Cejka <cejkar@fit.vutbr.cz>
To:        Daniel Eischen <deischen@freebsd.org>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, "M. Warner Losh" <imp@bsdimp.com>
Subject:   Re: cvs commit: src/lib/libc Makefile
Message-ID:  <20060317131753.GA76715@fit.vutbr.cz>
In-Reply-To: <Pine.GSO.4.43.0603161331380.5331-100000@sea.ntplx.net>
References:  <Pine.GSO.4.43.0603161331380.5331-100000@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen wrote (2006/03/16):
>   No, this doesn't fix linuxpluginwrappers.
> if you want to take a try at it.

Hello, I have written an e-mail about this to kan and nork at Feb 24,
but still without response. Bellow is my mail and the patches. Currently,
I think that it would be great to have some mechanism, which can disable
elf versioning by typing something into libmap.conf - it can be useful in
many other cases in the future I hope. But the better solution than that
showed below, which disables versioning for objects in [...] with atleast
one real mapping (if I remember correctly, what I realy did :o), would be
to have some syntax, which can directly disable versioning for objects
in [...] without any real mappings. Two example solutions:
1) [...] are object with versioning, {...} or [[...]] or (...) would be
   objects with versioning disabled
2) [...] with following line like versioning enable/disable would change
   versioning respectively
(So I moved from real mappings "src dst" in libmap.conf mentioned in
e-mails to objects in "[...]", where it seems that it should be.)

Rudolf Cejka wrote (2006/02/24):
> Hello,
>   I tried to make some patches and the result now is working
> linuxpluginwrapper in 7-current again. The patches are in an attachment,
> where their only purpose is to switch off checking of versions for objects
> mapped in libmap.conf. I'm not sure how usable are the patches and how
> usable is it for public, however it seems that the patches do the right
> work for me.
>
> Regards.
>
> Rudolf Cejka wrote (2006/02/23):
> >   I'm trying to look at solving problem about now broken linuxpluginwrapper
> > in 7-current by recently implemented ELF versioning. Did you talked about
> > it with anybody already?
> >
> > I would like to solve it just by patching linuxpluginwrapper, however
> > it showed me that it would be big amount of work: The easy step is
> > for making versioned wrapping libraries like
> >     libc.so.6                       pluginwrapper/flash6.so
> > in /etc/libmap.conf, but workaround for references to our native
> > libraries (? - I did not take care abour exact versions yet :o) like
> >     libz.so.1                       libz.so.3
> > would be much harder and I think that it leads to implementation
> > of versioning into libmap.conf too, or making another wrapping libraries,
> > which is mostly waste of time.
> > Now it seems to me that before we get modified libmap.conf in
> > this not so easy way, we can add relatively simple thing into
> > libmap.conf, which would increase meaning of libmap.conf: What
> > about adding some flag into libmap.conf, which would switch
> > off version checking for particular line in libmap.conf - is
> > it ever possible? I did not look at this possibility yet,
> > hopefully later today. Or do you have any other ideas?
> >
> > I think that it would help in another cases, where there is
> > an application and a library, which do not want to work together
> > because of different symbol versions and libmap.conf with line
> > like ("-" as a "do not check versions")
> >     libc.so.6                       -libc.so.6
> > would help in this case. What do you think about it?
>
> The final solution for me was to switch off versioning for
> lines like
> [/usr/X11R6/lib/linux-flashplugin6/libflashplayer.so]
> in libmap.conf without any other option.

--- libexec/rtld-elf/rtld.h.orig	Fri Feb 24 11:59:12 2006
+++ libexec/rtld-elf/rtld.h	Fri Feb 24 14:29:14 2006
@@ -185,6 +185,8 @@
     Elf_Word verdefnum;		/* Number of entries in verdef table */
     const Elf_Versym *versyms;  /* Symbol versions table */
 
+    bool mapped;		/* True if it is mapped by libmap.conf */
+
     const Elf_Hashelt *buckets;	/* Hash table buckets array */
     unsigned long nbuckets;	/* Number of buckets */
     const Elf_Hashelt *chains;	/* Hash table chain array */
--- libexec/rtld-elf/rtld.c.orig	Thu Feb 23 22:11:54 2006
+++ libexec/rtld-elf/rtld.c	Fri Feb 24 16:07:41 2006
@@ -90,7 +90,7 @@
 static void errmsg_restore(char *);
 static char *errmsg_save(void);
 static void *fill_search_info(const char *, size_t, void *);
-static char *find_library(const char *, const Obj_Entry *);
+static char *find_library(const char *, Obj_Entry *);
 static const char *gethints(void);
 static void init_dag(Obj_Entry *);
 static void init_dag1(Obj_Entry *root, Obj_Entry *obj, DoneList *);
@@ -103,7 +103,7 @@
 static void linkmap_delete(Obj_Entry *);
 static int load_needed_objects(Obj_Entry *);
 static int load_preload_objects(void);
-static Obj_Entry *load_object(const char *, const Obj_Entry *);
+static Obj_Entry *load_object(const char *, Obj_Entry *);
 static Obj_Entry *obj_from_addr(const void *);
 static void objlist_call_fini(Objlist *);
 static void objlist_call_init(Objlist *);
@@ -895,7 +895,7 @@
  *   /lib:/usr/lib
  */
 static char *
-find_library(const char *xname, const Obj_Entry *refobj)
+find_library(const char *xname, Obj_Entry *refobj)
 {
     char *pathname;
     char *name;
@@ -909,9 +909,13 @@
 	return xstrdup(xname);
     }
 
-    if (libmap_disable || (refobj == NULL) ||
-	(name = lm_find(refobj->path, xname)) == NULL)
+    if (libmap_disable || refobj == NULL)
 	name = (char *)xname;
+    else
+	if ((name = lm_find(refobj->path, xname)) == NULL)
+	    name = (char *)xname;
+	else
+	    refobj->mapped = true;
 
     dbg(" Searching for \"%s\"", name);
 
@@ -1244,7 +1248,7 @@
  * on failure.
  */
 static Obj_Entry *
-load_object(const char *name, const Obj_Entry *refobj)
+load_object(const char *name, Obj_Entry *refobj)
 {
     Obj_Entry *obj;
     int fd = -1;
@@ -3048,6 +3052,8 @@
     vername = refobj->strtab + vna->vna_name;
     vd = depobj->verdef;
     if (vd == NULL) {
+	if (refobj->mapped)
+	    return (0);
 	_rtld_error("%s: version %s required by %s not defined",
 	    depobj->path, vername, refobj->path);
 	return (-1);
@@ -3070,6 +3076,8 @@
     }
     if (vna->vna_flags & VER_FLG_WEAK)
 	return (0);
+    if (refobj->mapped)
+        return (0);
     _rtld_error("%s: version %s required by %s not found",
 	depobj->path, vername, refobj->path);
     return (-1);

-- 
Rudolf Cejka <cejkar at fit.vutbr.cz> http://www.fit.vutbr.cz/~cejkar
Brno University of Technology, Faculty of Information Technology
Bozetechova 2, 612 66  Brno, Czech Republic



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060317131753.GA76715>