Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp782868ybz; Fri, 1 May 2020 08:27:40 -0700 (PDT) X-Google-Smtp-Source: APiQypJ1cMe4WIhpDEc4BVWlhMPpgUyiyz7pNNH6VfjFezIxATOMezeOqrucJIj0AaaJySjKB49t X-Received: by 2002:a05:6402:391:: with SMTP id o17mr4022516edv.71.1588346860615; Fri, 01 May 2020 08:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588346860; cv=none; d=google.com; s=arc-20160816; b=VtJuN9SqgpAffY/51IKWz4w8owq9VqPdlg1Y3YE0uS8WZlhjVAAiGUZYFBehCgLnE0 0DW+jEnqXrIn+qjBVIMS513zXpu/Zlc5rNTrFZZ39NivOvrD1Hwp0SSbK0IAq3fpLIZX 1ZU6N8hpfwXerHzh36zSsUraNERTlzYd//gZpR8xSHVvJE7KUZ6d/e/swHHufIrt3JbP bH46BooKB6wIE736zODwat7rKXsqIKOX5+kf2XxJTRbPXqzbyfWBYoOlk3pRcDs74JgL 7oQ4TNcobxMdehhHflxzPuLeyvB2ZL1zWtYFUxUL5QVLRZEdcw0JLqQfib6dQ5LTcXzl qoCg== 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=X20mKpRRVq/ark63BbLpoCynpLjPmjVnD3XcfxieJmo=; b=gqDpcTObNnuiYGR3ETylq68p9d2Z6an7f72yLHn/yswavr1E2opCeVMECiAzUPKx5w A0fryVWkMOFzML4EoQwBteTPcBx/6QOe5Gg2ilReFVhTTIY3ym50d9LiM4xmeS9+Er1G 6HLKPud41WndYkXWiBnJc64b1oh1UeYf09ybnZAf5k+yX5C0K/waBQE5t8/9cT8qkr/g RiasTF3n+o4ou/NohCVhZpvR8Jujzyy1ymaIeQu4KTcPqS6UVgXuR+CSl0CKyq6S7nRW L0Oi8lzrCUTuGdwthx19O7KsBrLcQuMYuugHhG0KNCpoTxApiFYTuzaXisRejCspmSrD oGMQ== 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 t4si1941707ejr.418.2020.05.01.08.27.16; Fri, 01 May 2020 08:27:40 -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 S1729753AbgEAPYu (ORCPT + 99 others); Fri, 1 May 2020 11:24:50 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:55527 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728443AbgEAPYt (ORCPT ); Fri, 1 May 2020 11:24:49 -0400 Received: by mail-pj1-f66.google.com with SMTP id a32so18295pje.5; Fri, 01 May 2020 08:24:47 -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=X20mKpRRVq/ark63BbLpoCynpLjPmjVnD3XcfxieJmo=; b=nxLBwiUyssNTIBTkfse5CKboAwAshhtDUb2MiZ4uTej8w+2Hp7VUFZr+RiLxxUjANg 41i5Bn193Ai81hZUpbFSOIs/yWTn3f55Dd5nhrQehajf0UZBbKOQn1HPs32g87MxZ4aN aA69TRjwlhffllEZg3LToNIXn5AJEPJ7elNznjbdgCn86PXOo9GaDHPfCNMoHMb2eeaV efGcT1hMGtxFs7R9EgdgoRoqqDeal0KmSzOATx3kWGywGo0cC3SRFQlJ3KWPzFUVP6Y8 Cj3gJSvSirnh8egzSkODjBzhP/JIFamm3wTv97F0hZux/wV7bABL/OXg+RCdBRZyyFfi OZAw== X-Gm-Message-State: AGi0Pua5rXtk1NfvOsomIPaNSfCZWQWDABp2iWnK7mUSQACtNWL4++6f FhzDo4ZUL/U/xL4n0gXfUxI= X-Received: by 2002:a17:902:a513:: with SMTP id s19mr5192257plq.84.1588346687212; Fri, 01 May 2020 08:24:47 -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 a15sm11899pju.3.2020.05.01.08.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2020 08:24:45 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 5D8FD4046C; Fri, 1 May 2020 15:24:45 +0000 (UTC) Date: Fri, 1 May 2020 15:24:45 +0000 From: Luis Chamberlain To: Greg KH Cc: Christoph Hellwig , axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.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: <20200501152445.GN11244@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> <20200429120230.GK11244@42.do-not-panic.com> <20200429120406.GA913@infradead.org> <20200429122152.GL11244@42.do-not-panic.com> <20200429125726.GA2123334@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200429125726.GA2123334@kroah.com> 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 02:57:26PM +0200, Greg KH wrote: > On Wed, Apr 29, 2020 at 12:21:52PM +0000, Luis Chamberlain wrote: > > On Wed, Apr 29, 2020 at 05:04:06AM -0700, Christoph Hellwig wrote: > > > On Wed, Apr 29, 2020 at 12:02:30PM +0000, Luis Chamberlain wrote: > > > > > 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. > > > > > > No, please not. exported variables are usually a bad idea. Just > > > skip the somewhat pointless trivial static function. > > > > Alrighty. It has me thinking we might want to only export those symbols > > to a specific namespace. Thoughts, preferences? > > > > BLOCK_GENHD_PRIVATE ? > > That's a nice add-on issue after this is fixed. As Christoph and I > pointed out, you have _less_ code in the file if you remove the static > wrapper function. Do that now and then worry about symbol namespaces > please. So it turns out that in the old implementation, it was implicit that the request_queue directory was shared with the scsi drive. So, the q->debugfs_dir *will* be set, and as we have it here', we'd silently be overwriting the old q->debugfs_dir, as the queue is the same. To keep things working as it used to, with both, we just need to use a symlink here. With the old way, we'd *always* create the sg directory and re-use that, however since we can only have one blktrace per request_queue, it still had the same restriction, this was just implicit. Using a symlink will make this much more obvious and upkeep the old functionality. We'll need to only export one symbol. I'll roll this in. Luis