From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70595C433DF for ; Tue, 9 Jun 2020 17:32:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 33BD120691 for ; Tue, 9 Jun 2020 17:32:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SgB1Sx4b" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33BD120691 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9CC3C6B0003; Tue, 9 Jun 2020 13:32:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A36F6B0005; Tue, 9 Jun 2020 13:32:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B8046B0006; Tue, 9 Jun 2020 13:32:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 6FFF36B0003 for ; Tue, 9 Jun 2020 13:32:54 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4316918129D10 for ; Tue, 9 Jun 2020 17:32:54 +0000 (UTC) X-FDA: 76910368668.13.cub68_2a0f27826dc4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 0575B18228F23 for ; Tue, 9 Jun 2020 17:32:54 +0000 (UTC) X-HE-Tag: cub68_2a0f27826dc4 X-Filterd-Recvd-Size: 4120 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Jun 2020 17:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1CWK56Bk1GHrXr3w3wzon+FcpFohKqu88sAYSOQgEFM=; b=SgB1Sx4bvrGnT6eCMKkEU2oRDe aEDNmi4SqOfNTU2RS6Uo9FTIA80ZIRAVjR4R9xmjvj6jF/lYVsaBAIiV8pU/0krzPgXowjGlqkkQC z7RcZIIbY4PFTJT5Gm3zIMBvI5uCJ8VFmDwCoyH7hIMR+KJW3u6wjzMKQPHSW/7QXkL9i3bmFrxKv wQphVfi3F3EgFov+NqfSD33cizDNsjdBTZanKVDRox1HYJZc4o5BNYVWDpEEwhvZvms3loyYaCwbi wwt8+K970BTHWvvaN9z8Syq+/454isZbXPaz5YULTfJtGYA6hu4jjrDiHELsJiYkjkByTF+Q9vbaF MkIz44FQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jii6k-0004OT-Be; Tue, 09 Jun 2020 17:32:18 +0000 Date: Tue, 9 Jun 2020 10:32:18 -0700 From: Christoph Hellwig To: Luis Chamberlain Cc: Christoph Hellwig , Jan Kara , axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, gregkh@linuxfoundation.org, rostedt@goodmis.org, mingo@redhat.com, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org, mhocko@suse.com, yukuai3@huawei.com, martin.petersen@oracle.com, jejb@linux.ibm.com, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Omar Sandoval , Hannes Reinecke , Michal Hocko , syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com Subject: Re: [PATCH v6 6/6] blktrace: fix debugfs use after free Message-ID: <20200609173218.GA7968@infradead.org> References: <20200608170127.20419-1-mcgrof@kernel.org> <20200608170127.20419-7-mcgrof@kernel.org> <20200609150602.GA7111@infradead.org> <20200609172922.GP11244@42.do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200609172922.GP11244@42.do-not-panic.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 0575B18228F23 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 09, 2020 at 05:29:22PM +0000, Luis Chamberlain wrote: > Is scsi-generic is the only unwanted ugly child blktrace has to deal > with? For some reason I thought drivers/md/md.c was one but it seems > like it is not. Do we have an easy way to search for these? I think > this would just affect how we express the comment only. grep for blk_trace_setup. For all blk devices that setup comes in through the block device ioctl path, and that relies on having a struct block_device and queue. sg on the other hand calls blk_trace_setup directly with a NULL bdev argument. > > */ > > - dir = q->sg_debugfs_dir; > > + dir = debugfs_create_dir(buts->name, blk_debugfs_root); > > + bt->dir = dir; > > The other chicken and egg problem to consider at least in the comments > is that the debugfs directory for these types of devices *have* an > exposed path, but the data structure is rather opaque to the device and > even blktrace. Fortunately given the recent set of changes around the > q->blk_trace and clarifications around its use we have made it clear now > that so long as hold the q->blk_trace_mutex *and* check q->blk_trace we > *should* not race against two separate creations of debugfs directories, > so I think this is safe, so long as these indpendent drivers don't end > up re-using the same path for some other things later in the future, and > since we have control over what goes under debugfsroot block / I think > we should be good. > > But I think that the concern for race on names may still be worth > explaining a bit here. Feel free to add more comments, but please try to keep them short and crisp. At the some point long comments really distract from what is going on.