uprobes: fix incorrect lockdep condition in filter_chain()
Subsystems (4)
PATCH v2 1/1 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.
---
Changes in v2:
- updated the "fixes" tag (Oleg)
- Link to v1: https://patch.msgid.link/[email protected]
--- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/uprobes.c +1 -1
@@ -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,
Signature · 1 line
Breno Leitao <[email protected]>
Quoted 7 lines · On Wed, 28 Jan 2026 10:16:11 -0800 Breno Leitao <[email protected]> wrote:
The
list_for_each_entry_rcu()infilter_chain()usesrcu_read_lock_trace_held()as the lockdep condition, but the function holdsconsumer_rwsem, not the RCU trace lock.This gives me the following output when running with some locking debug option enabled:
Quoted 9 lines
kernel/events/uprobes.c:1141RCU-list traversed in non-reader section!!
filter_chain
register_for_each_vma
uprobe_unregister_nosync
__probe_event_disableRemove the incorrect lockdep condition since the rwsem provides sufficient protection for the list traversal.
Looks good to me.
Thanks,
Quoted 35 lines
Fixes cc01bd044e6a ("uprobes: travers uprobe's consumer list locklessly under SRCU protection")Acked-by Oleg Nesterov <[email protected]>Acked-by Andrii Nakryiko <[email protected]>Signed-off-by Breno Leitao <[email protected]>---
Changes in v2:
- updated the "fixes" tag (Oleg)
- Link to v1: https://patch.msgid.link/[email protected]--- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/events/uprobes.c +1
-2@@ -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-e21867ab4c1bBest regards,
Signature · 1 line
Breno Leitao <[email protected]>
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
[tip: perf/core] uprobes: Fix incorrect lockdep condition in filter_chain()
In reply to Breno LeitaoThe following commit has been merged into the perf/core branch of tip:
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 <[email protected]> AuthorDate: Wed, 28 Jan 2026 10:16:11 -08:00 Committer: Peter Zijlstra <[email protected]> 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.
--- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/uprobes.c +1 -1
@@ -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 ;