From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Li Bin <huawei.libin@huawei.com>,
sjenning@redhat.com, jikos@kernel.org, vojtech@suse.com,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
guohanjun@huawei.com, dingtianhong@huawei.com,
xiexiuqi@huawei.com, zhouchengming1@huawei.com,
Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch()
Date: Tue, 1 Dec 2015 09:53:37 -0600 [thread overview]
Message-ID: <20151201155337.GD12513@treble.redhat.com> (raw)
In-Reply-To: <565D5F4F.8020807@suse.cz>
On Tue, Dec 01, 2015 at 09:50:23AM +0100, Jiri Slaby wrote:
> On 12/01/2015, 02:11 AM, Josh Poimboeuf wrote:
> > When I try to recreate something similar by putting a delay in
> > enabled_store(), klp_free_patch() just sleeps on its call to
> > kobject_put() until enabled_store() returns. The unregister stack looks
> > like:
> >
> > [<ffffffff812e966b>] __kernfs_remove+0x1fb/0x380
> > [<ffffffff812ea273>] kernfs_remove+0x23/0x40
> > [<ffffffff812ec601>] sysfs_remove_dir+0x51/0x80
> > [<ffffffff81407fb8>] kobject_del+0x18/0x50
> > [<ffffffff8140804a>] kobject_release+0x5a/0x190
> > [<ffffffff81407f27>] kobject_put+0x27/0x50
>
> What about _put outside of klp_mutex in klp_unregister_patch (and maybe
> the other _put's as well)? Plus Li Bin's patch.
This approach sounds the best to me. I think all _put's for the patch
kobj need to be outside the mutex. There's also a _put for the patch
kobj in the klp_init_patch() error path which needs to be moved out.
I think the rest of the _put's (for object and func kobjs) are fine as
they are, because they don't have corresponding sysfs functions which
get the mutex.
--
Josh
next prev parent reply other threads:[~2015-12-01 15:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 3:54 [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch() Li Bin
2015-11-30 13:53 ` Petr Mladek
2015-12-01 1:11 ` Josh Poimboeuf
2015-12-01 2:46 ` libin
2015-12-01 8:50 ` Jiri Slaby
2015-12-01 14:13 ` Petr Mladek
2015-12-01 14:28 ` Jiri Slaby
2015-12-01 16:57 ` Petr Mladek
2015-12-01 15:53 ` Josh Poimboeuf [this message]
2015-12-15 8:14 ` 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=20151201155337.GD12513@treble.redhat.com \
--to=jpoimboe@redhat.com \
--cc=dingtianhong@huawei.com \
--cc=guohanjun@huawei.com \
--cc=huawei.libin@huawei.com \
--cc=jikos@kernel.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=sjenning@redhat.com \
--cc=vojtech@suse.com \
--cc=xiexiuqi@huawei.com \
--cc=zhouchengming1@huawei.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 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.