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=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 BDA7AC83007 for ; Wed, 29 Apr 2020 12:02:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 87836214D8 for ; Wed, 29 Apr 2020 12:02:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87836214D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2078F8E0005; Wed, 29 Apr 2020 08:02:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B6C58E0001; Wed, 29 Apr 2020 08:02:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CD958E0005; Wed, 29 Apr 2020 08:02:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id ED9888E0001 for ; Wed, 29 Apr 2020 08:02:34 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B23E6180AD815 for ; Wed, 29 Apr 2020 12:02:34 +0000 (UTC) X-FDA: 76760755428.07.skirt26_6dc775acad30c X-HE-Tag: skirt26_6dc775acad30c X-Filterd-Recvd-Size: 4871 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Apr 2020 12:02:34 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id n11so917525pgl.9 for ; Wed, 29 Apr 2020 05:02:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=T/5a3HTQNKy4AqGfHf3RhknW3g8HjozXrYnmRz796hw=; b=N8jPwAvF1GkNyvrEet6RPEs4F8oaFwYeEDFhxfP2sMqldO4qivCF9LnkmHNfTC4BHg tb7jbshlJS1u8emp9anD5/O+cToOINqQquH8koUZGSeyESXOKhgWhK4YpN2KKol98eAZ 5isSu+I1N5FpuvFKFHBpWxGUttyHgdHJNcgPOJ26ZmLBuchGCCd73Dy39nhHzRpyCsJZ Ok/KHSswXt+fny/MFcLRFw6jY05NcOc8oKDWXw08yAppcLKPe290xFuH8HpebXK53EKs gdImXV6g09PDZEg5MjCIYSr2BE3FukYZcO2us/TI4dCCWZwaBaNBNdTIMLNfMpJawOkA 6Ghg== X-Gm-Message-State: AGi0PubHpC0GxzLZzsNBdGaE2Ha3/Oq7ozCBB/+PTzQcW7Rq6mqgAUg9 ArzsXzr7SMwyUetvpJBbrY0= X-Google-Smtp-Source: APiQypJ38NBctgYyPwK0lHxz55CDL9L9Qm4z5+xuG8K/h7rrUF64qLHgrKt8mPW901ViFL1i3OsRXQ== X-Received: by 2002:a63:4646:: with SMTP id v6mr34499795pgk.426.1588161753233; Wed, 29 Apr 2020 05:02:33 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id 4sm1095932pff.18.2020.04.29.05.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Apr 2020 05:02:31 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id D48B1403AB; Wed, 29 Apr 2020 12:02:30 +0000 (UTC) Date: Wed, 29 Apr 2020 12:02:30 +0000 From: Luis Chamberlain To: Christoph Hellwig Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, gregkh@linuxfoundation.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, ming.lei@redhat.com, nstange@suse.de, akpm@linux-foundation.org, mhocko@suse.com, yukuai3@huawei.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 v3 4/6] blktrace: fix debugfs use after free Message-ID: <20200429120230.GK11244@42.do-not-panic.com> References: <20200429074627.5955-1-mcgrof@kernel.org> <20200429074627.5955-5-mcgrof@kernel.org> <20200429112637.GD21892@infradead.org> <20200429114542.GJ11244@42.do-not-panic.com> <20200429115051.GA27378@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200429115051.GA27378@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Wed, Apr 29, 2020 at 04:50:51AM -0700, Christoph Hellwig wrote: > On Wed, Apr 29, 2020 at 11:45:42AM +0000, Luis Chamberlain wrote: > > On Wed, Apr 29, 2020 at 04:26:37AM -0700, Christoph Hellwig wrote: > > > I can't say I'm a fan of all these long backtraces in commit logs.. > > > > > > > +static struct dentry *blk_debugfs_dir_register(const char *name) > > > > +{ > > > > + return debugfs_create_dir(name, blk_debugfs_root); > > > > +} > > > > > > I don't think we really need this helper. > > > > We don't export blk_debugfs_root, didn't think we'd want to, and > > since only a few scew funky drivers would use the struct gendisk > > and also support BLKTRACE, I didn't think we'd want to export it > > now. > > > > A new block private symbol namespace alright? > > Err, that function is static and has two callers. Yes but that is to make it easier to look for who is creating the debugfs_dir for either the request_queue or partition. I'll export blk_debugfs_root and we'll open code all this. > > > This could be simplified down to: > > > > > > if (bdev && bdev != bdev->bd_contains) > > > return bdev->bd_part->debugfs_dir; > > > return q->debugfs_dir; > > > > > > Given that bd_part is in __blkdev_get very near bd_contains. > > > > Ah neat. > > > > > Also given that this patch completely rewrites blk_trace_debugfs_dir is > > > there any point in the previous patch? > > > > Still think it helps with making this patch easier to read, but I don't > > care, lemme know if I should just fold it. > > In fact I'm not even sure we need the helper. Modulo the comment > this just becomes a: > > if (bdev && bdev != bdev->bd_contains) > dir = bdev->bd_part->debugfs_dir; > else > dir = q->debugfs_dir; > > in do_blk_trace_setup. True, alright will remove that patch. Luis