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 52407C2BA2B for ; Thu, 16 Apr 2020 06:20:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1D8512078A for ; Thu, 16 Apr 2020 06:20:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D8512078A 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 BC7418E008B; Thu, 16 Apr 2020 02:20:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B78378E0001; Thu, 16 Apr 2020 02:20:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8DAF8E008B; Thu, 16 Apr 2020 02:20:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 8F5D08E0001 for ; Thu, 16 Apr 2020 02:20:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 46A06181AEF2A for ; Thu, 16 Apr 2020 06:20:58 +0000 (UTC) X-FDA: 76712720196.09.hair44_86d19ce9fc4a X-HE-Tag: hair44_86d19ce9fc4a X-Filterd-Recvd-Size: 4957 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Apr 2020 06:20:57 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id u9so1196112pfm.10 for ; Wed, 15 Apr 2020 23:20:57 -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=p15xYOQygHaMZBBF5Y1nnqVE33ZTctQDLOOIp9dIoLE=; b=rgoyE86KZcNcriST5/3qppDZt+g2Aqb4GPbm2SazglktrY6QDt2Z6xFp8A0OCjHOyW bVLnX3hUP3rRwjeYaocTFmTsO1vWaWVETnF+USbER3+xIk2YkrMkRaGzRU/uTzD6L4iC S7ywMkGibzJz4w48Kc8mA8lQ6omaKLxB1KqXBbn4jcMzZX8UYEHUlsPV+cMgAGqtRv90 VeLoHAnYsjf3xNSmziI9h3hGuH37g7m1O+EWaFZvKv3eMkmCkVPkOXlY+4oJuf62bbiP cBSKdTL9BWdBXvBz+/8YgYcKlkFUZ2ZWFRPAOnikW0WUtT8b9aJe2/ftleUx0nXEa42O BnRw== X-Gm-Message-State: AGi0PubEJGPiZo2mGQF37P8lE+BOOusC2aEHsFfm3WJKAjBOWlTdLK3W Q2sSphRVMj+qG68Ngck5hCM= X-Google-Smtp-Source: APiQypJdFaXOZeMn73PqeNL3aSMM9FGEv7xVBTPP0KhN6MUn3AMyk3tgHrWRUpkeOX/IOxTaJA/Zuw== X-Received: by 2002:a62:16d2:: with SMTP id 201mr29586848pfw.295.1587018056780; Wed, 15 Apr 2020 23:20:56 -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 g6sm15692090pfr.56.2020.04.15.23.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 23:20:55 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id D4F6F40277; Thu, 16 Apr 2020 06:20:54 +0000 (UTC) Date: Thu, 16 Apr 2020 06:20:54 +0000 From: Luis Chamberlain To: Ming Lei Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, gregkh@linuxfoundation.org, rostedt@goodmis.org, mingo@redhat.com, jack@suse.cz, 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 2/5] blktrace: fix debugfs use after free Message-ID: <20200416062054.GL11244@42.do-not-panic.com> References: <20200414041902.16769-1-mcgrof@kernel.org> <20200414041902.16769-3-mcgrof@kernel.org> <20200416021036.GA2717677@T590> <20200416052524.GH11244@42.do-not-panic.com> <20200416054750.GA2723777@T590> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200416054750.GA2723777@T590> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Apr 16, 2020 at 01:47:50PM +0800, Ming Lei wrote: > On Thu, Apr 16, 2020 at 05:25:24AM +0000, Luis Chamberlain wrote: > > On Thu, Apr 16, 2020 at 10:10:36AM +0800, Ming Lei wrote: > > > In theory, multiple partitions can be traced concurrently, but looks > > > it never works, so it won't cause trouble for multiple partition trace. > > > > > > One userspace visible change is that blktrace debugfs dir name is switched > > > to disk name from partition name in case of partition trace, will it > > > break some utilities? > > > > How is this possible, its not clear to me, we go from: > > > > - q->debugfs_dir = debugfs_create_dir(kobject_name(q->kobj.parent), > > - blk_debugfs_root); > > > > To this: > > > > + q->debugfs_dir = debugfs_create_dir(kobject_name(q->kobj.parent), > > + blk_debugfs_root); > > > > > > Maybe I am overlooking something. > > Your patch removes the blktrace debugfs dir: > > do_blk_trace_setup() > > - dir = debugfs_lookup(buts->name, blk_debugfs_root); > - if (!dir) > - bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); > - > > Then create blktrace attributes under the dir of q->debugfs_dir. > > However, buts->name could be one partition device name, but I can see how buts->name is set to bdevname() which expands to disk_name(bdev->bd_disk, bdev->bd_part->partno, buf). > q->debugfs_dir has to be disk name. I can't see this, can you point me to where it is clear the request_queue kobject's parent is sure to be the disk name? If it is different, the issue I don't think should be debugfs, but the bigger issue would be that blktrace on two different partitions would clash. Also, the *old* lookup intent on partitions always would fail on mq and we'd end up creating a directory. I think we'd need to create a directory per partition, even when we don't use blktrace. That makes this more complex than I'd hope for. Luis