The XXX comment right above there says what we really want. It should have
the read-from-core option in its back pocket and do that only when locating
a disk file by build-id failed. I've lost track now of how much
refactoring would be required to do that.
At least in Fedora/RH-flavored distros the file generally is available on
disk (/lib/modules/V-R.A/vdso/*.so). But I guess you still don't have a
pointer to that keyed on build-id unless you've installed the debuginfo
package. (I said years ago that someone should integrate some build-id
knowledge magic into rpm or something, so that you can readily look up by
build-id every binary installed via your package system.)
But I can't think of a real downside to using the in-core image when it is
the whole file. That logic applies at least as well when the data is
mmap'd, so the core->map_address check should move before the build-id
check, shouldn't it?
And I think you should rewrite the comment:
if (whole > MAX_EAGER_COST && mod->build_id_len > 0)
/* We can't cheaply read the whole file here, so we'd
be using a partial file. But there is a build ID that could
help us find the whole file, which might be more useful than
what we have. We'll just rely on that. */
return false;
Thanks,
Roland