From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbcBEKHD (ORCPT ); Fri, 5 Feb 2016 05:07:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:58162 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbcBEKG6 (ORCPT ); Fri, 5 Feb 2016 05:06:58 -0500 Date: Fri, 5 Feb 2016 11:06:56 +0100 From: Petr Mladek To: Miroslav Benes Cc: Jessica Yu , Josh Poimboeuf , Seth Jennings , Jiri Kosina , Vojtech Pavlik , Rusty Russell , Steven Rostedt , Ingo Molnar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: livepatch/module: remove livepatch module notifier Message-ID: <20160205100656.GC3305@pathway.suse.cz> References: <1454375856-27757-1-git-send-email-jeyu@redhat.com> <1454375856-27757-3-git-send-email-jeyu@redhat.com> <20160204143934.GZ3305@pathway.suse.cz> <20160205041157.GB24068@packer-debian-8-amd64.digitalocean.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2016-02-05 10:15:56, Miroslav Benes wrote: > On Thu, 4 Feb 2016, Jessica Yu wrote: > > Argh, thank you for catching that. I think we could split up > > complete_formation() > > into two functions in order to make the error handling work. > > > > Does all this look ok? > > Hm, there is an another option. We can cover the needed error handling in > complete_formation(). So for the first error there > (verify_export_symbols() fails) we need to only release module_mutex. For > our second error we need more. We would call module_bug_cleanup() under > module_mutex, module_disable_{ro,nx} and going notifiers. Is this correct? > It would be hidden in complete_formation() this way and cleaner in my > opinion. There is some code duplication though. This sounds better to me. > > Also, one last thing, I noticed that module->state > > isn't > > set to MODULE_STATE_GOING anywhere before the going notifier chain is called > > in > > the bug_cleanup label (I think it is still COMING at that point), so the > > klp_module_disable call right afterwards would have bailed out because of > > that. > > To be consistent, shouldn't it be set before the going notifiers are called? > > This could break something or introduce a race somewhere. Git grep says > there are several checks for MODULE_STATE_GOING through out the kernel > which need to be checked. I think that we could relax the condition in the klp_module_going/disable() function and allow to call it also in MODULE_STATE_COMMING_STATE. It would deserve a comment. Best Regards, Petr