From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752296AbcBJPxT (ORCPT ); Wed, 10 Feb 2016 10:53:19 -0500 Received: from mx2.suse.de ([195.135.220.15]:56629 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751675AbcBJPxQ (ORCPT ); Wed, 10 Feb 2016 10:53:16 -0500 Date: Wed, 10 Feb 2016 16:53:13 +0100 From: Petr Mladek To: Jessica Yu Cc: Rusty Russell , Josh Poimboeuf , Seth Jennings , Jiri Kosina , Vojtech Pavlik , Jonathan Corbet , Miroslav Benes , linux-api@vger.kernel.org, live-patching@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [RFC PATCH v4 2/6] module: preserve Elf information for livepatch modules Message-ID: <20160210155313.GI3305@pathway.suse.cz> References: <1454548271-24923-1-git-send-email-jeyu@redhat.com> <1454548271-24923-3-git-send-email-jeyu@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454548271-24923-3-git-send-email-jeyu@redhat.com> 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 Wed 2016-02-03 20:11:07, Jessica Yu wrote: > diff --git a/kernel/module.c b/kernel/module.c > index 71c77ed..9c16eb2 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -2676,6 +2764,23 @@ static int copy_module_from_user(const void __user *umod, unsigned long len, > return 0; > } > > +#ifdef CONFIG_LIVEPATCH > +static int find_livepatch_modinfo(struct module *mod, struct load_info *info) > +{ > + mod->klp = get_modinfo(info, "livepatch") ? true : false; > + > + return 0; > +} > +#else /* !CONFIG_LIVEPATCH */ > +static int find_livepatch_modinfo(struct module *mod, struct load_info *info) > +{ > + if (get_modinfo(info, "livepatch")) One more thing. I suggest to write a friendly message here. For example: pr_err("LifePatch support is not available. Rejecting the module: s\n", mod->name); It might safe some debugging a poor user or developer. > + return -ENOEXEC; > + > + return 0; > +} > +#endif /* CONFIG_LIVEPATCH */ > + Best Regards, Petr