Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1213576imu; Wed, 16 Jan 2019 14:58:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN7BhhTfoeTphq6JS4VN7P6xo371IstD+58ZJRNXDZXCjDce+Jx9VnH/zI+/Xxt5rO9+FeXH X-Received: by 2002:a17:902:680f:: with SMTP id h15mr12226989plk.40.1547679486631; Wed, 16 Jan 2019 14:58:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547679486; cv=none; d=google.com; s=arc-20160816; b=q+FEfqmUoJsjnRgL1pLCTXCMeHG4yPhumdddDYxiH6BtPogtyDUXK+SQAY6YqhhL+4 YmD1c37m0M/1QJD+IWFYNNFrl/3Syn+gEjLIUxjhY2zj5yfwliOiXf0r7aOOJG6taqxF Ojf66kAWj8vrSWG5RxT2qhUPQ4cDxYf5Be/zqTs6hT7nwTAcpV9O6BFZ0Ej6FvPbrR79 /L+24kMqzWaFU0pLcewK2zyuWpx05UITtU7GvJkLLUclgz6lUTgwW86vdDGYo12k/d6H 80XDfKCXDfgMp5oJQOrfPHdylu3jkbv++W0e/8HZCHCu1ZdiVALCN0k2KIzSdPn66sdw jWjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=sI5xgRiOobTjexz6llaSQtUl9qNrbqy1HOqORFnHd74=; b=hlPd54ZU3a4UqQt/JiCexlGYm0qA1WewBnPWMU2A/YTcpJr+navtcV3cPmBTUjJ85v xcC8r27sw2xfmfRxkTX/9xNSYhFYULOFLBhgmFeo20AUFHo8uuNKRWRUAiZR1vHu9XAZ Cu/rjh7N35fyaVOb8bp9flHSabQsQzl874fZDEjfqGV9jbTPVhvetjl6RAui4x2VBZSi 5ZQTsgFo3bhL6O+8gfMkqrTylSepTXeZ2DH733XRUNl2B985d/u4xEYun5JFlskOig20 I9O8uMERaVVxhQ0iUlDCbokE1gig9N6g3BHBtIPZtqf2eKMUlY1Fvf4DEfHONPizGBK6 6gyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si7585867plw.158.2019.01.16.14.57.51; Wed, 16 Jan 2019 14:58:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405354AbfAPQRw (ORCPT + 99 others); Wed, 16 Jan 2019 11:17:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:38698 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405268AbfAPQRt (ORCPT ); Wed, 16 Jan 2019 11:17:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E3073AED4; Wed, 16 Jan 2019 16:17:47 +0000 (UTC) From: Petr Mladek To: Jiri Kosina , Josh Poimboeuf , Miroslav Benes Cc: Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH 3/4] livepatch: Module coming and going callbacks can proceed all listed patches Date: Wed, 16 Jan 2019 17:17:19 +0100 Message-Id: <20190116161720.796-4-pmladek@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20190116161720.796-1-pmladek@suse.com> References: <20190116161720.796-1-pmladek@suse.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Livepatches can not longer get enabled and disabled repeatedly. The list klp_patches contains only enabled patches and eventually the patch in transition. The module coming and going callbacks do not longer need to check for these state. They have to proceed all listed patches. Suggested-by: Josh Poimboeuf Signed-off-by: Petr Mladek --- kernel/livepatch/core.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index b716a6289204..684766d306ad 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -1141,21 +1141,14 @@ static void klp_cleanup_module_patches_limited(struct module *mod, if (!klp_is_module(obj) || strcmp(obj->name, mod->name)) continue; - /* - * Only unpatch the module if the patch is enabled or - * is in transition. - */ - if (patch->enabled || patch == klp_transition_patch) { - - if (patch != klp_transition_patch) - klp_pre_unpatch_callback(obj); + if (patch != klp_transition_patch) + klp_pre_unpatch_callback(obj); - pr_notice("reverting patch '%s' on unloading module '%s'\n", - patch->mod->name, obj->mod->name); - klp_unpatch_object(obj); + pr_notice("reverting patch '%s' on unloading module '%s'\n", + patch->mod->name, obj->mod->name); + klp_unpatch_object(obj); - klp_post_unpatch_callback(obj); - } + klp_post_unpatch_callback(obj); klp_free_object_loaded(obj); break; @@ -1194,13 +1187,6 @@ int klp_module_coming(struct module *mod) goto err; } - /* - * Only patch the module if the patch is enabled or is - * in transition. - */ - if (!patch->enabled && patch != klp_transition_patch) - break; - pr_notice("applying patch '%s' to loading module '%s'\n", patch->mod->name, obj->mod->name); -- 2.13.7