From: "zhuizhuhaomeng at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
Date: Wed, 19 May 2021 01:59:41 +0000 [thread overview]
Message-ID: <bug-27881-6586-GZGLwA9ZLs@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27881-6586@http.sourceware.org/bugzilla/>
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.
next prev parent reply other threads:[~2021-05-19 1:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 3:12 [Bug runtime/27881] New: " zhuizhuhaomeng at gmail dot com
2021-05-19 1:58 ` [Bug runtime/27881] " zhuizhuhaomeng at gmail dot com
2021-05-19 1:59 ` zhuizhuhaomeng at gmail dot com [this message]
2021-05-22 0:26 ` zhuizhuhaomeng at gmail dot com
2021-05-22 0:26 ` zhuizhuhaomeng at gmail dot com
2021-05-27 20:18 ` scox at redhat dot com
2021-05-27 20:19 ` scox at redhat dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-27881-6586-GZGLwA9ZLs@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=systemtap@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).