From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753609AbbDANfx (ORCPT ); Wed, 1 Apr 2015 09:35:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54587 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753135AbbDANfs (ORCPT ); Wed, 1 Apr 2015 09:35:48 -0400 Date: Wed, 1 Apr 2015 15:35:46 +0200 (CEST) From: Jiri Kosina To: Minfei Huang cc: jpoimboe@redhat.com, sjenning@redhat.com, Vojtech Pavlik , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] livepatch: Enhance livepatch to support remove patch module dynamically In-Reply-To: <1427893812-15936-1-git-send-email-minfei.huang@yahoo.com> Message-ID: References: <1427893812-15936-1-git-send-email-minfei.huang@yahoo.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Apr 2015, Minfei Huang wrote: > As mentioned in the annotation, the patch module would not permit to > be removed once it is loaded. > > Kernel may crash in the case that the function in the patch module is > called during removing. > > We will increase the module reference when the patch module is enable, > so that the module cannt be removed. Once the module is disable, it will > be removed. > > Signed-off-by: Minfei Huang > --- > kernel/livepatch/core.c | 47 +++++++++++++++++++++++++++++++---------------- > 1 file changed, 31 insertions(+), 16 deletions(-) > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > index 3f9f1d6..0266950 100644 > --- a/kernel/livepatch/core.c > +++ b/kernel/livepatch/core.c > @@ -502,6 +502,17 @@ static int __klp_disable_patch(struct klp_patch *patch) > return 0; > } > > +static int __klp_disable_patch_nolock(struct klp_patch *patch) > +{ > + int ret = 0; > + > + ret = __klp_disable_patch(patch); > + if (ret) > + return ret; > + module_put(patch->mod); > + return ret; > +} > + Your patch doesn't solve the problem at all. There is no guarantee that once __klp_disable_patch() returns noone is using the old code any more. -- Jiri Kosina SUSE Labs