any chance for an explicitely runnable runtime linker?

u-uclibc-y2lt at aetey.se u-uclibc-y2lt at aetey.se
Fri Sep 16 21:27:23 UTC 2011


On Thu, Sep 15, 2011 at 02:52:22PM +0200, Carmelo AMOROSO wrote:
> You are referring to stand-alone execution mode.
> It is support in master now. You need to configure uClibc to enebale it.

Hello Carmelo,

enjoying the functionality, so thanks again!

Nevertheless:

I have found a subtle bug in the corresponding code (besides possible
unexpected searches depending on the contents of argv[0] and cwd,
a segfault when argv[0] lacks '/'), a naive fix is as follows:
(otherwise ignoring argv[0] unless it is an absolute path would be more robust)
----
--- ldso/ldso/ldso.c.ori        2011-09-16 22:31:21.000000000 +0200
+++ ldso/ldso/ldso.c    2011-09-16 22:58:17.000000000 +0200
@@ -570,8 +570,10 @@
                 */
                _dl_ldsopath = _dl_strdup(tpnt->libname);
                ptmp = _dl_strrchr(_dl_ldsopath, '/');
-               if (ptmp != _dl_ldsopath)
-                       *ptmp = '\0';
+               if (ptmp && ptmp != _dl_ldsopath)
+                       *ptmp = '\0'; /* leaking some string memory */
+               else
+                       _dl_ldsopath = NULL; /* leaking the whole string memory */
 
                _dl_debug_early("Lib Loader: (%x) %s\n", (unsigned) DL_LOADADDR_BASE(tpnt->loadaddr), tpnt->libname);
        } else {
@@ -682,8 +684,10 @@
                                 */
                                _dl_ldsopath = _dl_strdup(tpnt->libname);
                                ptmp = _dl_strrchr(_dl_ldsopath, '/');
-                               if (ptmp != _dl_ldsopath)
-                                       *ptmp = '\0';
+                               if (ptmp && ptmp != _dl_ldsopath)
+                                       *ptmp = '\0'; /* leaking some string memory */
+                               else
+                                       _dl_ldsopath = NULL; /* leaking the whole string memory */
                        }
                        _dl_debug_early("Lib Loader: (%x) %s\n", (unsigned) DL_LOADADDR_BASE(tpnt->loadaddr), tpnt->libname);
 #endif
----

Regards,
Rune



More information about the uClibc mailing list