svn commit: r361844 - head/lib/librtld_db
Mark Johnston
markj at FreeBSD.org
Fri Jun 5 18:44:15 UTC 2020
Author: markj
Date: Fri Jun 5 18:44:14 2020
New Revision: 361844
URL: https://svnweb.freebsd.org/changeset/base/361844
Log:
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 at gmail.com>
MFC after: 3 days
Modified:
head/lib/librtld_db/rtld_db.c
Modified: head/lib/librtld_db/rtld_db.c
==============================================================================
--- head/lib/librtld_db/rtld_db.c Fri Jun 5 18:37:04 2020 (r361843)
+++ head/lib/librtld_db/rtld_db.c Fri Jun 5 18:44:14 2020 (r361844)
@@ -186,11 +186,15 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void
* file, but we want the mapping offset relative to the base
* mapping.
*/
- if (kve->kve_type == KVME_TYPE_VNODE &&
- kve->kve_vn_fileid != fileid) {
- base = kve->kve_start;
- fileid = kve->kve_vn_fileid;
- path = kve->kve_path;
+ if (kve->kve_type == KVME_TYPE_VNODE) {
+ if (kve->kve_vn_fileid != fileid) {
+ base = kve->kve_start;
+ fileid = kve->kve_vn_fileid;
+ path = kve->kve_path;
+ }
+ } else {
+ base = 0;
+ path = NULL;
}
memset(&rdl, 0, sizeof(rdl));
/*
@@ -205,7 +209,8 @@ rd_loadobj_iter(rd_agent_t *rdap, rl_iter_f *cb, void
rdl.rdl_prot |= RD_RDL_W;
if (kve->kve_protection & KVME_PROT_EXEC)
rdl.rdl_prot |= RD_RDL_X;
- strlcpy(rdl.rdl_path, path, sizeof(rdl.rdl_path));
+ if (path != NULL)
+ strlcpy(rdl.rdl_path, path, sizeof(rdl.rdl_path));
if ((*cb)(&rdl, clnt_data) != 0) {
ret = RD_ERR;
break;
More information about the svn-src-all
mailing list