From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752914AbdJFWU2 (ORCPT ); Fri, 6 Oct 2017 18:20:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbdJFWU1 (ORCPT ); Fri, 6 Oct 2017 18:20:27 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F272FC0587D9 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com Date: Fri, 6 Oct 2017 17:20:23 -0500 From: Josh Poimboeuf To: Joe Lawrence Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu , Jiri Kosina , Miroslav Benes , Petr Mladek Subject: Re: [PATCH v2] livepatch: unpatch all klp_objects if klp_module_coming fails Message-ID: <20171006222023.62cxfctvehmn4wi7@treble> References: <1506959808-23838-1-git-send-email-joe.lawrence@redhat.com> <20171005215543.ce3y4ewchwwrxstn@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171005215543.ce3y4ewchwwrxstn@treble> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 06 Oct 2017 22:20:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 05, 2017 at 04:55:43PM -0500, Josh Poimboeuf wrote: > On Mon, Oct 02, 2017 at 11:56:48AM -0400, Joe Lawrence wrote: > > When an incoming module is considered for livepatching by > > klp_module_coming(), it iterates over multiple patches and multiple > > kernel objects in this order: > > > > list_for_each_entry(patch, &klp_patches, list) { > > klp_for_each_object(patch, obj) { > > > > which means that if one of the kernel objects fails to patch, > > klp_module_coming()'s error path needs to unpatch and cleanup any kernel > > objects that were already patched by a previous patch. > > > > Reported-by: Miroslav Benes > > Suggested-by: Petr Mladek > > Signed-off-by: Joe Lawrence > > --- > > v2: > > > > - cleanup comment describing the new function > > - s/klp_cleanup_module_objects_limited/klp_cleanup_module_patches_limited > > - added a suggested-by tag for Petr since he suggested both code and > > commentary :) > > > > kernel/livepatch/core.c | 60 ++++++++++++++++++++++++++++++------------------- > > 1 file changed, 37 insertions(+), 23 deletions(-) > > > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > index b9628e43c78f..bf8c8fd72589 100644 > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -830,6 +830,41 @@ int klp_register_patch(struct klp_patch *patch) > > } > > EXPORT_SYMBOL_GPL(klp_register_patch); > > > > +/* > > + * Remove parts of patches that touch a given kernel module. The list of > > + * patches processed might be limited. When limit is NULL, all patches > > + * will be handled. > > + */ > > +static void klp_cleanup_module_patches_limited(struct module *mod, > > + struct klp_patch *limit) > > One nit, I think the function name is too verbose. It already has a > 'limit' argument, so I think putting 'limited' in the name is too much > detail. I would just call it klp_cleanup_module_patches(). I rescind my nit. I forgot that the 'limited' suffix is already a convention used throughout the livepatch code. So my ack is unconditional now. Acked-by: Josh Poimboeuf -- Josh