All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andi Kleen" <ak@kernel.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [RFC PATCH v2 04/11] ptwrite uprobes: Add support to tracing infrastructure
Date: Thu, 17 Sep 2026 23:23:43 +0000	[thread overview]
Message-ID: <20260917232344.6E7281F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917230127.924985-5-ak@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] trace: AA deadlock on event_mutex in trace_uprobe_enable()
--

commit 18294b1032dd2887acf440ab9d7029011a171000
Author: Andi Kleen <ak@kernel.org>

ptwrite uprobes: Add support to tracing infrastructure

This commit hooks up the low-level x86 ptwrite uprobes code to the generic
trace uprobes events parser. It introduces a new ptw: syntax to set up
trap-free ptwrite uprobes and handles architectures without the backend via
weak stubs.

> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
[ ... ]
> @@ -1107,9 +1241,26 @@ static int trace_uprobe_enable(struct trace_uprobe *tu, filter_func_t filter)
>  {
>  	struct inode *inode = d_real_inode(tu->path.dentry);
>  	struct uprobe *uprobe;
> +	struct file *file;
>  
> -	tu->consumer.filter = filter;
> -	uprobe = uprobe_register(inode, tu->offset, tu->ref_ctr_offset, &tu->consumer);
> +	if (tu->is_ptwrite) {
> +		if (filter) {
> +			/* PTWRITE probes have no kernel entry to evaluate a filter. */
> +			return -EINVAL;
> +		}
> +		file = dentry_open(&tu->path, O_RDONLY, current_cred());

[Severity: High]
Can this dentry_open() call cause an AA deadlock on event_mutex?

If a user creates a ptwrite uprobe targeting a tracefs file (like
events/sched/sched_switch/enable) and then writes 1 to the uprobe's enable
file, event_enable_write() acquires event_mutex before calling
trace_uprobe_enable().

When dentry_open() is called synchronously on that tracefs path, its
f_op->open (e.g. tracing_open_file_tr()) will attempt to acquire event_mutex
again, leading to a system hang.

> +		if (IS_ERR(file))
> +			return PTR_ERR(file);
> +		tu->ptwrite_desc.event_id =
> +			trace_probe_event_call(&tu->tp)->event.type;
> +		uprobe = uprobe_register_ptwrite(inode, file, tu->offset,
> +						 &tu->consumer, &tu->ptwrite_desc);
> +		fput(file);
> +	} else {
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917230127.924985-2-ak@kernel.org?part=4

  reply	other threads:[~2026-09-17 23:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 23:00 ptwrite uprobes v2 Andi Kleen
2026-09-17 23:00 ` [RFC PATCH v2 01/11] ptwrite uprobes: Add infrastructure for ptwrite uprobes Andi Kleen
2026-09-17 23:19   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 02/11] ptwrite uprobes: Add minimal low level support for x86 Andi Kleen
2026-09-17 23:25   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 03/11] ptwrite uprobes: Add a sample module to exercise interface Andi Kleen
2026-09-17 23:20   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 04/11] ptwrite uprobes: Add support to tracing infrastructure Andi Kleen
2026-09-17 23:23   ` sashiko-bot [this message]
2026-09-17 23:00 ` [RFC PATCH v2 05/11] ptwrite uprobes: Factor file-backed instruction reads Andi Kleen
2026-09-17 23:14   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 06/11] ptwrite uprobes: Add basic memory references Andi Kleen
2026-09-17 23:17   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 07/11] ptwrite uprobes: Add multinop support Andi Kleen
2026-09-17 23:22   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 08/11] ptwrite uprobes: Support instruction punning Andi Kleen
2026-09-17 23:27   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 09/11] ptwrite uprobes: Use atomic patching for multinop sites Andi Kleen
2026-09-17 23:32   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 10/11] ptwrite uprobes: Add a tutorial and overview documentation Andi Kleen
2026-09-17 23:21   ` sashiko-bot
2026-09-17 23:00 ` [RFC PATCH v2 11/11] ptwrite uprobes: Add kernel self tests Andi Kleen
2026-09-17 23:28   ` sashiko-bot

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=20260917232344.6E7281F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ak@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.