From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Miroslav Benes <mbenes@suse.cz>,
jeyu@redhat.com, jikos@kernel.org, live-patching@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] livepatch: force transition process to finish
Date: Fri, 26 May 2017 12:37:56 -0500 [thread overview]
Message-ID: <20170526173756.khuimh6eh3xcvvyh@treble> (raw)
In-Reply-To: <20170525160307.GI26699@pathway.suse.cz>
On Thu, May 25, 2017 at 06:03:07PM +0200, Petr Mladek wrote:
> On Thu 2017-05-25 14:59:55, Miroslav Benes wrote:
> >
> > > > > In fact, I would suggest to take klp_mutex in force_store()
> > > > > and do all actions synchronously, including the check
> > > > > of klp_transition_patch.
> > > >
> > > > I still think it is better not do it. klp_unmark_tasks() does nothing else
> > > > than tasks already do. They call klp_update_patch_state() by themselves
> > > > and they do not grab klp_mutex lock for doing that. klp_unmark_tasks()
> > > > only forces this action.
> > >
> > > You have a point. But I am not convinced ;-) klp_update_patch_state()
> > > was called very carefully only when it was safe. The forcing
> > > intentionally breaks the consistency model. User should really know
> > > what they are doing when they use this feature.
> > >
> > > I think that we should actually taint the kernel. Developers should
> > > know when users were pulling their legs.
> >
> > We could do that. I can change pr_warn() to WARN_ON_ONCE(), which would of
> > course taint the kernel.
>
> Sounds good to me.
I'm thinking that WARN_ON_ONCE() seems too severe. If the patch didn't
need a consistency model in the first place then it wouldn't be worth
warning about.
We have to trust that the user knows what they're doing. And that's
true for the entire live patching process, including patch analysis and
patch creation. And anyway we already have a taint flag for that:
TAINT_LIVEPATCH.
> > > > On the other hand, I do not see a problem in doing that. We already have a
> > > > relationship between klp_mutex and tasklist_lock defined elsewhere, so it
> > > > is safe.
> > >
> > > Yup.
> > >
> > > > It would only serialize things needlessly.
> > >
> > > I do not agree. The speed is not important here. Also look
> > > into klp_reverse_transition(). We explicitly clear all
> > > TIF_PATCH_PENDING flags and call synchronize_rcu() just
> > > to make the situation easier and reduce space for potential
> > > mistakes.
> >
> > Yes, because we had to do that. We ran into problems otherwise. We do not
> > have to do it here. It does not help anything in my opinion.
>
> AFAIK, we did not have to do it, see
> https://lkml.kernel.org/r/20161222143452.GK25166@pathway.suse.cz
> and the comment starting with "It would still leave a small".
>
> Just for record, the idea of disabling the TIF flags came from Josh
> in another mail. I have just repeated it.
>
> I think that the problem already is complex enough and the
> serialization would reduce the space of potential races.
> But it is possible that I see it just too complex here.
IMO we can skip the mutex. The consistency model will be broken anyway,
so all bets are off.
--
Josh
next prev parent reply other threads:[~2017-05-26 17:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 12:00 [PATCH 0/3] livepatch: Introduce force sysfs attribute Miroslav Benes
2017-05-18 12:00 ` [PATCH 1/3] livepatch: Add " Miroslav Benes
2017-05-18 13:05 ` Libor Pechacek
2017-05-18 13:20 ` Miroslav Benes
2017-05-18 12:00 ` [PATCH 2/3] livepatch: send a fake signal to all blocking tasks Miroslav Benes
2017-05-18 13:10 ` Libor Pechacek
2017-05-18 13:20 ` Miroslav Benes
2017-05-18 16:49 ` Oleg Nesterov
2017-05-18 18:14 ` Miroslav Benes
2017-05-18 19:52 ` Oleg Nesterov
2017-05-19 7:51 ` Miroslav Benes
2017-05-23 17:30 ` Josh Poimboeuf
2017-05-24 8:31 ` Miroslav Benes
2017-05-18 12:00 ` [PATCH 3/3] livepatch: force transition process to finish Miroslav Benes
2017-05-18 13:16 ` Libor Pechacek
2017-05-18 13:22 ` Miroslav Benes
2017-05-23 17:27 ` Josh Poimboeuf
2017-05-24 8:36 ` Miroslav Benes
2017-05-24 13:06 ` Petr Mladek
2017-05-24 14:15 ` Miroslav Benes
2017-05-24 15:09 ` Petr Mladek
2017-05-25 12:59 ` Miroslav Benes
2017-05-25 16:03 ` Petr Mladek
2017-05-26 17:37 ` Josh Poimboeuf [this message]
2017-05-29 12:28 ` Petr Mladek
2017-05-30 12:41 ` Josh Poimboeuf
2017-05-26 17:38 ` Josh Poimboeuf
2017-05-29 9:26 ` 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=20170526173756.khuimh6eh3xcvvyh@treble \
--to=jpoimboe@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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®