From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755843AbbLAIu3 (ORCPT ); Tue, 1 Dec 2015 03:50:29 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37138 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753697AbbLAIu1 (ORCPT ); Tue, 1 Dec 2015 03:50:27 -0500 Subject: Re: [PATCH] livepatch: fix race between enabled_store() and klp_unregister_patch() To: Josh Poimboeuf , Li Bin References: <1448855677-8392-1-git-send-email-huawei.libin@huawei.com> <20151201011139.GB12513@treble.redhat.com> Cc: 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 From: Jiri Slaby X-Enigmail-Draft-Status: N1110 Message-ID: <565D5F4F.8020807@suse.cz> Date: Tue, 1 Dec 2015 09:50:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151201011139.GB12513@treble.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: > > [] __kernfs_remove+0x1fb/0x380 > [] kernfs_remove+0x23/0x40 > [] sysfs_remove_dir+0x51/0x80 > [] kobject_del+0x18/0x50 > [] kobject_release+0x5a/0x190 > [] 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. thanks, -- js suse labs