All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Jessica Yu <jeyu@redhat.com>, Jiri Kosina <jikos@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>,
	linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	Chunyu Hu <chuhu@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH] livepatch/module: make TAINT_LIVEPATCH module-specific
Date: Thu, 25 Aug 2016 07:31:51 -0500	[thread overview]
Message-ID: <20160825123151.w2svlqfermcxrpm4@treble> (raw)
In-Reply-To: <20160825074606.GA2091@dhcp128.suse.cz>

On Thu, Aug 25, 2016 at 09:46:06AM +0200, Petr Mladek wrote:
> Hi,
> 
> I have spent some time to understand the change. I hope that the
> comments below would help others.
> 
> On Wed 2016-08-24 16:33:00, Josh Poimboeuf wrote:
> > There's no reliable way to determine which module tainted the kernel
> > with CONFIG_LIVEPATCH.  For example, /sys/module/<klp module>/taint
> > doesn't report it.  Neither does the "mod -t" command in the crash tool.
> > 
> > Make it crystal clear who the guilty party is by converting
> > CONFIG_LIVEPATCH to a module taint flag.
> 
> The above paragraph is a bit confusing. The patch adds TAINT_LIVEPATCH into the
> list of module taint flags.
>  
> > This changes the behavior a bit: now the the flag gets set when the
> > module is loaded, rather than when it's enabled.
> > 
> > Reviewed-by: Chunyu Hu <chuhu@redhat.com>
> > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > ---
> >  kernel/livepatch/core.c |  3 ---
> >  kernel/module.c         | 35 ++++++++++++-----------------------
> >  2 files changed, 12 insertions(+), 26 deletions(-)
> > 
> > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> > index 5fbabe0..af46438 100644
> > --- a/kernel/livepatch/core.c
> > +++ b/kernel/livepatch/core.c
> > @@ -545,9 +545,6 @@ static int __klp_enable_patch(struct klp_patch *patch)
> >  	    list_prev_entry(patch, list)->state == KLP_DISABLED)
> >  		return -EBUSY;
> >  
> > -	pr_notice_once("tainting kernel with TAINT_LIVEPATCH\n");
> > -	add_taint(TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
> 
> The first important thing is that add_taint() is replaced with
> add_taint_module(). The other function sets also mod->taints.
> 
> It is a module taint flag, so it really makes sense to call it
> when the module is loaded.
> 
> > -
> >  	pr_notice("enabling patch '%s'\n", patch->mod->name);
> >  
> >  	klp_for_each_object(patch, obj) {
> > diff --git a/kernel/module.c b/kernel/module.c
> > index 529efae..fd5f95b 100644
> > --- a/kernel/module.c
> > +++ b/kernel/module.c
> > @@ -1149,6 +1149,8 @@ static size_t module_flags_taint(struct module *mod, char *buf)
> >  		buf[l++] = 'C';
> >  	if (mod->taints & (1 << TAINT_UNSIGNED_MODULE))
> >  		buf[l++] = 'E';
> > +	if (mod->taints & (1 << TAINT_LIVEPATCH))
> > +		buf[l++] = 'K';
> 
> This is the second important part of the change. It shows the flag
> in /sys/module/<klp module>/taint.
> 
> The rest is just reshufling of the code. But it has problems
> as already reported by kbuild test robot.
> 
> The change looks good to me. We just need to fix the compilation
> problem by adding some #ifdefs.

This patch was a bit sloppy.  I was doing too many things at once. :-)

I'll fix it up and improve the description.

-- 
Josh

  reply	other threads:[~2016-08-25 12:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 21:33 [PATCH] livepatch/module: make TAINT_LIVEPATCH module-specific Josh Poimboeuf
2016-08-24 21:43 ` Josh Poimboeuf
2016-08-25  0:54 ` Jiri Kosina
2016-08-25  4:14   ` Rusty Russell
2016-08-25  2:53 ` Jessica Yu
2016-08-25  3:23 ` [PATCH] " Josh Poimboeuf
2016-08-25  6:40 ` kbuild test robot
2016-08-25  7:46 ` Petr Mladek
2016-08-25 12:31   ` Josh Poimboeuf [this message]
2016-08-25 14:25 ` Miroslav Benes
2016-08-25 14:42   ` Josh Poimboeuf
2016-08-25 14:47     ` Miroslav Benes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160825123151.w2svlqfermcxrpm4@treble \
    --to=jpoimboe@redhat.com \
    --cc=chuhu@redhat.com \
    --cc=jeyu@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.