From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAE84C433F5 for ; Tue, 8 Feb 2022 11:51:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357148AbiBHLv1 (ORCPT ); Tue, 8 Feb 2022 06:51:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357980AbiBHLuQ (ORCPT ); Tue, 8 Feb 2022 06:50:16 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3364C02549C; Tue, 8 Feb 2022 03:42:15 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 71654210F5; Tue, 8 Feb 2022 11:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1644320534; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=txkE5XzzyFXzIuOv7AWLb7NWIjo0bQa6foIWhGJ1WH8=; b=NTxXEVyuDBlX93//ziag9/u/YKfr/o63OWd+BvhP4eq4trTMgcsXcL04QBfS8sP33AlWOc I0oenl/j5W9toXdR1zZcvNgtta5Paomkkeup5R75HYtjIuECDKnOLGFA4SekBLA3+YOw5c 2JQG8NRQe9nuigXqWua6laRNVH5zQq8= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 28308A3B83; Tue, 8 Feb 2022 11:42:14 +0000 (UTC) Date: Tue, 8 Feb 2022 12:42:10 +0100 From: Petr Mladek To: Aaron Tomlin Cc: mcgrof@kernel.org, cl@linux.com, mbenes@suse.cz, akpm@linux-foundation.org, jeyu@kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, live-patching@vger.kernel.org, atomlin@atomlin.com, ghalat@redhat.com, allen.lkml@gmail.com, void@manifault.com, joe@perches.com Subject: Re: [RFC PATCH v4 03/13] module: Move livepatch support to a separate file Message-ID: References: <20220130213214.1042497-1-atomlin@redhat.com> <20220130213214.1042497-4-atomlin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220130213214.1042497-4-atomlin@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 2022-01-30 21:32:04, Aaron Tomlin wrote: > No functional change. > > This patch migrates livepatch support (i.e. used during module > add/or load and remove/or deletion) from core module code into > kernel/module/livepatch.c. At the moment it contains code to > persist Elf information about a given livepatch module, only. > > diff --git a/include/linux/module.h b/include/linux/module.h > index f4338235ed2c..c7daac4d16ee 100644 > --- a/include/linux/module.h > +++ b/include/linux/module.h > @@ -663,17 +663,23 @@ static inline bool module_requested_async_probing(struct module *module) > return module && module->async_probe_requested; > } > > -#ifdef CONFIG_LIVEPATCH > static inline bool is_livepatch_module(struct module *mod) > { > - return mod->klp; > + if (IS_ENABLED(CONFIG_LIVEPATCH)) { > + if (mod->klp) > + return true; > + } > + return false; The following is easier to follow for me. But it is a matter of taste. Feel free to use whatever you prefer. return IS_ENABLED(CONFIG_LIVEPATCH) && mod->klp; > } > -#else /* !CONFIG_LIVEPATCH */ > -static inline bool is_livepatch_module(struct module *mod) > + > +static inline bool set_livepatch_module(struct module *mod) > { > + if (IS_ENABLED(CONFIG_LIVEPATCH)) { > + mod->klp = true; > + return true; > + } > return false; This should go to internal.h. Alternative is to move both is_livepatch_module() and set_livepatch_module() into include/linux/livepatch.h. I do not have strong opinion. > } > -#endif /* CONFIG_LIVEPATCH */ > > bool is_module_sig_enforced(void); > void set_module_sig_enforced(void); Otherwise, it looks good to me. Best Regards, Petr