From: Steven Rostedt <rostedt@goodmis.org>
To: Masami Hiramatsu <mhiramat@kernel.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: Tue, 3 Mar 2020 18:52:36 -0500 [thread overview]
Message-ID: <20200303185236.23db2ebc@gandalf.local.home> (raw)
In-Reply-To: <158270759113.18966.8938334321921933993.stgit@devnote2>
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?
-- 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 */
next prev parent reply other threads:[~2020-03-03 23:52 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 [this message]
2020-03-04 7:18 ` Masami Hiramatsu
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=20200303185236.23db2ebc@gandalf.local.home \
--to=rostedt@goodmis.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=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=naveen.n.rao@linux.ibm.com \
--cc=paulmck@kernel.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®