linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: yebin <yebin@huaweicloud.com>
Cc: naveen@kernel.org, davem@davemloft.net,
	linux-trace-kernel@vger.kernel.org, yebin10@huawei.com,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] kprobes: avoid crash when rmmod/insmod modules after ftrace_disabled
Date: Wed, 3 Dec 2025 13:51:21 +0900	[thread overview]
Message-ID: <20251203135121.8a12719caaa96af9fad5f8ca@kernel.org> (raw)
In-Reply-To: <692FA251.3080100@huaweicloud.com>

On Wed, 3 Dec 2025 10:37:05 +0800
yebin <yebin@huaweicloud.com> wrote:

> >>> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> >>> index ab8f9fc1f0d1..17d451553389 100644
> >>> --- a/kernel/kprobes.c
> >>> +++ b/kernel/kprobes.c
> >>> @@ -1104,6 +1104,10 @@ static int __disarm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
> >>>    	int ret;
> >>>
> >>>    	lockdep_assert_held(&kprobe_mutex);
> >>> +	if (unlikely(kprobe_ftrace_disabled)) {
> >>> +		/* Now ftrace is disabled forever, disarm is already done. */
> >>> +		return 0;
> >>> +	}
> >>>
> >>>    	if (*cnt == 1) {
> >>>    		ret = unregister_ftrace_function(ops);
> >>>
> >
> > This one, it should fix simply.
> >
> I tested it and it can solve the problem. This is indeed a good solution 
> that reuses the original code.
> Do you want me to send a new patch version according to your proposal?

OK, I'll send it with some tags which is required for this fix.
Please add your tested-by on that.

Thank you,

> > Thank you,
> >
> >>>
> >>
> >
> >
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2025-12-03  4:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  2:05 [PATCH] kprobes: avoid crash when rmmod/insmod modules after ftrace_disabled Ye Bin
2025-11-27  3:52 ` Masami Hiramatsu
2025-11-27  4:18   ` Masami Hiramatsu
2025-11-28  2:27     ` yebin
2025-12-02  2:32       ` Masami Hiramatsu
2025-12-03  2:37         ` yebin
2025-12-03  4:51           ` Masami Hiramatsu [this message]
2025-12-02 16:43       ` Steven Rostedt
2025-12-03  3:21         ` yebin

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=20251203135121.8a12719caaa96af9fad5f8ca@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=naveen@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=yebin10@huawei.com \
    --cc=yebin@huaweicloud.com \
    /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;
as well as URLs for NNTP newsgroup(s).