[Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
zhuizhuhaomeng at gmail dot com
sourceware-bugzilla@sourceware.org
Wed May 19 01:59:41 GMT 2021
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
--- Comment #2 from lijunlong <zhuizhuhaomeng at gmail dot com> ---
The patch is here. Added an attachment also.
diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c
index 17aaec386..fc388aaf2 100644
--- a/runtime/task_finder_vma.c
+++ b/runtime/task_finder_vma.c
@@ -54,7 +54,7 @@ struct __stp_tf_vma_entry {
struct task_struct *tsk;
unsigned long vm_start;
unsigned long vm_end;
- unsigned long offset;
+ unsigned long offset; //offset from base addr of the module
char path[TASK_FINDER_VMA_ENTRY_PATHLEN]; /* mmpath name, if known */
// User data (possibly stp_module)
@@ -243,7 +243,7 @@ stap_add_vma_map_info(struct task_struct *tsk, unsigned
long vm_start,
}
stp_spin_lock_irqsave(&bucket->lock, flags);
- hlist_add_head_rcu(&entry->hlist, &bucket->head);
+ hlist_add_tail_rcu(&entry->hlist, &bucket->head);
stp_spin_unlock_irqrestore(&bucket->lock, flags);
return 0;
}
@@ -303,7 +303,7 @@ stap_find_vma_map_info(struct task_struct *tsk, unsigned
long addr,
bucket = __stp_tf_get_vma_bucket(tsk);
entry = __stp_tf_get_vma_map(bucket, tsk, 1, addr >= entry->vm_start &&
- addr < entry->vm_end);
+ addr <= entry->vm_end);
if (!entry)
return -ESRCH;
diff --git a/runtime/vma.c b/runtime/vma.c
index 2bf1b0a9c..78623fda3 100644
--- a/runtime/vma.c
+++ b/runtime/vma.c
@@ -185,14 +185,15 @@ static int _stp_vma_mmap_cb(struct
stap_task_finder_target *tgt,
module,
&vm_start, &vm_end,
NULL);
- if (res == -ESRCH || vm_start + offset == addr)
+ if (res == -ESRCH)
res = stap_add_vma_map_info(tsk->group_leader,
- addr, addr + length,
- offset, path, module);
- else if (res == 0 && vm_end + 1 == addr)
- res = stap_extend_vma_map_info(tsk->group_leader,
- vm_start,
- addr + length);
+ addr, addr + length,
+ 0, path, module);
+ else
+ res = stap_add_vma_map_info(tsk->group_leader,
+ addr, addr + length,
+ addr - vm_start, path,
module);
+
/* VMA entries are allocated dynamically, this is
fine,
* since we are in a task_finder callback, which is
in
* user context. */
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Systemtap
mailing list