The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: ruipengqi <ruipengqi3@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v2 2/2] samples: enhance hung_task detector test with rtmutex support
Date: Sat, 08 Aug 2026 13:21:51 +0000	[thread overview]
Message-ID: <20260808132152.58A231F000E9@smtp.kernel.org> (raw)
In-Reply-To: <4991cd8e1bbddb42a1fe31dde38f85d74ff1c4cc.1786193045.git.ruipengqi3@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing `.owner = THIS_MODULE` in `struct file_operations` allows the module to be unloaded while debugfs files are open, leading to a use-after-free on module unload. This problem wasn't introduced by this patch, but the patch replicates the flawed pattern.
--

--- Patch [2]: [PATCH v2 2/2] samples: enhance hung_task detector test with rtmutex support ---
commit 1b388ec83d8aff9dc25159e4fe36a84b7c7583d7
Author: Ruipeng Qi <ruipengqi3@gmail.com>

samples: enhance hung_task detector test with rtmutex support

This commit extends the hung_task detector test module with an rtmutex test.
When CONFIG_RT_MUTEXES is enabled, it creates an additional rtmutex debugfs
file to allow testing hung-task reporting for rtmutex waits.

> diff --git a/samples/hung_task/hung_task_tests.c b/samples/hung_task/hung_task_tests.c
> index 0360ec916890b..87346d65f860a 100644
> --- a/samples/hung_task/hung_task_tests.c
> +++ b/samples/hung_task/hung_task_tests.c
[ ... ]
> @@ -116,6 +147,13 @@ static const struct file_operations hung_task_mutex_fops = {
>  	.read = read_dummy_mutex,
>  };
>  
> +#ifdef CONFIG_RT_MUTEXES
> +/* File operations for rtmutex */
> +static const struct file_operations hung_task_rtmutex_fops = {
> +	.read = read_dummy_rtmutex,
> +};
> +#endif

[Severity: High]
This is a pre-existing issue, but this new rtmutex file operations struct (as
well as the existing mutex one above it) omits the .owner field.

Without .owner = THIS_MODULE, fops_get() in the debugfs open proxy does not
increment the module reference count. If a user opens the debugfs file and
concurrently unloads the module via rmmod, the module is successfully
unloaded because debugfs_remove_recursive() does not block merely open files.

When the file is eventually closed, full_proxy_release() will unconditionally
dereference real_fops->release. Since real_fops points to the unloaded
module's memory, can this trigger a use-after-free crash on module unload?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786193045.git.ruipengqi3@gmail.com?part=2

  reply	other threads:[~2026-08-08 13:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08 13:02 [PATCH v2 0/2] hung_task: show the blocker task if the task is hung on rtmutex ruipengqi
2026-08-08 13:02 ` [PATCH v2 1/2] " ruipengqi
2026-08-08 13:02 ` [PATCH v2 2/2] samples: enhance hung_task detector test with rtmutex support ruipengqi
2026-08-08 13:21   ` sashiko-bot [this message]
2026-08-08 15:34 ` [PATCH v2 0/2] hung_task: show the blocker task if the task is hung on rtmutex Lance Yang

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=20260808132152.58A231F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=ruipengqi3@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox