Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp454905pxf; Wed, 10 Mar 2021 09:31:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHmEfNehYM7IbtIlmgSz+8Iwsg2VMmAWw/OCqY5YFHybXIGXFlev3PTdTno/z6kCOBBPn+ X-Received: by 2002:a17:906:3882:: with SMTP id q2mr4718384ejd.540.1615397486089; Wed, 10 Mar 2021 09:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615397486; cv=none; d=google.com; s=arc-20160816; b=TKHp6DKlycXvg0N8hT02gPyOLkNsEB3ufzQFN7Rh18mQLghReur0GzdBDKH3OaQxfA QuLZNuul3K18lFVIFTw6DLDHHpcMkO/kCtKtn7nS7jOWTOVM+C/yk9NPWpxgIQ9RZsp3 8ovyWXhdY3q5pLethzny4cMBat3ZcUshhSLq7HYYLY/jPNTfxqa+m1OLTUr/mNhJ37Kd xkLYw7U02x8qR715JF2oR4C9PwysoQpbRwa19VMDBtV0ScCt/VgMCv2maGyl7WKzkk+l HllF68D8HbHjDM3BH4hljjXGxHlPv1Zk8PQ8AUGNToPUpxHWFTVspvwSvhjI9SjQTJLW AtYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=SeuUV3xHg/ENOTuJpblin7bwCr4AhUKeNDPNx7Yk8y8=; b=hikloITALvk43DVGzOLCZvRYxnQE4TXtBVQBVxN+nVu/n+FQqkibH1hD/wbk/DZn9U dbI/cGIpxS9mPcJoUn3eLHYd45faONvsLHc5CKeUoVigvYodfXT3CxBvZ/ub6wiQGgjB fPqGz2rpryjXwSIzZsiua+/kcqF0jQwUsjnmrZnCQzJaoerSOKAxjqnuu00n2rDk0XIY UOKVgmjfOiXNX6hD5sDTDuf8yulbp1UL+ZV/F5Jzi5C+xJNQ6SsevICzyI8TVHlIt0yd KL7LkRLLJys+ISV45O8+JxquPazyBBAG/wIjeZtN0oabWGOpLFlrCgkdXXrLZxO8OG9U HxpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si51796edd.177.2021.03.10.09.31.03; Wed, 10 Mar 2021 09:31:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbhCJR3O (ORCPT + 99 others); Wed, 10 Mar 2021 12:29:14 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2675 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233186AbhCJR26 (ORCPT ); Wed, 10 Mar 2021 12:28:58 -0500 Received: from fraeml704-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Dwf6V0CQbz67xMl; Thu, 11 Mar 2021 01:22:58 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Wed, 10 Mar 2021 18:28:56 +0100 Received: from [10.47.10.208] (10.47.10.208) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2106.2; Wed, 10 Mar 2021 17:28:55 +0000 Subject: Re: [RFC PATCH v3 3/3] blk-mq: Lockout tagset iterator when exiting elevator To: Bart Van Assche , , , , CC: , , , , References: <1614957294-188540-1-git-send-email-john.garry@huawei.com> <1614957294-188540-4-git-send-email-john.garry@huawei.com> <48a3cf78-3f6d-c13c-bca2-1f8277817b45@acm.org> <9c9360bf-7ca9-5c8f-c61d-441044f9c78f@huawei.com> <784a3686-cb54-561d-740c-30e0b3f46df8@acm.org> From: John Garry Message-ID: <1ac95df7-db0e-2571-3953-4897cac43a6f@huawei.com> Date: Wed, 10 Mar 2021 17:26:53 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.10.208] X-ClientProxiedBy: lhreml705-chm.china.huawei.com (10.201.108.54) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/2021 16:00, Bart Van Assche wrote: >> So I can incorporate any changes and suggestions so far and send a >> non-RFC version - that may get more attention if none extra comes. >> >> As mentioned on the cover letter, if patch 2+3/3 are accepted, then >> patch 1/3 could be simplified. But I plan to leave as is. >> >> BTW, any issue with putting your suggested-by on patch 2/3? > Hi Bart, > > I have added my Reviewed-by to patch 2/3. > OK, thanks. Please note that I still want to check further whether some of Ming's series "blk-mq: implement queue quiesce via percpu_ref for BLK_MQ_F_BLOCKING" can be used. > Regarding the other two patches in this series: I do not agree with > patch 3/3. As I have explained, I am concerned that that patch breaks > existing block drivers. Understood. I need to check your concern further to allay any fears. So I could probably change that patch to drop the early return. Instead we just need to ensure that we complete any existing calls to blk_mq_tagset_busy_iter() prior to freeing the IO scheduler requests. Then we don't need to return early and can iter as before - but, as I said previously, there should be no active tags to iter. > > Are patches 1/3 and 3/3 necessary? Or in other words, is patch 2/3 > sufficient to fix the use-after-free? No, we need them all in some form. So far, reports are that 1/3 solves the most common seen UAF. It is pretty easy to trigger. But the scenarios associated with 2/3 and 3/3 are much harder to trigger, and I needed to add delays in the code just to trigger them. Thanks, John