Avoid keeping a dangling pointer when the mappings array is resized.
Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
85d88d8799
commit
2c73c414eb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323227
@ -72,7 +72,7 @@ struct proc_handle {
|
|||||||
struct map_info *mappings; /* File mappings for proc. */
|
struct map_info *mappings; /* File mappings for proc. */
|
||||||
size_t maparrsz; /* Map array size. */
|
size_t maparrsz; /* Map array size. */
|
||||||
size_t nmappings; /* Number of mappings. */
|
size_t nmappings; /* Number of mappings. */
|
||||||
prmap_t *exec_map; /* Executable text mapping. */
|
size_t exec_map; /* Executable text mapping index. */
|
||||||
lwpstatus_t lwps; /* Process status. */
|
lwpstatus_t lwps; /* Process status. */
|
||||||
struct procstat *procstat; /* libprocstat handle. */
|
struct procstat *procstat; /* libprocstat handle. */
|
||||||
char execpath[PATH_MAX]; /* Path to program executable. */
|
char execpath[PATH_MAX]; /* Path to program executable. */
|
||||||
|
@ -62,7 +62,7 @@ map_iter(const rd_loadobj_t *lop, void *arg)
|
|||||||
rdl2prmap(lop, &mapping->map);
|
rdl2prmap(lop, &mapping->map);
|
||||||
if (strcmp(lop->rdl_path, phdl->execpath) == 0 &&
|
if (strcmp(lop->rdl_path, phdl->execpath) == 0 &&
|
||||||
(lop->rdl_prot & RD_RDL_X) != 0)
|
(lop->rdl_prot & RD_RDL_X) != 0)
|
||||||
phdl->exec_map = &mapping->map;
|
phdl->exec_map = phdl->nmappings;
|
||||||
|
|
||||||
file = NULL;
|
file = NULL;
|
||||||
if (lop->rdl_path[0] != '\0') {
|
if (lop->rdl_path[0] != '\0') {
|
||||||
|
@ -511,7 +511,8 @@ _proc_name2map(struct proc_handle *p, const char *name)
|
|||||||
return (&p->mappings[i]);
|
return (&p->mappings[i]);
|
||||||
}
|
}
|
||||||
if (strcmp(name, "a.out") == 0)
|
if (strcmp(name, "a.out") == 0)
|
||||||
return (_proc_addr2map(p, p->exec_map->pr_vaddr));
|
return (_proc_addr2map(p,
|
||||||
|
p->mappings[p->exec_map].map.pr_vaddr));
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user