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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 903F2C38A29 for ; Fri, 17 Apr 2020 04:09:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E5FE221F9 for ; Fri, 17 Apr 2020 04:09:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gyt0aCIA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E5FE221F9 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 113778E0003; Fri, 17 Apr 2020 00:09:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C5F28E0001; Fri, 17 Apr 2020 00:09:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF5328E0003; Fri, 17 Apr 2020 00:09:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id D5B2E8E0001 for ; Fri, 17 Apr 2020 00:09:36 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 895D8247A for ; Fri, 17 Apr 2020 04:09:36 +0000 (UTC) X-FDA: 76716017952.26.skate15_53d0b139e3f15 X-HE-Tag: skate15_53d0b139e3f15 X-Filterd-Recvd-Size: 5146 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 17 Apr 2020 04:09:35 +0000 (UTC) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C166B2224E for ; Fri, 17 Apr 2020 04:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587096575; bh=/aAOMVOP3MZQGTBFo0xdiu+n9iKYVv70X4AkPfYDRUY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Gyt0aCIAKdLM3LASetND1QH5Wfx32kCgTTnBxG2zuGNZrZ5A+Uuyt+EWvqojWwS5D zo4tgkaCD0hTcasyZJ7j/nTI6TtMjrTbvxEv3IIfeepWgrn5l7XiWcWDXVNXOJm1L+ +zIEAsvTYvKFPhvJ4etnosn3KdqzsUfe3B4cENx8= Received: by mail-ej1-f44.google.com with SMTP id b9so554083ejb.3 for ; Thu, 16 Apr 2020 21:09:34 -0700 (PDT) X-Gm-Message-State: AGi0Pub2FTd2DNug236gdCyozgFHI6q4PQpXELCFVaPiFcofoa8nCRAN gUqeWwZa95xb6KnlQyLUjaxv99O5V4Y2QyrQtCc= X-Google-Smtp-Source: APiQypIdKCMgMXNdIoKxA+hJgxlg7THMOt/IQ9RE95/qKc1hrmrQknmbKq/g59E4lMJ6Zg4qLEjnmgHh/BtY8F2Saqg= X-Received: by 2002:a17:906:7c2:: with SMTP id m2mr1049847ejc.339.1587096573102; Thu, 16 Apr 2020 21:09:33 -0700 (PDT) MIME-Version: 1.0 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> <20200416062054.GL11244@42.do-not-panic.com> <20200416062856.GD2723777@T590> In-Reply-To: <20200416062856.GD2723777@T590> From: Luis Chamberlain Date: Thu, 16 Apr 2020 22:09:24 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/5] blktrace: fix debugfs use after free To: Ming Lei Cc: Jens Axboe , Al Viro , Bart Van Assche , Greg Kroah-Hartman , Steven Rostedt , Ingo Molnar , Jan Kara , Nicolai Stange , Andrew Morton , Michal Hocko , yu kuai , linux-block@vger.kernel.org, Linux FS Devel , linux-mm , "linux-kernel@vger.kernel.org" , Omar Sandoval , Hannes Reinecke , Michal Hocko , syzbot+603294af2d01acfdd6da@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" 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 Thu, Apr 16, 2020 at 12:29 AM Ming Lei wrote: > > On Thu, Apr 16, 2020 at 06:20:54AM +0000, Luis Chamberlain wrote: > > 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? > > blk_register_queue(): > ... > ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue"); > ... Alright, I have a fix for this now, and I do have also a further explanation as to *why* the debugfs_lookup() doesn't help us here. I'll follow up with more patches. Luis