* [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent
@ 2021-05-18 3:12 zhuizhuhaomeng at gmail dot com
2021-05-19 1:58 ` [Bug runtime/27881] " zhuizhuhaomeng at gmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zhuizhuhaomeng at gmail dot com @ 2021-05-18 3:12 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
Bug ID: 27881
Summary: failed to extend vma mapped entry when the address is
adjacent
Product: systemtap
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: runtime
Assignee: systemtap at sourceware dot org
Reporter: zhuizhuhaomeng at gmail dot com
Target Milestone: ---
[root@centos7-cube agentzh]# cat /proc/7877/maps | grep nginx
5579ad030000-5579ad067000 r--p 00000000 fd:00 54825380
/usr/local/openresty-plus/nginx/sbin/nginx
5579ad067000-5579ad180000 r-xp 00037000 fd:00 54825380
/usr/local/openresty-plus/nginx/sbin/nginx
5579ad180000-5579ad1ce000 r--p 00150000 fd:00 54825380
/usr/local/openresty-plus/nginx/sbin/nginx
5579ad1cf000-5579ad1d1000 r--p 0019e000 fd:00 54825380
/usr/local/openresty-plus/nginx/sbin/nginx
5579ad1d1000-5579ad1ef000 rw-p 001a0000 fd:00 54825380
/usr/local/openresty-plus/nginx/sbin/nginx
the first two segments are adjacent but stap did not extend the second to the
first. Instead, stap add two entries. entry_2, entry_1 in the list with
hlist_add_head_rcu.
the third,fourth ,fifth segments were not added because they can not match the
if condition below.
if (res == -ESRCH || vm_start + offset == addr)
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);
when access a global variable,_stp_umodule_relocate will use the entry_2's
vm_start as base address. actually, should use the first entry's vm_start as
the base address.
if (stap_find_vma_map_info_user(tsk->group_leader, m,
&vm_start, NULL, NULL) == 0) {
offset += vm_start;
dbug_sym(1, "address=%lx\n", offset);
return offset;
}
when get the relative address in _stp_kallsyms_lookup, we should also use the
first entry's vm_start as the base address.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent zhuizhuhaomeng at gmail dot com
@ 2021-05-19 1:58 ` zhuizhuhaomeng at gmail dot com
2021-05-19 1:59 ` zhuizhuhaomeng at gmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zhuizhuhaomeng at gmail dot com @ 2021-05-19 1:58 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
--- Comment #1 from lijunlong <zhuizhuhaomeng at gmail dot com> ---
Created attachment 13461
--> https://sourceware.org/bugzilla/attachment.cgi?id=13461&action=edit
vma user module mapped entries
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent 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
2021-05-22 0:26 ` zhuizhuhaomeng at gmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zhuizhuhaomeng at gmail dot com @ 2021-05-19 1:59 UTC (permalink / raw)
To: systemtap
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent 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
@ 2021-05-22 0:26 ` zhuizhuhaomeng at gmail dot com
2021-05-22 0:26 ` zhuizhuhaomeng at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: zhuizhuhaomeng at gmail dot com @ 2021-05-22 0:26 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
--- Comment #3 from lijunlong <zhuizhuhaomeng at gmail dot com> ---
Created attachment 13464
--> https://sourceware.org/bugzilla/attachment.cgi?id=13464&action=edit
fixed coding style
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent zhuizhuhaomeng at gmail dot com
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: zhuizhuhaomeng at gmail dot com @ 2021-05-22 0:26 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
--- Comment #4 from lijunlong <zhuizhuhaomeng at gmail dot com> ---
I have updated the patch to fix coding style.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent zhuizhuhaomeng at gmail dot com
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: scox at redhat dot com @ 2021-05-27 20:18 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
Stan Cox <scox at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-05-27
Ever confirmed|0 |1
CC| |scox at redhat dot com
Status|UNCONFIRMED |ASSIGNED
--- Comment #5 from Stan Cox <scox at redhat dot com> ---
An alternate hlist_add_tail_rcu needs to be provided for those kernels that
don't have it.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug runtime/27881] failed to extend vma mapped entry when the address is adjacent
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent zhuizhuhaomeng at gmail dot com
` (4 preceding siblings ...)
2021-05-27 20:18 ` scox at redhat dot com
@ 2021-05-27 20:19 ` scox at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: scox at redhat dot com @ 2021-05-27 20:19 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=27881
Stan Cox <scox at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|systemtap at sourceware dot org |scox at redhat dot com
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-27 20:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 3:12 [Bug runtime/27881] New: failed to extend vma mapped entry when the address is adjacent 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
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
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).