Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp542195ybz; Wed, 29 Apr 2020 05:05:12 -0700 (PDT) X-Google-Smtp-Source: APiQypL7Evkqf5H+zUx89t2uM/kp8N4yHktzVhd3DQf1mL4YDXFLPrG6h1NVof/txFva4P9gLOt4 X-Received: by 2002:a05:6402:1c07:: with SMTP id ck7mr2152976edb.202.1588161911751; Wed, 29 Apr 2020 05:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588161911; cv=none; d=google.com; s=arc-20160816; b=pEr+2/6AQ6WpxIUk9qAZ4O1KySGFcMXOv/nj+TEmygTkpax8DBc+xc4QNjm/F9Ojl/ ps53yUJKqKNpIAi5ZKUOOUMgBh38YbacaLJi1DRCshOZf3S0t7Tl3cApim5IxonEty4U Wj6xkkhkGW+jjts60F/66Uiyd2MGjr+m2atOrosn/pEDWQO1Bzj+QkcznAspr6hb/yYy XButSQjjQ8fHYbLH9fLDepMcbeDNtwWmWREIlVM7e7XoszAWSNvsXuvDP84+x0gcwHSC uHzUHHKw0oVBoakUvz+PHaX4NtVlJNWBL4eztOu8/vyOVjythabqcojXGlafcP4d0aob Znfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=T/5a3HTQNKy4AqGfHf3RhknW3g8HjozXrYnmRz796hw=; b=vX2NeJiuUlSZ7qaKlPzrMbOzsuWlAP45c8IC+oqpLOZ6cYbf84MY7ig8AuRd1y2pR9 z9wZk5Bgm6SlBxJ2wztLL6AJlCQePU0bRZHwLzDGkP7A9bjqDd7UWMKdtwgJyRc6eKF+ +v0CcfBYkryvRgNoDvZgkr+6r0jmRC+Q3flnUZF5UaFEokZfX+Fd99fbW69KD1mPow5C QPMQBy3bIPIwetZMHrqHK5f2cwuuS4XLrAFznrOBsWtqRjo2Fdz52kx0Wtt4HCpBt32l I5SB5aJLKt/9TU6ln7QUlKAg6hduoofu7r/UdDCqWlE3iA75bbD4gemfdNeqOWTqcv/U 5Lhg== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si3455496eds.115.2020.04.29.05.04.45; Wed, 29 Apr 2020 05:05:11 -0700 (PDT) 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726871AbgD2MCe (ORCPT + 99 others); Wed, 29 Apr 2020 08:02:34 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46661 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbgD2MCe (ORCPT ); Wed, 29 Apr 2020 08:02:34 -0400 Received: by mail-pg1-f193.google.com with SMTP id q124so910136pgq.13; Wed, 29 Apr 2020 05:02:33 -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=tkXPzRXFmzRVn8cTlJVqIA6mPwSvX/ZA5RCU1PsM/IDoz1iWWuiCSEVhd3YiOqje6M LaDn1larJKJCaGtdWUBSQwm2CciGpptJcstiItqk1Q2h5jlNiM84QL+L44w1boDr7OKu Bt6Som4rivqfNfdCIZxWqdvIDVhNUidgD7+URxN8ckJANnnHMx7FvJDAITOw9FfSwnFE zStKfir0lTekwX8G3x/ufVgxMMM4yMlCAwX1n3A/WVl6TZ2DE6fQG2v8Cw+JqPXvQGh8 rTyDiYcTQvmwjrISak81roDmoDJ7aI8JvwYWamKFIDStyE4bNAUIWN8nFC6KmHkdneK4 l4CA== X-Gm-Message-State: AGi0PuatFt1McH5yjZiIgznMFAUWSUC+cYsbM6fCwGDGZAix+lMzdVbA skyIg1zVbuLg3295CXDyjDc= 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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