From 5ff28c970c91c88811e98a59e857c9f1123aa471 Mon Sep 17 00:00:00 2001 From: Junlong Li Date: Wed, 9 Jun 2021 09:49:14 -0400 Subject: [PATCH] Allow for adjacent segments belonging to different modules. Do not merge adjacent memory segments if they are from different shared libraries that happen to be loaded adjacent to each other. --- runtime/vma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/vma.c b/runtime/vma.c index 78623fda3..b614340f3 100644 --- a/runtime/vma.c +++ b/runtime/vma.c @@ -149,6 +149,7 @@ static int _stp_vma_mmap_cb(struct stap_task_finder_target *tgt, { int i, res; struct _stp_module *module = NULL; + void *ori_mod = NULL; const char *name = ((dentry != NULL) ? (char *)dentry->d_name.name : NULL); @@ -167,7 +168,8 @@ static int _stp_vma_mmap_cb(struct stap_task_finder_target *tgt, // We register whether or not we know the module, // so we can later lookup the name given an address for this task. if (path != NULL && - stap_find_vma_map_info(tsk, addr, NULL, NULL, NULL, NULL, NULL) != 0) { + (stap_find_vma_map_info(tsk->group_leader, addr, NULL, NULL, NULL, NULL, &ori_mod) != 0 || + ori_mod != module)) { for (i = 0; i < _stp_num_modules; i++) { // PR20433: papering over possibility of NULL pointers if (strcmp(path ?: "", _stp_modules[i]->path ?: "") == 0) -- 2.43.5