From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 317493848433; Wed, 19 May 2021 01:59:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 317493848433 From: "zhuizhuhaomeng at gmail dot com" 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 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: runtime X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhuizhuhaomeng at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 01:59:41 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27881 --- Comment #2 from lijunlong --- 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 =3D __stp_tf_get_vma_bucket(tsk); entry =3D __stp_tf_get_vma_map(bucket, tsk, 1, addr >=3D entry->vm_= start && - addr < entry->vm_end); + addr <=3D 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 =3D=3D -ESRCH || vm_start + offset =3D=3D= addr) + if (res =3D=3D -ESRCH) res =3D stap_add_vma_map_info(tsk->group_leader, - addr, addr + length, - offset, path, modul= e); - else if (res =3D=3D 0 && vm_end + 1 =3D=3D addr) - res =3D stap_extend_vma_map_info(tsk->group_lea= der, - vm_start, - addr + length); + addr, addr + length, + 0, path, module); + else + res =3D stap_add_vma_map_info(tsk->group_leader, + addr, addr + length, + addr - vm_start, pa= th, module); + /* VMA entries are allocated dynamically, this is fine, * since we are in a task_finder callback, which = is in * user context. */ --=20 You are receiving this mail because: You are the assignee for the bug.=