librtld_db: Handle anonymous mappings below the first file mapping.
r360979 erroneously assumed that the lowest mapping in an address space would be a file mapping, but of course this is not true in general. Reported and tested by: Frederic Chardon <chardon.frederic@gmail.com> MFC after: 3 days
This commit is contained in:
parent
16c0b6eef9
commit
13776bf736
@ -186,12 +186,16 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void *clnt_data)
|
|||||||
* file, but we want the mapping offset relative to the base
|
* file, but we want the mapping offset relative to the base
|
||||||
* mapping.
|
* mapping.
|
||||||
*/
|
*/
|
||||||
if (kve->kve_type == KVME_TYPE_VNODE &&
|
if (kve->kve_type == KVME_TYPE_VNODE) {
|
||||||
kve->kve_vn_fileid != fileid) {
|
if (kve->kve_vn_fileid != fileid) {
|
||||||
base = kve->kve_start;
|
base = kve->kve_start;
|
||||||
fileid = kve->kve_vn_fileid;
|
fileid = kve->kve_vn_fileid;
|
||||||
path = kve->kve_path;
|
path = kve->kve_path;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
base = 0;
|
||||||
|
path = NULL;
|
||||||
|
}
|
||||||
memset(&rdl, 0, sizeof(rdl));
|
memset(&rdl, 0, sizeof(rdl));
|
||||||
/*
|
/*
|
||||||
* Map the kinfo_vmentry struct to the rd_loadobj structure.
|
* Map the kinfo_vmentry struct to the rd_loadobj structure.
|
||||||
@ -205,6 +209,7 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void *clnt_data)
|
|||||||
rdl.rdl_prot |= RD_RDL_W;
|
rdl.rdl_prot |= RD_RDL_W;
|
||||||
if (kve->kve_protection & KVME_PROT_EXEC)
|
if (kve->kve_protection & KVME_PROT_EXEC)
|
||||||
rdl.rdl_prot |= RD_RDL_X;
|
rdl.rdl_prot |= RD_RDL_X;
|
||||||
|
if (path != NULL)
|
||||||
strlcpy(rdl.rdl_path, path, sizeof(rdl.rdl_path));
|
strlcpy(rdl.rdl_path, path, sizeof(rdl.rdl_path));
|
||||||
if ((*cb)(&rdl, clnt_data) != 0) {
|
if ((*cb)(&rdl, clnt_data) != 0) {
|
||||||
ret = RD_ERR;
|
ret = RD_ERR;
|
||||||
|
Loading…
Reference in New Issue
Block a user