From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Anders Roxell <anders.roxell@linaro.org>,
paulmck@kernel.org, joel@joelfernandes.org,
"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
David Miller <davem@davemloft.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip V4 3/4] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
Date: Wed, 4 Mar 2020 16:18:23 +0900 [thread overview]
Message-ID: <20200304161823.afe5ed2b47029e55531329ea@kernel.org> (raw)
In-Reply-To: <20200303185236.23db2ebc@gandalf.local.home>
On Tue, 3 Mar 2020 18:52:36 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 26 Feb 2020 17:59:51 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > In kprobe_optimizer() kick_kprobe_optimizer() is called
> > without kprobe_mutex, but this can race with other caller
> > which is protected by kprobe_mutex.
> >
> > To fix that, expand kprobe_mutex protected area to protect
> > kick_kprobe_optimizer() call.
> >
>
> Should we add
>
> Cc: stable@vger.kernel.org
> Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing")
>
> tags?
Good catch! Yes, it is correct commit to be fixed.
Thank you!
>
> -- Steve
>
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> > kernel/kprobes.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 38d9a5d7c8a4..6d76a6e3e1a5 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -592,11 +592,12 @@ static void kprobe_optimizer(struct work_struct *work)
> > mutex_unlock(&module_mutex);
> > mutex_unlock(&text_mutex);
> > cpus_read_unlock();
> > - mutex_unlock(&kprobe_mutex);
> >
> > /* Step 5: Kick optimizer again if needed */
> > if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list))
> > kick_kprobe_optimizer();
> > +
> > + mutex_unlock(&kprobe_mutex);
> > }
> >
> > /* Wait for completing optimization and unoptimization */
>
--
Masami Hiramatsu <mhiramat@kernel.org>
next prev parent reply other threads:[~2020-03-04 7:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 8:59 [PATCH -tip V4 0/4] kprobes: Fixes and cleanups Masami Hiramatsu
2020-02-26 8:59 ` [PATCH -tip V4 1/4] kprobes: Suppress the suspicious RCU warning on kprobes Masami Hiramatsu
2020-02-26 8:59 ` [PATCH -tip V4 2/4] kprobes: Use non RCU traversal APIs on kprobe_tables if possible Masami Hiramatsu
2020-02-26 8:59 ` [PATCH -tip V4 3/4] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Masami Hiramatsu
2020-03-03 23:52 ` Steven Rostedt
2020-03-04 7:18 ` Masami Hiramatsu [this message]
2020-02-26 9:00 ` [PATCH -tip V4 4/4] kprobes: Remove redundant arch_disarm_kprobe() call Masami Hiramatsu
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=20200304161823.afe5ed2b47029e55531329ea@kernel.org \
--to=mhiramat@kernel.org \
--cc=anders.roxell@linaro.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=naveen.n.rao@linux.ibm.com \
--cc=paulmck@kernel.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