* [PATCH v2] uprobes: fix incorrect lockdep condition in filter_chain()
@ 2026-01-28 18:16 Breno Leitao
2026-01-28 22:29 ` Masami Hiramatsu
2026-02-02 21:04 ` [tip: perf/core] uprobes: Fix " tip-bot2 for Breno Leitao
0 siblings, 2 replies; 3+ messages in thread
From: Breno Leitao @ 2026-01-28 18:16 UTC (permalink / raw)
To: Masami Hiramatsu, Oleg Nesterov, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Andrii Nakryiko
Cc: linux-kernel, linux-trace-kernel, linux-perf-users, kernel-team,
stable, Breno Leitao
The list_for_each_entry_rcu() in filter_chain() uses
rcu_read_lock_trace_held() as the lockdep condition, but the function
holds consumer_rwsem, not the RCU trace lock.
This gives me the following output when running with some locking debug
option enabled:
kernel/events/uprobes.c:1141 RCU-list traversed in non-reader section!!
filter_chain
register_for_each_vma
uprobe_unregister_nosync
__probe_event_disable
Remove the incorrect lockdep condition since the rwsem provides
sufficient protection for the list traversal.
Cc: stable@vger.kernel.org
Fixes: cc01bd044e6a ("uprobes: travers uprobe's consumer list locklessly under SRCU protection")
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
---
Changes in v2:
- updated the "fixes" tag (Oleg)
- Link to v1: https://patch.msgid.link/20260128-uprobe_rcu-v1-1-d41316763799@debian.org
---
kernel/events/uprobes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index d546d32390a81..726d13b375f3d 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1138,7 +1138,7 @@ static bool filter_chain(struct uprobe *uprobe, struct mm_struct *mm)
bool ret = false;
down_read(&uprobe->consumer_rwsem);
- list_for_each_entry_rcu(uc, &uprobe->consumers, cons_node, rcu_read_lock_trace_held()) {
+ list_for_each_entry(uc, &uprobe->consumers, cons_node) {
ret = consumer_filter(uc, mm);
if (ret)
break;
---
base-commit: 1f97d9dcf53649c41c33227b345a36902cbb08ad
change-id: 20260128-uprobe_rcu-e21867ab4c1b
Best regards,
--
Breno Leitao <leitao@debian.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] uprobes: fix incorrect lockdep condition in filter_chain()
2026-01-28 18:16 [PATCH v2] uprobes: fix incorrect lockdep condition in filter_chain() Breno Leitao
@ 2026-01-28 22:29 ` Masami Hiramatsu
2026-02-02 21:04 ` [tip: perf/core] uprobes: Fix " tip-bot2 for Breno Leitao
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2026-01-28 22:29 UTC (permalink / raw)
To: Breno Leitao
Cc: Oleg Nesterov, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Andrii Nakryiko, linux-kernel, linux-trace-kernel,
linux-perf-users, kernel-team, stable
On Wed, 28 Jan 2026 10:16:11 -0800
Breno Leitao <leitao@debian.org> wrote:
> The list_for_each_entry_rcu() in filter_chain() uses
> rcu_read_lock_trace_held() as the lockdep condition, but the function
> holds consumer_rwsem, not the RCU trace lock.
>
> This gives me the following output when running with some locking debug
> option enabled:
>
> kernel/events/uprobes.c:1141 RCU-list traversed in non-reader section!!
> filter_chain
> register_for_each_vma
> uprobe_unregister_nosync
> __probe_event_disable
>
> Remove the incorrect lockdep condition since the rwsem provides
> sufficient protection for the list traversal.
>
Looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks,
> Cc: stable@vger.kernel.org
> Fixes: cc01bd044e6a ("uprobes: travers uprobe's consumer list locklessly under SRCU protection")
> Acked-by: Oleg Nesterov <oleg@redhat.com>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
> Changes in v2:
> - updated the "fixes" tag (Oleg)
> - Link to v1: https://patch.msgid.link/20260128-uprobe_rcu-v1-1-d41316763799@debian.org
> ---
> kernel/events/uprobes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index d546d32390a81..726d13b375f3d 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1138,7 +1138,7 @@ static bool filter_chain(struct uprobe *uprobe, struct mm_struct *mm)
> bool ret = false;
>
> down_read(&uprobe->consumer_rwsem);
> - list_for_each_entry_rcu(uc, &uprobe->consumers, cons_node, rcu_read_lock_trace_held()) {
> + list_for_each_entry(uc, &uprobe->consumers, cons_node) {
> ret = consumer_filter(uc, mm);
> if (ret)
> break;
>
> ---
> base-commit: 1f97d9dcf53649c41c33227b345a36902cbb08ad
> change-id: 20260128-uprobe_rcu-e21867ab4c1b
>
> Best regards,
> --
> Breno Leitao <leitao@debian.org>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: perf/core] uprobes: Fix incorrect lockdep condition in filter_chain()
2026-01-28 18:16 [PATCH v2] uprobes: fix incorrect lockdep condition in filter_chain() Breno Leitao
2026-01-28 22:29 ` Masami Hiramatsu
@ 2026-02-02 21:04 ` tip-bot2 for Breno Leitao
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Breno Leitao @ 2026-02-02 21:04 UTC (permalink / raw)
To: linux-tip-commits
Cc: Breno Leitao, Peter Zijlstra (Intel), Oleg Nesterov,
Andrii Nakryiko, Masami Hiramatsu (Google), stable, x86,
linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: a56a38fd9196fc89401e498d70b7aa9c9679fa6e
Gitweb: https://git.kernel.org/tip/a56a38fd9196fc89401e498d70b7aa9c9679fa6e
Author: Breno Leitao <leitao@debian.org>
AuthorDate: Wed, 28 Jan 2026 10:16:11 -08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 02 Feb 2026 22:01:07 +01:00
uprobes: Fix incorrect lockdep condition in filter_chain()
The list_for_each_entry_rcu() in filter_chain() uses
rcu_read_lock_trace_held() as the lockdep condition, but the function
holds consumer_rwsem, not the RCU trace lock.
This gives me the following output when running with some locking debug
option enabled:
kernel/events/uprobes.c:1141 RCU-list traversed in non-reader section!!
filter_chain
register_for_each_vma
uprobe_unregister_nosync
__probe_event_disable
Remove the incorrect lockdep condition since the rwsem provides
sufficient protection for the list traversal.
Fixes: cc01bd044e6a ("uprobes: travers uprobe's consumer list locklessly under SRCU protection")
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260128-uprobe_rcu-v2-1-994ea6d32730@debian.org
---
kernel/events/uprobes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index dfbce02..424ef22 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1138,7 +1138,7 @@ static bool filter_chain(struct uprobe *uprobe, struct mm_struct *mm)
bool ret = false;
down_read(&uprobe->consumer_rwsem);
- list_for_each_entry_rcu(uc, &uprobe->consumers, cons_node, rcu_read_lock_trace_held()) {
+ list_for_each_entry(uc, &uprobe->consumers, cons_node) {
ret = consumer_filter(uc, mm);
if (ret)
break;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-02 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-28 18:16 [PATCH v2] uprobes: fix incorrect lockdep condition in filter_chain() Breno Leitao
2026-01-28 22:29 ` Masami Hiramatsu
2026-02-02 21:04 ` [tip: perf/core] uprobes: Fix " tip-bot2 for Breno Leitao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox