From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Guo Ren <guoren@kernel.org>, Liao Chang <liaochang1@huawei.com>
Cc: <guoren@kernel.org>, <rostedt@goodmis.org>,
<peterz@infradead.org>, <lkp@intel.com>,
<naveen.n.rao@linux.vnet.ibm.com>, <jszhang@kernel.org>,
<linux-csky@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] csky/kprobe: reclaim insn_slot on kprobe unregistration
Date: Fri, 27 May 2022 00:30:06 +0900 [thread overview]
Message-ID: <20220527003006.76a52390841f7fba9680d636@kernel.org> (raw)
In-Reply-To: <20220525080241.117084-1-liaochang1@huawei.com>
On Wed, 25 May 2022 16:02:41 +0800
Liao Chang <liaochang1@huawei.com> wrote:
> On kprobe registration kernel allocate one insn_slot for new kprobe,
> but it forget to reclaim the insn_slot on unregistration, leading to a
> potential leakage.
>
> Reported-by: Chen Guokai <chenguokai17@mails.ucas.ac.cn>
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
This looks good to me too. I think this should go through csky tree.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you,
> ---
> arch/csky/kernel/probes/kprobes.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c
> index 42920f25e73c..661da54b418f 100644
> --- a/arch/csky/kernel/probes/kprobes.c
> +++ b/arch/csky/kernel/probes/kprobes.c
> @@ -124,6 +124,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
>
> void __kprobes arch_remove_kprobe(struct kprobe *p)
> {
> + if (p->ainsn.api.insn) {
> + free_insn_slot(p->ainsn.api.insn, 0);
> + p->ainsn.api.insn = NULL;
> + }
> }
>
> static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
> --
> 2.17.1
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2022-05-26 15:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 8:02 Liao Chang
2022-05-26 15:30 ` Masami Hiramatsu [this message]
2022-05-27 2:53 ` Guo Ren
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=20220527003006.76a52390841f7fba9680d636@kernel.org \
--to=mhiramat@kernel.org \
--cc=guoren@kernel.org \
--cc=jszhang@kernel.org \
--cc=liaochang1@huawei.com \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--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
all inboxes | Powered by JetHome®