From: Miroslav Benes <mbenes@suse.cz>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Jiri Kosina <jikos@kernel.org>,
jeyu@redhat.com, pmladek@suse.com, jslaby@suse.cz,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
huawei.libin@huawei.com, minfei.huang@yahoo.com
Subject: Re: [RFC PATCH] livepatch: allow removal of a disabled patch
Date: Thu, 5 May 2016 16:25:48 +0200 (CEST) [thread overview]
Message-ID: <alpine.LNX.2.00.1605051618510.19692@pobox.suse.cz> (raw)
In-Reply-To: <20160505132748.kwk3pmgetud3c66r@treble>
On Thu, 5 May 2016, Josh Poimboeuf wrote:
> On Thu, May 05, 2016 at 10:28:12AM +0200, Miroslav Benes wrote:
> > I think it boils down to the following problem.
> >
> > 1. CONFIG_DEBUG_KOBJECT_RELEASE=y
> >
> > 2. we have dynamic kobjects, so there is a pointer in klp_patch to struct
> > kobject
> >
> > 3. it is allocated during klp_init_patch() and all is fine
> >
> > 4. now we want to remove the patch module. It is disabled and module_put()
> > is called. User calls rmmod on the module.
> >
> > 5. klp_unregister_patch() is called in __exit method.
> >
> > 6. klp_free_patch() is called.
> >
> > 7. kobject_put(patch->kobj) is called.
> >
> > ...now it gets interesting...
> >
> > 8. among others kobject_cleanup() is scheduled as a delayed work (this is
> > important).
> >
> > 9. there is no completion, so kobject_put returns and the module goes
> > away.
> >
> > 10. someone calls patch enabled_store attribute (for example). They can
> > because kobject_cleanup() has not been called yet. It is delayed
> > scheduled.
> >
> > ...crash...
>
> But what exactly causes the crash? In enabled_store() we can see that
> the patch isn't in the list, so we can return -EINVAL.
Ok, bad example. Take enabled_show() instead. It could be fixed in the
same way, but I am not sure it is the right thing to do. It does not scale
because the problem is elsewhere.
Anyway, it is (even if theoretically) there in my opinion and we
have two options.
1. We could forget about CONFIG_DEBUG_KOBJECT_RELEASE and all is ok
without completion and regardless of dynamic/static kobject allocation.
2. We introduce completion and we are ok even with
CONFIG_DEBUG_KOBJECT_RELEASE=y and again regardless of dynamic/static
kobject allocation.
Miroslav
next prev parent reply other threads:[~2016-05-05 14:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 11:57 [RFC PATCH] livepatch: allow removal of a disabled patch Miroslav Benes
2016-05-02 15:08 ` Josh Poimboeuf
2016-05-03 8:16 ` Miroslav Benes
2016-05-31 23:13 ` Jiri Kosina
2016-05-03 21:37 ` Josh Poimboeuf
2016-05-03 22:31 ` Jiri Kosina
2016-05-04 2:39 ` Josh Poimboeuf
2016-05-04 3:36 ` Josh Poimboeuf
2016-05-04 11:58 ` Miroslav Benes
2016-05-04 13:14 ` Josh Poimboeuf
2016-05-04 14:35 ` Miroslav Benes
2016-05-04 16:14 ` Josh Poimboeuf
2016-05-05 8:28 ` Miroslav Benes
2016-05-05 13:27 ` Josh Poimboeuf
2016-05-05 14:25 ` Miroslav Benes [this message]
2016-05-05 15:04 ` Josh Poimboeuf
2016-05-05 21:08 ` Jiri Kosina
2016-05-06 0:42 ` Jessica Yu
2016-05-06 7:51 ` 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=alpine.LNX.2.00.1605051618510.19692@pobox.suse.cz \
--to=mbenes@suse.cz \
--cc=huawei.libin@huawei.com \
--cc=jeyu@redhat.com \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=minfei.huang@yahoo.com \
--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;
as well as URLs for NNTP newsgroup(s).