From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753508AbbCBBbu (ORCPT ); Sun, 1 Mar 2015 20:31:50 -0500 Received: from mail4.hitachi.co.jp ([133.145.228.5]:46710 "EHLO mail4.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751967AbbCBBbt (ORCPT ); Sun, 1 Mar 2015 20:31:49 -0500 Message-ID: <54F3BD7D.6040303@hitachi.com> Date: Mon, 02 Mar 2015 10:31:41 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Peter Zijlstra Cc: mingo@kernel.org, rusty@rustcorp.com.au, mathieu.desnoyers@efficios.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, andi@firstfloor.org, rostedt@goodmis.org, tglx@linutronix.de, Seth Jennings , Josh Poimboeuf , Miroslav Benes , Petr Mladek , Jiri Kosina Subject: Re: [RFC][PATCH 1/9] klp: Fix obvious RCU fail References: <20150228212447.381543289@infradead.org> <20150228213109.893891745@infradead.org> In-Reply-To: <20150228213109.893891745@infradead.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (2015/03/01 6:24), Peter Zijlstra wrote: > While one must hold RCU-sched (aka. preempt_disable) for find_symbol() > one must equally hold it over the use of the object returned. > > The moment you release the RCU-sched read lock, the object can be dead > and gone. > > Cc: Seth Jennings > Cc: Josh Poimboeuf > Cc: Masami Hiramatsu > Cc: Miroslav Benes > Cc: Petr Mladek > Cc: Jiri Kosina > Cc: "Paul E. McKenney" > Cc: Rusty Russell > Signed-off-by: Peter Zijlstra (Intel) Looks good to me. Reviewed-by: Masami Hiramatsu Thank you, > --- > kernel/livepatch/core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -248,11 +248,12 @@ static int klp_find_external_symbol(stru > /* first, check if it's an exported symbol */ > preempt_disable(); > sym = find_symbol(name, NULL, NULL, true, true); > - preempt_enable(); > if (sym) { > *addr = sym->value; > + preempt_enable(); > return 0; > } > + preempt_enable(); > > /* otherwise check if it's in another .o within the patch module */ > return klp_find_object_symbol(pmod->name, name, addr); > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu.pt@hitachi.com