This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]


On 02/09/2016 07:31 AM, Florian Weimer wrote:
I'm not sure if this is the right fix.  I traced back the lack of error
reporting to the original addition of the RTLD_NEXT functionality.  I
don't know why it was omitted from it.

I happened to come across the corresponding bug in Red Hat Bugzilla
and wanted to chime in on the patch.

POSIX requires dlerror() to return a non-null string after a dynamic
linking error.  After a failed call to dlopen(), dlclose(), or dlsym(),
POSIX says that "More detailed diagnostic information shall be
available through dlerror()."  dlerror() is required to return null
only when no error has occurred since the last call to the function,
or on failure.  (It doesn't matter that RTLD_NEXT isn't fully
specified by POSIX.)

So AFAICS, the patch does the right thing.  I would only suggest to
enhance the test to verify that dlerror() does return a null pointer
when no error has occurred (e.g., the second call to dlerror() with
no other intervening dlxxx() calls should return null).

If there isn't already a test in the test suite that exercises
the interaction of dladdr() and dlerrror() (I couldn't find one)
it would be worth adding one to verify that a failed dladdr()
doesn't affect dlerrror() (it doesn't seem to in my testing).
But that's probably outside of the scope of this bug fix.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]