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 28AA1C4724C for ; Fri, 1 May 2020 15:24:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C268820708 for ; Fri, 1 May 2020 15:24:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C268820708 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 138638E0005; Fri, 1 May 2020 11:24:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C13B8E0001; Fri, 1 May 2020 11:24:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECB168E0005; Fri, 1 May 2020 11:24:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D1C508E0001 for ; Fri, 1 May 2020 11:24:48 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 99F09824805A for ; Fri, 1 May 2020 15:24:48 +0000 (UTC) X-FDA: 76768522656.05.chalk18_6428bdb16735f X-HE-Tag: chalk18_6428bdb16735f X-Filterd-Recvd-Size: 4992 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 15:24:48 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id t16so3748173plo.7 for ; Fri, 01 May 2020 08:24:48 -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=i8/PvJl9garbPtClKGZpVnmmN6aGl8xt+KKayonlDCrKR7G+2KWYl0AzyPYCNgoSWE g1hzl1CGToE2+kzxBHvIWapO0YvucvFYPB5Ueoir2rrtoBXocyipJN4woR03P3eEgWjF p2DntYKw64tYb9WwxCCp1hcE+F7dnmWRx4lqAkSGQQgMgGqrI6+Hm1eqmaBE038f8GVa dSnC2sp8tcVK9hVZJ6oSYL9HCmjNAyR9BDUA1KUnyd8PEgHkqMDebgB2jWVKwDR8ssWh AcDp25odSuiqFjfCf3jjmLTzuyozrHD2bHHCSTTKkuqSbGUYW1pkXVMEP8e3tzelgJ7d 9YVQ== X-Gm-Message-State: AGi0PubEy1sYL0xCeXk6pmX10PevFaMJHmItKCFMunaaA9iNSHAXePM5 J4J7GvTUP574mqiNDX1U8B4= X-Google-Smtp-Source: APiQypIS4cJmDrisB6sfUSd9KAjmqSPPBVrVSde1HXQ1i+jak+p623AzeudhI/4PsYT0cfEmmyEQeA== 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) 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 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