From patchwork Wed Jun 14 15:19:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9786747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C65C602C9 for ; Wed, 14 Jun 2017 15:37:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BDD3285D8 for ; Wed, 14 Jun 2017 15:37:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DF7D285DD; Wed, 14 Jun 2017 15:37:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E35E72854F for ; Wed, 14 Jun 2017 15:37:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbdFNPg7 (ORCPT ); Wed, 14 Jun 2017 11:36:59 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:62296 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752180AbdFNPgx (ORCPT ); Wed, 14 Jun 2017 11:36:53 -0400 X-IronPort-AV: E=Sophos;i="5.39,340,1493654400"; d="scan'208";a="26245903" Received: from mail-by2nam01lp0176.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) ([216.32.181.176]) by ob1.hgst.iphmx.com with ESMTP; 14 Jun 2017 23:19:23 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=G+DyU2DsgIJMqSAnKJglgyrWXGHAICSgAzpVcnqIvzo=; b=k0YzFvsflu+LHcm/2yx77G3pSB4Pn6AVhi0D5yvgJ3tbiILqEJzZxJ9oIuXCYO7mqA+LMmjgsgl+E1P19y7JnqYvqJ40/uLZ3tzd7zP9tMP6Ac58puErB7s01aNsxzqaB2eO0wQ4WnLsd0/Y7Of0agGSId1bZXaitJ6pS+2iW/E= Received: from BN6PR04CA0013.namprd04.prod.outlook.com (2603:10b6:404:cb::23) by DM2PR04MB542.namprd04.prod.outlook.com (2a01:111:e400:2430::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Wed, 14 Jun 2017 15:19:21 +0000 Received: from BN3NAM04FT018.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::202) by BN6PR04CA0013.outlook.office365.com (2603:10b6:404:cb::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14 via Frontend Transport; Wed, 14 Jun 2017 15:19:20 +0000 Authentication-Results: spf=fail (sender IP is 63.163.107.21) smtp.mailfrom=wdc.com; kernel.dk; dkim=none (message not signed) header.d=none; kernel.dk; dmarc=none action=none header.from=sandisk.com; Received-SPF: Fail (protection.outlook.com: domain of wdc.com does not designate 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN3NAM04FT018.mail.protection.outlook.com (10.152.92.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1157.12 via Frontend Transport; Wed, 14 Jun 2017 15:19:20 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 32.A5.02805.6F351495; Wed, 14 Jun 2017 08:19:19 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 14 Jun 2017 08:19:17 -0700 X-AuditID: 0ac94369-9c18398000000af5-bd-594153f60cc6 Received: from exp-402881.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id F7.66.11415.2F351495; Wed, 14 Jun 2017 08:19:16 -0700 (PDT) Subject: Re: [PATCH v2 1/6] block: Avoid that blk_exit_rl() triggers a use-after-free To: Ross Zwisler CC: Jens Axboe , , "Christoph Hellwig" , Jan Kara , References: <20170531214350.31157-1-bart.vanassche@sandisk.com> <20170531214350.31157-2-bart.vanassche@sandisk.com> From: Bart Van Assche Message-ID: <3eef2937-86bc-958a-99b5-96a67836d3d3@sandisk.com> Date: Wed, 14 Jun 2017 08:19:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRmVeSWpSXmKPExsXCddJ5ke73YMdIg7Z3HBar7/azWaxcfZTJ Yvb0ZiaLvbe0LRZsfMRo0f/DzIHNY+esu+wel8+Weuy+2cDmcWbBEXaPz5vkAlijuGxSUnMy y1KL9O0SuDKa559hLbimULFw+hWWBsZLUl2MnBwSAiYSm3YfYeti5OIQEljKJPFiZxuUs4NR 4v3ZH0wwVS8eTWWCSCxmlLh65gMrSEJYIFzi56rDYLaIgIrE/HttYEXMAlMYJZrefmaH6NjD KDHz6VR2kCo2ASOJb+9nsoDYvAJ2Esvv/AHq5uB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6e qXOoPRdReu7fobTQzQKt4s3XYqe9e3DxZUjUQyY+RqG0HTKn5/scfWq1eMqtkxNWPVJiKc5I NNRiLipOBABZkMQBHAIAAA== X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39840400002)(39410400002)(39400400002)(39450400003)(39850400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(51234002)(50944005)(24454002)(199003)(9170700003)(305945005)(54356999)(72206003)(31696002)(65826007)(36756003)(6916009)(42882006)(2950100002)(47776003)(39060400002)(230783001)(53416004)(5660300001)(31686004)(33646002)(105606002)(106466001)(229853002)(64126003)(76176999)(23676002)(478600001)(65956001)(230700001)(54906002)(1411001)(356003)(83506001)(2906002)(4001350100001)(50986999)(85426001)(189998001)(77096006)(53936002)(8936002)(4326008)(53546009)(8676002)(81166006)(6246003)(38730400002)(50466002)(65806001)(110136004); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR04MB542; H:milsmgep15.sandisk.com; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT018; 1:tgT2zgoN6Y1dRzxv0JeGnuk4f1R/RRIe6Fy1AwPfBdRTC6pOvXAhFQXM+82xlb/lfwVvsJfa3+A7cqKnA7FNv2rXUZXbVWRF5Fs4CLK+2ABsfxJiapsg2N4JiJvnk2GYPO3F3EU4Pc0G2I9wdCECk5WV/l6XuXXLFpJsVBQ/jOL4hQhWh67nseoDOqhj6Jaz5AHZma0h4JorkrXjxdi5Lkwt2NQF5eWISYs95Fv97g5uGqcmcOh4i8O1KwnGMF4ZcY/I3sVdaRUovaqmAvrw96PE2PQbJsf7g8YCBtWtt8VwTCb6SfInBIVQM//BDI18hdUoeSEqZD7xi3kHJvdFoc8jmBhD4ChZGV6wD6eSvNfBy0qkizRyFAqUQaWfeLWFfkBixWoUtjMzXp3TbQ5KKQF96c/m7JohWO5bIqxzvIhwHHfQ55mMm4DeWDrsYo+mRWPSAJfn+cnxTAcSnV8NyxLVlMWVhXG5y25iCejaBkwewUp8c6a/DuEPA60/nwGfsQ8ROOQ0wekYZuvleoie4/37oyfS8exITEu68ZWi90lTXTBgOtAppUINAyKKSdNAFeMRpJaqg1Nf6cbLCYk15w== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM2PR04MB542: X-MS-Office365-Filtering-Correlation-Id: a58dfbde-c856-4d4d-3302-08d4b338bb41 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081); SRVR:DM2PR04MB542; X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB542; 3:tlxuAQZFiiFT7da435PEfS8jApscO+HKYncsEOuXNF1PGfr1FzWzdSecgdVSCcwvXTlehqF0xMA/RRYDJEIboKsehBcN5rf9EHziCf5QWyzxwn4pycNrz00Fi9tviwglY0pV7xGof3y54EaKn2dDLQUrzH2jUdQ6/gpr4746lS/jv4SXXnLLzrhY4l7EBj6P+B75JZGhrYHWRpBu1lBzEhB0Rsw+T5kfpuEN5gYGXiP+rRPZ9XTQODlqy1yTZvIEfFOQKeeX0splyLwxSQ9+hVFm5TDgQenlOrcMH1yKmAv+fBNUL29SbWDTObQH7JBlgkFbhz+ELcg0zaLJRmcXVafHUxGTrWqrSw/8s/DYlaovTLvXHXP/Q0AZTNVC+P/QRhP37GnaO7GIGCOuDSDIU5mDpmt+V4JIUl91PDfnCXqtt55Pkd6DSXRbKh3vssj95oJm2kLtlOJ03n0dSvAaGQ== X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB542; 25:WTqO8TIZXk/ZERrZ0+R1r15KgvAR4kQOrT2UqQ0fNINvmIn7XPsTPCY1CvwWBbSgQfIjTn0q7A4Bem6v7mDZahSLg2M9RxwOy0Janqya45RqPzu7i3xe0p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UXuOf9RsY7MxQoOl/kTT7VuUx1JlxxKbKTFTGHpnYpdbGHS7eRnCZ7oH3+ij42Tbqm4PRH/bmqowzWBfBZLgjLdm5gEShOYhD4mZZQwqKxo8qQ1o4CDCDjXdAl+o7rgaem9J6aAoJMYanTsXYXqkbHsg133Q2NpX1ueD6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(93006095)(93003095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR04MB542; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR04MB542; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjA0TUI1NDI7NDpBWnVuNzAwRm91Lzd5RTcxOCtyeFgyOWhRV2pI?= =?utf-8?B?dldmSFQrMGhraHJFMUZCMUVDRzZmS3NzRERVRjQ2bE9wOVc2aU9SWnYvNmYx?= =?utf-8?B?eElCUWQvelJEZXhpSjltTURmZ2lUVk00WFdDb0xlZWdlLzg2bnR1RWJzQTVJ?= =?utf-8?B?a1ljZmtVcy9sdndrNmZBSW01RjJSNkxhQzlDU1U4bHc0QmVKekF4WFR2cVd1?= =?utf-8?B?Yzl1bG50SHZhdlMxek9LcU05TVc4VW9FUVBsMWY0bEhRek5zZXZadHhkc3gr?= =?utf-8?B?NEJMbjdLeVBpRTdJR1ErMTh2aHJDZVhPQkdBQUlSaC9yQTNNOVVnQTkwSndr?= =?utf-8?B?bDdNN1RJ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dTMUjOxpcoLpGh7hUUg+f87wKrGeuBX1IJm/PtFkiWME4fWkc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR04MB542; 7:u3RKGbygvFgheCt/aGPbPj5gY7O4W0BR4pSM4p7YjvTYGv4fVWCndhplVvL2ua+VS1VQFO+ZLv9V2PUPav45y8r9ivPb8jU+cdBPbxEjhdiELf7PPxI6f6JZEDmS4eH/cV9Q+igvgmB0MVLm71nLBxCdvO9PuD4iQveirvK32jqzYaugiZfyp2x6YgKKR55ujzWE6cwRX7JKundZ6uK0ETPMkW77x28OZjxCDXEOVwoEu+AMW78flRA71aC4ciSmqiWGgumvZqcijI9fDCuAYegEhV7F+a5hrWwSXAElSeoj1C3drD1UN/SCWHQ4SEX0/Y/NuEk8Iblq+qkW/bGxHA==; 20:YihOWVzH2PWAiHAWH/UvxfaxrSAHhtKnZoETrCS/jwAj1x3lrIYIi3O7hSOAQftC00Qp7IZFpPdA+bv992atsTgS8fAOtayuMwpLfUcA2cwC6JaiARwB7y4eDLKt6c6MV0IjmuG45ESTCRPcEWaQ2+iT0IQIjslXNX22rpvKZOM= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2017 15:19:20.1453 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR04MB542 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 06/13/17 10:54, Ross Zwisler wrote: > This commit is causing the following kernel BUG for me when I shut > down my systems: > > BUG: sleeping function called from invalid context at kernel/workqueue.c:2790 > in_atomic(): 1, irqs_disabled(): 0, pid: 41, name: rcuop/3 Thanks Ross for the testing and for the report. Can you check whether the patch below is sufficient to fix this? Subject: [PATCH] block: Fix a blk_exit_rl() regression Avoid that the following complaint is reported: BUG: sleeping function called from invalid context at kernel/workqueue.c:2790 in_atomic(): 1, irqs_disabled(): 0, pid: 41, name: rcuop/3 1 lock held by rcuop/3/41: #0: (rcu_callback){......}, at: [] rcu_nocb_kthread+0x282/0x500 Call Trace: dump_stack+0x86/0xcf ___might_sleep+0x174/0x260 __might_sleep+0x4a/0x80 flush_work+0x7e/0x2e0 __cancel_work_timer+0x143/0x1c0 cancel_work_sync+0x10/0x20 blk_throtl_exit+0x25/0x60 blkcg_exit_queue+0x35/0x40 blk_release_queue+0x42/0x130 kobject_put+0xa9/0x190 Reported-by: Ross Zwisler Fixes: commit b425e5049258 ("block: Avoid that blk_exit_rl() triggers a use-after-free") Signed-off-by: Bart Van Assche Cc: Ross Zwisler Tested-by: Ross Zwisler --- block/blk-sysfs.c | 34 ++++++++++++++++++++++------------ include/linux/blkdev.h | 2 ++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 283da7fbe034..27aceab1cc31 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -777,24 +777,25 @@ static void blk_free_queue_rcu(struct rcu_head *rcu_head) } /** - * blk_release_queue: - release a &struct request_queue when it is no longer needed - * @kobj: the kobj belonging to the request queue to be released + * __blk_release_queue - release a request queue when it is no longer needed + * @work: pointer to the release_work member of the request queue to be released * * Description: - * blk_release_queue is the pair to blk_init_queue() or - * blk_queue_make_request(). It should be called when a request queue is - * being released; typically when a block device is being de-registered. - * Currently, its primary task it to free all the &struct request - * structures that were allocated to the queue and the queue itself. + * blk_release_queue is the counterpart of blk_init_queue(). It should be + * called when a request queue is being released; typically when a block + * device is being de-registered. Its primary task it to free the queue + * itself. * - * Note: + * Notes: * The low level driver must have finished any outstanding requests first * via blk_cleanup_queue(). - **/ -static void blk_release_queue(struct kobject *kobj) + * + * Although blk_release_queue() may be called with preemption disabled, + * __blk_release_queue() may sleep. + */ +static void __blk_release_queue(struct work_struct *work) { - struct request_queue *q = - container_of(kobj, struct request_queue, kobj); + struct request_queue *q = container_of(work, typeof(*q), release_work); if (test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags)) blk_stat_remove_callback(q, q->poll_cb); @@ -834,6 +835,15 @@ static void blk_release_queue(struct kobject *kobj) call_rcu(&q->rcu_head, blk_free_queue_rcu); } +static void blk_release_queue(struct kobject *kobj) +{ + struct request_queue *q = + container_of(kobj, struct request_queue, kobj); + + INIT_WORK(&q->release_work, __blk_release_queue); + schedule_work(&q->release_work); +} + static const struct sysfs_ops queue_sysfs_ops = { .show = queue_attr_show, .store = queue_attr_store, diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index cc75407881e4..07a26414fdfc 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -590,6 +590,8 @@ struct request_queue { size_t cmd_size; void *rq_alloc_data; + + struct work_struct release_work; }; #define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */