The root of the problem here is that TAILQ_FOREACH_FROM will default to
the head of the list if passed NULL.
Before r294373, this code was:
if (handle == RTLD_NEXT) obj = obj->next; for (; obj != NULL; obj = obj->next) {
After r294373 it was:
if (handle == RTLD_NEXT) obj = globallist_next(obj); TAILQ_FOREACH_FROM(obj, &obj_list, next) {
TAILQ_FOREACH_FROM expands to:
for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); (var); (var) = TAILQ_NEXT((var), field))
Thus if passed NULL it defaults to the head of the list. The code here would
end up iterating over all shared libraries and eventually find the current
shared library and return the symbol from itself.
Sponsored by: EMC / Isilon Storage Division
MFC after: 1 week