Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp955026ybz; Wed, 15 Apr 2020 23:22:45 -0700 (PDT) X-Google-Smtp-Source: APiQypLcTWyvzEh/rGA0hXcxpY9tQ7Fx0r5FoQ3Rj3cARA4OXwCTEKnQJBaFXajGfZpxarp5KHg/ X-Received: by 2002:a17:906:ca49:: with SMTP id jx9mr7957708ejb.246.1587018165275; Wed, 15 Apr 2020 23:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587018165; cv=none; d=google.com; s=arc-20160816; b=fAbvL8sAdD1faXQNCrWS1aTGoAYc56YZZTNeE8KxVPcgOmhnDBA/RoLp81Hy8JyOYU S9x+kLKCub5CwEyje3ahqK5Oa5N+7WHJ9cP9ENDmG0kceS4HL630rPIgA0aEVAVGDr7Z BAAh6eQQUQEQhfhhWaLm1BRR/W5nn9vJJqjX4zpPoF0Ej9OBzrx3sW8UHdt8CZvBDnUO 2fpQ9LgfV4GKq4w9L87GruxJWDr1v/e762WWuOQdy7GftlLelg5wbonnyT37V5kgn+/P SqYtEm0H/xlr+5FaraadfaYd6j6eB13apcZ7UQ+rrLTuFAZGfa8ggpgWLBnzW6wS6NPE iEwg== 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=p15xYOQygHaMZBBF5Y1nnqVE33ZTctQDLOOIp9dIoLE=; b=smq1hs+KPnz45CqZRAGDssdp6N+FfA+1CACSPzTZfEMg4CDFpBEMfKaUsirtH17IpC kqo8HOy/nLdGh0FWV1p9zzb465fKIHQgpNdpApcM+l3r2cBld1fwJ88VrBcuRGIajG2t Dier64NB1VLIbHcwHad52THSPKuRQMCEtI2FOQqX4PoTyxeY1prrjvrTvndtJtRPpOJg GhgXWhf1+4ezxDBsyWRmK1rR77Wof305MPi5mZ50dyIGkjr3rscPjTB2I8sjEU+wHEV7 EbGNkL3kyMGswRzB4Q38iG9F1XuRBI0k15WqNVtGvDbpw2797KuH+SyD2PDSWGjk+I5M UM9A== 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 y6si11372276eds.303.2020.04.15.23.22.21; Wed, 15 Apr 2020 23:22:45 -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 S2407770AbgDPGVE (ORCPT + 99 others); Thu, 16 Apr 2020 02:21:04 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39852 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2407384AbgDPGU6 (ORCPT ); Thu, 16 Apr 2020 02:20:58 -0400 Received: by mail-pg1-f195.google.com with SMTP id g32so1165396pgb.6; 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=TTox5xiBcelasnIGWX6SIMPF+9VR0ZnaiYHUaJELkhRxLPDLqYtSKxlOiKiBDIqHzo cjoFApG69Z/IMJ0cxPAytqe02eyfaI2JlsvMLDuBSXj+vJrfag9qjn/kGwvvqtBR7vPL PUY4lhDbHy1gonnlVok4ctW1n52G0rKOhfzFdMSrUM/+Uv2xRXxUz+vW8GnDVqRB+FWf YatT0xdjzURqrHrs72Rii0baZeLkls7G9cX2lEgiQGtaRZ3hac1Z/6aPptcVaINvJ4Cu FfPwNNWwL1lTy78RuZRJZXsTqOVsn+rob3butyolVRl9P+gFjqtel4xId136ddgzx/f8 Befw== X-Gm-Message-State: AGi0PuZsOj47Xje/4cnmXf+AlRlgbfRl7qu2/r1rxwg+jUTWTGZ1KLX4 OjmVt1TqYlU+YssLRL6FKd4= 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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