linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Li Qiang <liq3ea@163.com>
Cc: naveen.n.rao@linux.ibm.com, anil.s.keshavamurthy@intel.com,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	liq3ea@gmail.com, Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] kprobe: reverse kp->flags when arm_kprobe failed
Date: Fri, 9 Sep 2022 22:07:46 +0900	[thread overview]
Message-ID: <20220909220746.a7826cb2fb9da02171b38237@kernel.org> (raw)
In-Reply-To: <20220902155820.34755-1-liq3ea@163.com>

On Fri,  2 Sep 2022 08:58:20 -0700
Li Qiang <liq3ea@163.com> wrote:

> In aggregate kprobe case, when arm_kprobe failed,
> we need set the kp->flags with KPROBE_FLAG_DISABLED again.
> If not, the 'kp' kprobe will been considered as enabled
> but it actually not enabled.
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>

Looks good to me.

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

Thanks!

> ---
>  kernel/kprobes.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 08350e35a..333454df5 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -2424,8 +2424,11 @@ int enable_kprobe(struct kprobe *kp)
>  	if (!kprobes_all_disarmed && kprobe_disabled(p)) {
>  		p->flags &= ~KPROBE_FLAG_DISABLED;
>  		ret = arm_kprobe(p);
> -		if (ret)
> +		if (ret) {
>  			p->flags |= KPROBE_FLAG_DISABLED;
> +			if (p != kp)
> +				kp->flags |= KPROBE_FLAG_DISABLED;
> +		}
>  	}
>  out:
>  	mutex_unlock(&kprobe_mutex);
> -- 
> 2.25.1
> 


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

  parent reply	other threads:[~2022-09-09 13:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 15:58 [PATCH] kprobe: reverse kp->flags when arm_kprobe failed Li Qiang
2022-09-08  4:51 ` Li Qiang
2022-09-09 13:07 ` Masami Hiramatsu [this message]
2022-09-15  7:04   ` Li Qiang
2022-09-27  2:07 ` Li Qiang

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=20220909220746.a7826cb2fb9da02171b38237@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liq3ea@163.com \
    --cc=liq3ea@gmail.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    /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).