Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3871058ima; Mon, 4 Feb 2019 06:36:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IZZgSpZbBXR6xJObh+64a7xfeD4vbYa65BFxMUeO2VCvmNDmzgjA4BzRHfqh8hGShoeHH1o X-Received: by 2002:a63:1142:: with SMTP id 2mr562727pgr.39.1549290962604; Mon, 04 Feb 2019 06:36:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549290962; cv=none; d=google.com; s=arc-20160816; b=B8vofM6Ag2wQ30h96kwoKWiNJgc9kIDturFxdoGTvTxjsYL19gbWGiq/YbkSjZgMib nQa+dD4ATEWAWe0lRmHmHrAziwJUKZB100uOavljgJ7HedPc+oKU+3zigrhlnpy1W6si rrgDvYAxskCw76faA98MI2ZqyFYjtAwgEFRjwAMATyDTgFQq6LDiKMR8Vj3/T9bYtVqH 1i6SsTRZtj3TbdM8QbAMrWtIGpVH0+TrnvD+GDYfOsLzg4Hct2ywTCyeGkcf2jarH1le b676cQxRgKB9jAay92TIOiOC/ROpLY4GX44cpoqmlSZ/irqU0kjyJEyggQrOUDbC8wae TJvQ== 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=vpN3DRysNYEHpt1HeT1kLt50TNaEGpfqhE7uydbG8Ng=; b=yNe/cqyqd8lKBsv18PpNdN5MjurfZalzkzBJ/qdZ3Unzdkkj/81s4lgeQNRZAOQw9O kNPXOGmatoikoer030nMcqdDfnpEeA/FSquALRHpuGosfaTjSzKB5caWKmNTUoklzDFo FuG0MTniDyrAoKtQJMquONnQIgo0xw3csrJJtEr2NM4EondBFt1nTvYamrYNUo5Ic2zP i78IffyjDvYVd42yOn2ZKmBloWhGx33j6iGH4CYkZjKo7t5uQHG4q4Rvl7+pwehwTCwV /EtqtRsuElp2uLapInJtUTmVLV5jO9romT30+VJLoZCv66IoDw3QNTlt8/gomjzV4pcm tQJg== 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 s12si177708plp.194.2019.02.04.06.35.46; Mon, 04 Feb 2019 06:36:02 -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 S1731494AbfBDN5Q (ORCPT + 99 others); Mon, 4 Feb 2019 08:57:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:35818 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729991AbfBDN5K (ORCPT ); Mon, 4 Feb 2019 08:57:10 -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 E0581ADE6; Mon, 4 Feb 2019 13:57:08 +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 v2 4/4] livepatch: Module coming and going callbacks can proceed with all listed patches Date: Mon, 4 Feb 2019 14:56:53 +0100 Message-Id: <20190204135653.31406-5-pmladek@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20190204135653.31406-1-pmladek@suse.com> References: <20190204135653.31406-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 no 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 no longer need to check for these state. They have to proceed with all listed patches. Suggested-by: Josh Poimboeuf Signed-off-by: Petr Mladek Acked-by: Miroslav Benes Acked-by: Joe Lawrence --- 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