stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree
@ 2020-06-23 11:57 gregkh
  2020-06-23 13:26 ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2020-06-23 11:57 UTC (permalink / raw)
  To: mhiramat, anders.roxell, anil.s.keshavamurthy, davem, gustavoars,
	mingo, mingo, naveen.n.rao, peterz, rostedt, zsun
  Cc: stable


The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 1a0aa991a6274161c95a844c58cfb801d681eb59 Mon Sep 17 00:00:00 2001
From: Masami Hiramatsu <mhiramat@kernel.org>
Date: Tue, 12 May 2020 17:02:56 +0900
Subject: [PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by
 kprobe_mutex

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.

Link: http://lkml.kernel.org/r/158927057586.27680.5036330063955940456.stgit@devnote2

Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing")
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>
Cc: Anders Roxell <anders.roxell@linaro.org>
Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ziqian SUN <zsun@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index ceb0e273bd69..0e185763578b 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 */


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree
  2020-06-23 11:57 FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree gregkh
@ 2020-06-23 13:26 ` Sasha Levin
  2020-06-23 13:30   ` Steven Rostedt
  2020-06-23 16:09   ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Sasha Levin @ 2020-06-23 13:26 UTC (permalink / raw)
  To: gregkh
  Cc: mhiramat, anders.roxell, anil.s.keshavamurthy, davem, gustavoars,
	mingo, mingo, naveen.n.rao, peterz, rostedt, zsun, stable

On Tue, Jun 23, 2020 at 01:57:26PM +0200, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.9-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From 1a0aa991a6274161c95a844c58cfb801d681eb59 Mon Sep 17 00:00:00 2001
>From: Masami Hiramatsu <mhiramat@kernel.org>
>Date: Tue, 12 May 2020 17:02:56 +0900
>Subject: [PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by
> kprobe_mutex
>
>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.
>
>Link: http://lkml.kernel.org/r/158927057586.27680.5036330063955940456.stgit@devnote2
>
>Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing")
>Cc: Ingo Molnar <mingo@kernel.org>
>Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>
>Cc: Anders Roxell <anders.roxell@linaro.org>
>Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
>Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
>Cc: David Miller <davem@davemloft.net>
>Cc: Ingo Molnar <mingo@elte.hu>
>Cc: Peter Zijlstra <peterz@infradead.org>
>Cc: Ziqian SUN <zsun@redhat.com>
>Cc: stable@vger.kernel.org
>Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
>Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

The conflict happened because we don't have 2d1e38f56622 ("kprobes: Cure
hotplug lock ordering issues") on 4.9 and 4.4. I've fixed it up and
queued for both branches.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree
  2020-06-23 13:26 ` Sasha Levin
@ 2020-06-23 13:30   ` Steven Rostedt
  2020-06-23 16:09   ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2020-06-23 13:30 UTC (permalink / raw)
  To: Sasha Levin
  Cc: gregkh, mhiramat, anders.roxell, anil.s.keshavamurthy, davem,
	gustavoars, mingo, mingo, naveen.n.rao, peterz, zsun, stable

On Tue, 23 Jun 2020 09:26:28 -0400
Sasha Levin <sashal@kernel.org> wrote:

> The conflict happened because we don't have 2d1e38f56622 ("kprobes: Cure
> hotplug lock ordering issues") on 4.9 and 4.4. I've fixed it up and
> queued for both branches.

Thanks Sasha!

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree
  2020-06-23 13:26 ` Sasha Levin
  2020-06-23 13:30   ` Steven Rostedt
@ 2020-06-23 16:09   ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-06-23 16:09 UTC (permalink / raw)
  To: Sasha Levin
  Cc: mhiramat, anders.roxell, anil.s.keshavamurthy, davem, gustavoars,
	mingo, mingo, naveen.n.rao, peterz, rostedt, zsun, stable

On Tue, Jun 23, 2020 at 09:26:28AM -0400, Sasha Levin wrote:
> On Tue, Jun 23, 2020 at 01:57:26PM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 4.9-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> > > From 1a0aa991a6274161c95a844c58cfb801d681eb59 Mon Sep 17 00:00:00 2001
> > From: Masami Hiramatsu <mhiramat@kernel.org>
> > Date: Tue, 12 May 2020 17:02:56 +0900
> > Subject: [PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by
> > kprobe_mutex
> > 
> > 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.
> > 
> > Link: http://lkml.kernel.org/r/158927057586.27680.5036330063955940456.stgit@devnote2
> > 
> > Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing")
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>
> > Cc: Anders Roxell <anders.roxell@linaro.org>
> > Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
> > Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
> > Cc: David Miller <davem@davemloft.net>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Ziqian SUN <zsun@redhat.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> 
> The conflict happened because we don't have 2d1e38f56622 ("kprobes: Cure
> hotplug lock ordering issues") on 4.9 and 4.4. I've fixed it up and
> queued for both branches.

Thanks for fixing this, and the other FAILED patches up as well.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-23 16:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-23 11:57 FAILED: patch "[PATCH] kprobes: Fix to protect kick_kprobe_optimizer() by" failed to apply to 4.9-stable tree gregkh
2020-06-23 13:26 ` Sasha Levin
2020-06-23 13:30   ` Steven Rostedt
2020-06-23 16:09   ` Greg KH

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).