Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964853AbeAKPJ3 (ORCPT + 1 other); Thu, 11 Jan 2018 10:09:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36268 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964827AbeAKPJ2 (ORCPT ); Thu, 11 Jan 2018 10:09:28 -0500 Date: Thu, 11 Jan 2018 09:09:15 -0600 From: Josh Poimboeuf To: Miroslav Benes Cc: jeyu@kernel.org, jikos@kernel.org, pmladek@suse.com, jbaron@akamai.com, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] livepatch: add locking to force and signal functions Message-ID: <20180111150915.k3smqm3j6bfesup3@treble> References: <20171221134043.32543-1-mbenes@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171221134043.32543-1-mbenes@suse.cz> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 11 Jan 2018 15:09:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Dec 21, 2017 at 02:40:43PM +0100, Miroslav Benes wrote: > klp_send_signals() and klp_force_transition() do not acquire klp_mutex, > because it seemed to be superfluous. A potential race in > klp_send_signals() was harmless and there was nothing in > klp_force_transition() which needed to be synchronized. That changed > with the addition of klp_forced variable during the review process. > > There is a small window now, when klp_complete_transition() does not see > klp_forced set to true while all tasks have been already transitioned to > the target state. module_put() is called and the module can be removed. > > Acquire klp_mutex in sysfs callback to prevent it. Do the same for the > signal sending just to be sure. There is no real downside to that. > > Reported-by: Jason Baron > Signed-off-by: Miroslav Benes Acked-by: Josh Poimboeuf -- Josh