From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758334AbdELSjS (ORCPT ); Fri, 12 May 2017 14:39:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48047 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757408AbdELSjR (ORCPT ); Fri, 12 May 2017 14:39:17 -0400 Date: Fri, 12 May 2017 11:39:11 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Mathieu Desnoyers , Masami Hiramatsu Subject: Re: [RFC][PATCH 3/5] kprobes: Take get_online_cpus() before taking jump_label_lock() Reply-To: paulmck@linux.vnet.ibm.com References: <20170512171544.100715273@goodmis.org> <20170512172450.127400191@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170512172450.127400191@goodmis.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17051218-0024-0000-0000-0000026C93D7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007051; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000211; SDB=6.00859622; UDB=6.00426127; IPR=6.00639205; BA=6.00005345; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015431; XFM=3.00000015; UTC=2017-05-12 18:39:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17051218-0025-0000-0000-000043F97CC2 Message-Id: <20170512183911.GB3956@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-12_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705120348 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 12, 2017 at 01:15:47PM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" > > jump_label_lock() is taken under get_online_cpus(). Make sure that kprobes > follows suit. > > Signed-off-by: Steven Rostedt (VMware) The remaining three (3/5 through 5/5) look straightforward. #4 appears to be the one needing the recursive get_online_cpus(). Thanx, Paul > --- > kernel/kprobes.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > index d733479a10ee..57cf73aef488 100644 > --- a/kernel/kprobes.c > +++ b/kernel/kprobes.c > @@ -1294,13 +1294,13 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p) > int ret = 0; > struct kprobe *ap = orig_p; > > - /* For preparing optimization, jump_label_text_reserved() is called */ > - jump_label_lock(); > /* > * Get online CPUs to avoid text_mutex deadlock.with stop machine, > * which is invoked by unoptimize_kprobe() in add_new_kprobe() > */ > get_online_cpus(); > + /* For preparing optimization, jump_label_text_reserved() is called */ > + jump_label_lock(); > mutex_lock(&text_mutex); > > if (!kprobe_aggrprobe(orig_p)) { > @@ -1348,8 +1348,8 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p) > > out: > mutex_unlock(&text_mutex); > - put_online_cpus(); > jump_label_unlock(); > + put_online_cpus(); > > if (ret == 0 && kprobe_disabled(ap) && !kprobe_disabled(p)) { > ap->flags &= ~KPROBE_FLAG_DISABLED; > -- > 2.10.2 > >