segv if loading first shobj fails

Corey Minyard cminyard@mvista.com
Mon Jul 29 10:01:00 GMT 2002


In a patch I have to mlock() executables into memory, I noticed that if 
loading the first shobj fails, the code will segv.  In the lose() 
function in dl-load.c, there is:

#ifndef SHARED
      if (l->l_prev == NULL)
        /* No other module loaded.  */
        _dl_loaded = NULL;
      else
#endif
        l->l_prev->l_next = NULL;

If the first shobj fails, the l->l_prev will be NULL.  I'm not sure if 
it would be better to remove the #ifndef, or add another check.  This is 
in glibc-2.2.5.

And unfortunately, I don't know a good way to build a testcase without 
changing the code or using a bogus shobj.

-Corey



More information about the Libc-alpha mailing list