Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761453AbcLXCrl (ORCPT ); Fri, 23 Dec 2016 21:47:41 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:46012 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751567AbcLXCrh (ORCPT ); Fri, 23 Dec 2016 21:47:37 -0500 Subject: Re: [4.10, panic, regression] iscsi: null pointer deref at iscsi_tcp_segment_done+0x20d/0x2e0 To: Linus Torvalds , Christoph Hellwig References: <20161216185906.t2wmrr6wqjdsrduw@straylight.hirudinean.org> <20161221221638.GD4758@dastard> <20161222001303.nvrtm22szn3hgxar@straylight.hirudinean.org> <20161222051322.GF4758@dastard> <20161222065012.GI4758@dastard> <20161222185030.so4btkuzzkih3owz@straylight.hirudinean.org> <20161223000356.dxwkgsei32w7hc4f@straylight.hirudinean.org> <20161223100014.GA29467@lst.de> CC: Chris Leech , Ming Lei , "Dave Chinner" , Johannes Weiner , "Linux Kernel Mailing List" , Lee Duncan , , Linux SCSI List , linux-block , "Michael S. Tsirkin" From: Jens Axboe Message-ID: Date: Fri, 23 Dec 2016 19:45:45 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [66.29.164.166] X-ClientProxiedBy: BLUPR0601CA0036.namprd06.prod.outlook.com (10.163.210.46) To CY4PR15MB1189.namprd15.prod.outlook.com (10.172.177.11) X-MS-Office365-Filtering-Correlation-Id: ab2ea517-12c1-4676-a5b7-08d42ba6fc34 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR15MB1189; X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1189;3:dEYx6x13FB5ZTrkWSOIRnWvNwclpjJQWI2XSneTaC1cldq9uV+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XDL/9+UgMwO4G2o0JyN59fvQ4YsT3jLdLkfVIrTbPujxeWe1oSPsUWjD87qBW7nUy2wCwBOvdBUtXLiplaYET90PNFFoxBhTFeInwBxc8w65bB6pBJbvUqz4C4jfjgWvtWSoU+h/H8qsCQIAy17fmXl8SjS24tBvZKT1Kja1LNAyWx5R5HipLkUXWAY3CFuISAaTUqoGRJAysZnKGNhWngnsLQp+3+M4amInZG3vh3f/feeykw3OZhLfTZu8rAbrQOSbGrKqkPM+z3zH6z9GXXyyPbpQxRES90u3dl5ZjNVA6H9254p6nFaK+mVmJ9ylnqY55oVjxWksiwymM4egRXtqsrYje/IfxWX+17+KvDB07NDwDFIVyhhqsVzBRgKja3e7dtqlK9nSYotd0JFm7FQeT+9cBSjsOyajOvFLtDBFDKk2Hz5CVUgb+s0JIgtwDvfcu3pGCZJ5a X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558021)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148);SRVR:CY4PR15MB1189;BCL:0;PCL:0;RULEID:;SRVR:CY4PR15MB1189; X-Microsoft-Exchange-Diagnostics: 1;CY4PR15MB1189;4:6yg3Gpo6rUrq+u2nSnblb4VD77iYzaBYG3kRbSJIeKHq7sq9zZJ+saUO2uytdJiWRu0qb0GguNqzp54at4KHDzScKL8Pf0eitsaFzVJHvGsxUNFkY1+bQU6aeqHgNz3vQq0E9VrQS8gEm7eFL7HWDAjMgzMF9AZFSzh0Ull4uuP1g06h3gnCIZLLOxtqNekVeW/hy2UuTiDnB8F/y7gGXsi1AdsFWPNpGwONPTtEhaG8GndMbwXDjDVV5hdKvAXamE85r1rZohRkGoocS8VJMtarE4bAZa16kd1rIYzVkXXIPmoPGGRl9L1rhOvbKkL+IKDiMC3biuG7k8hzgmX6j0OiQH+KNK7gc6HGkV3YIBxJe3V7T3RWhV8Pv2VhJW4xoQ9q/Stcwsj3nXK0UHKpmpOvJmjNdul3fcAWY+8iinDYzWeutiyQZjnA4GVEKAZOBrkcl9QtsYRPZw77new2FYOMLZKlrsg/5D5P8Fdxm7FGwwW/qnimm/PMO/7ymj4cXrWQs1E/m8tENGXIRzRq/yDF6OXlbPaQlLZdZIfi/5Jot1fPB9eqq59eGpaxype/Ct5u4qEIkRvIOtgPQ2/JnLsTN5bhe9n/Iw4L3CdN9x4= X-Forefront-PRVS: 0166B75B74 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(39830400002)(39450400003)(39410400002)(24454002)(189002)(377454003)(199003)(6486002)(65826007)(25786008)(86362001)(101416001)(38730400001)(90366009)(65806001)(2906002)(76176999)(3846002)(54356999)(65956001)(50986999)(47776003)(39060400001)(229853002)(6116002)(92566002)(36756003)(7416002)(42186005)(8676002)(77096006)(7736002)(117156001)(33646002)(305945005)(50466002)(64126003)(4326007)(66066001)(31696002)(189998001)(81156014)(31686004)(230700001)(93886004)(23676002)(4001350100001)(106356001)(83506001)(105586002)(6666003)(68736007)(2950100002)(5660300001)(5001770100001)(97736004)(81166006);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR15MB1189;H:[192.168.1.176];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjE1TUIxMTg5OzIzOjBVNGVLNm9oWXRFamJSVlJZRFBZM3pSRmZs?= =?utf-8?B?dkhlUUxVOENVdUN6Z2JLVk84aUJtbStmSnZ4QitPSkp1R0IyY3Zla2FRQ3B3?= =?utf-8?B?bEx3czdQK0U0RmhQMGZlQzNzRGY3dDNpanpWNmRIWG5XS240WlZWZ1lFNTkz?= =?utf-8?B?OTNHKzI3RExodXMwN3JIZTdoSmJ2aGYrY1ZuSDVJOWtMQ3djcVcrdkVwdjZO?= =?utf-8?B?ejYxW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ZvvUaB26yxeXR/m72CFlLbn/txHeI/ZoeoPYzF+FUMqsLqFJZEBOW0vV3dgFhxbIq5naqkaMWZUPyhFknlavvDBbqWOW58CTnYGj1iOO0OJwYngRNhiEXkJn8oTQM7mF4NlBhoR1NaN+pm+Z9crOH3PdgBJVOeIrQpSF7U9A1se8Le0NOPME1VUh6ns8Q1T/6zItA==;20:8aJ2Z/6bGbd74boKCZjfCqWnZ40iHQ2fViIOayxTUmonNlY5NJUGUdn2+2cz9IMtgkWEPpd6Dql858QkbMBtkdshUp7iWec/Gx5WKopCR+QoFS7tazcT1osl0ybnBuadpG771Nf+buvVsv4Bm4AjmwSRDrnq2Wsj6EgnP/GHxZU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2016 02:45:51.4237 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR15MB1189 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-23_18:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1857 Lines: 46 On 12/23/2016 12:42 PM, Linus Torvalds wrote: > On Fri, Dec 23, 2016 at 2:00 AM, Christoph Hellwig wrote: >> >> From: Christoph Hellwig >> Date: Fri, 23 Dec 2016 10:57:06 +0100 >> Subject: virtio_blk: avoid DMA to stack for the sense buffer >> >> Most users of BLOCK_PC requests allocate the sense buffer on the stack, >> so to avoid DMA to the stack copy them to a field in the heap allocated >> virtblk_req structure. Without that any attempt at SCSI passthrough I/O, >> including the SG_IO ioctl from userspace will crash the kernel. Note that >> this includes running tools like hdparm even when the host does not have >> SCSI passthrough enabled. > > Ugh. This patch is nasty. > > I think we should just fix blk_execute_rq() instead. > > But from a quick look, we also have at least sg_scsi_ioctl() and > sg_io() doing the same thing. > > And the SG_IO thing in bsg_ioctl(). And spi_execute() in scsi_transport_spi.c > > And resp_requests() in scsi_debug.c. It's not that it's technically hard to fix up, it's more that it's a pain in the ass to have to do it. For instance, for blk_execute_rq(), we either should enforce that the caller allocates it dynamically and then free it, or we need nasty hack where the caller needs to know he has to free it. Pretty obvious what I would prefer there. And yes, there would be a good chunk of other places where this would nede to be fixed up... > So I guess ugly it may need to be, and the rule is that the sense > buffer really can be on the stack and you can't DMA to/from it. > Comments from others? I'm just wondering why this is being hit now, we have a 4.9 release with this issue and nobody reported it (that I saw)... Which is pretty sad. If no one beats me to it, I'll try and get a patch done on Sunday. We're in the midst of the holidays here. -- Jens Axboe