Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bradley Morgan" <include@grrlz.net>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] kprobes: use DEFINE_DEBUGFS_ATTRIBUTE for the enabled knob
Date: Tue, 18 Aug 2026 02:01:18 +0000	[thread overview]
Message-ID: <20260818020119.2DF141F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818014920.23870-1-include@grrlz.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The 'enabled' debugfs file is created using `debugfs_create_file()` instead of `debugfs_create_file_unsafe()` with a `DEFINE_DEBUGFS_ATTRIBUTE` struct, leading to redundant proxying and overhead.
--

--- Patch [1]: [PATCH] kprobes: use DEFINE_DEBUGFS_ATTRIBUTE for the enabled knob ---
commit f5babbd146ccf4194f28506d04f5cbfb2c40150a
Author: Bradley Morgan <include@grrlz.net>

    kprobes: use DEFINE_DEBUGFS_ATTRIBUTE for the enabled knob

This commit replaces the custom read/write handlers for the debugfs enabled
file with the standard DEFINE_DEBUGFS_ATTRIBUTE macro. It simplifies the
implementation and accepts integer inputs rather than characters.

> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index ca9d834d0b843..10bcc2a0926a6 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -2962,47 +2962,22 @@ static int disarm_all_kprobes(void)

[ ... ]

> -static const struct file_operations fops_kp = {
> -	.read =         read_enabled_file_bool,
> -	.write =        write_enabled_file_bool,
> -	.llseek =	default_llseek,
> -};
> +DEFINE_DEBUGFS_ATTRIBUTE(fops_kp, kprobes_enabled_get,
> +			 kprobes_enabled_set, "%llu\n");
>  
>  static int __init debugfs_kprobe_init(void)
>  {

[Severity: Low]
Will this lead to double-proxying for the debugfs file?

Since DEFINE_DEBUGFS_ATTRIBUTE natively provides debugfs_attr_read and
debugfs_attr_write operations that already include debugfs_file_get() and
debugfs_file_put() protection, passing fops_kp to debugfs_create_file()
in debugfs_kprobe_init() will cause the debugfs core to wrap it again:

kernel/kprobes.c:debugfs_kprobe_init() {
    ...
	debugfs_create_file("enabled", 0600, dir, NULL, &fops_kp);
    ...
}

Could this use debugfs_create_file_unsafe() instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260818014920.23870-1-include@grrlz.net?part=1

  reply	other threads:[~2026-08-18  2:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  1:49 [PATCH] kprobes: use DEFINE_DEBUGFS_ATTRIBUTE for the enabled knob Bradley Morgan
2026-08-18  2:01 ` sashiko-bot [this message]
2026-08-18 15:17   ` Bradley Morgan
2026-08-18 16:10     ` Steven Rostedt
2026-08-18 16:41       ` Bradley Morgan

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=20260818020119.2DF141F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=include@grrlz.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox