Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp757055ybz; Wed, 15 Apr 2020 18:17:05 -0700 (PDT) X-Google-Smtp-Source: APiQypIltQPPeu2T1a6oFOLettAdcPXi0XBrOxRdI1SpnzPzRyvlZ1voJwFDXDK4SXn44wyFNlSh X-Received: by 2002:a05:6402:1655:: with SMTP id s21mr27318004edx.295.1586999825044; Wed, 15 Apr 2020 18:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586999825; cv=none; d=google.com; s=arc-20160816; b=UXZUcpJFKYunJO5K4hXKfbY/cjzm207/x/o/Nlw3Zj+xNkjri8bz8VaQhC6X5x7TlT AvJrzXxBkhSw1GzhaByZXMlIhGfbpyPQvJ4XzKbnehNRAJ3J/S461cVnxCxmdo2lD63A BCInvl6qq7dfhU8EEfAclWL03KicthOWWsFtjblJpRXN4e/DgtE7BXt8MyWnvKlI80za JMbj0EiQ0A2/m0VVVWxWlLkqotP5ukGFqgQiLhnPhsOsTMrVGLaJkKLSLfO2hGZe9DfD RhHomqVPN371AnbaA7ViJLd1hEwcPHv27w3XCJgMHX/Y49frOH08YwFoaUkWzOZ06Bl0 VFtA== 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=eO9sNPLfM7z72dEgAo+/qu9o3q8PbtexT1d+8SrfwsA=; b=kTQP2UJMOhzBAjjY+NWxxnR38BsporL4pthwNfjODxHwIhN5NQZrY8JfLaRqQoov0k cgXmLDu4oyuEYq2OtUickTR5RwRAc6hMCbTXo8d4A0+4Fu1O3mWWypnnGHnFWeUmYXRB J2Q3LbgXS1FzcKv3pptSPJmfiwtOPSFMGtj298Xw2JlN6eE1J5NCiFmKd5TMSIIM7/dp saa3t8ZQGSKe5QhxGI9mfKpGV1A2Ux9kJlUbny8JmiWDBPmB80G+C8Msg6yBKMzTYHOM Km6ymwJsr8XxasXXdRP8mju5MXJEAD8wF2MQEBjRKXZ6jnZgjuKw0M2E6IQJDiir7OB/ c2gw== 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 r9si1727206edm.179.2020.04.15.18.16.42; Wed, 15 Apr 2020 18:17:05 -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 S2391755AbgDPA5D (ORCPT + 99 others); Wed, 15 Apr 2020 20:57:03 -0400 Received: from mail-pj1-f68.google.com ([209.85.216.68]:35020 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730956AbgDPA4j (ORCPT ); Wed, 15 Apr 2020 20:56:39 -0400 Received: by mail-pj1-f68.google.com with SMTP id mn19so633005pjb.0; Wed, 15 Apr 2020 17:56:39 -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=eO9sNPLfM7z72dEgAo+/qu9o3q8PbtexT1d+8SrfwsA=; b=JGh+lJxesRqdgeJtFbGZGz14pDNgxiidkKGncb3l9ppgkSKTBj3Fu2FdnBsHIM3a/I buzrXL/LyEC5BTpTB2rvsnyxBmmbJ64ngdj7Z5logaFtTa7FRRfhXlgVFpIoT3h7PrMa pdPfaNe0s/bC8cr77YKDsFnKYOrZajbtS0OqPpIV0In0wxzct4OoGGZr2t8n5zlP9AGm wMSYVacKJIfzSBEdOFvphsqxzX6Z845TWt743HAwT6aRdnSEyR5opplk4ASbIbLsbNW0 H3VNdhUSk06VejV+fEO3QWGZfGlng+/zB5sRF5PjOYFed8RkIyt6y9FWHLkS1Xk7BpJh /x3g== X-Gm-Message-State: AGi0PubcF15xm3TaWnXt5HJ6WDWhIjr+kQeGW7Vrvgog+TIisRv1aY0i RM32Hc2sCFPNUhx8SDRSA6Q= X-Received: by 2002:a17:90a:276a:: with SMTP id o97mr2095369pje.194.1586998598514; Wed, 15 Apr 2020 17:56:38 -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 p11sm12753364pff.173.2020.04.15.17.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 17:56:37 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 7781640277; Thu, 16 Apr 2020 00:56:36 +0000 (UTC) Date: Thu, 16 Apr 2020 00:56:36 +0000 From: Luis Chamberlain To: Eric Sandeen Cc: axboe@kernel.dk, viro@zeniv.linux.org.uk, bvanassche@acm.org, gregkh@linuxfoundation.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 2/5] blktrace: fix debugfs use after free Message-ID: <20200416005636.GA11244@42.do-not-panic.com> References: <20200414041902.16769-1-mcgrof@kernel.org> <20200414041902.16769-3-mcgrof@kernel.org> <55401e02-f61c-25eb-271c-3ec7baf35e28@sandeen.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55401e02-f61c-25eb-271c-3ec7baf35e28@sandeen.net> 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 15, 2020 at 12:38:26PM -0500, Eric Sandeen wrote: > On 4/13/20 11:18 PM, Luis Chamberlain wrote: > > On commit 6ac93117ab00 ("blktrace: use existing disk debugfs directory") > > merged on v4.12 Omar fixed the original blktrace code for request-based > > drivers (multiqueue). This however left in place a possible crash, if you > > happen to abuse blktrace in a way it was not intended. > > > > Namely, if you loop adding a device, setup the blktrace with BLKTRACESETUP, > > forget to BLKTRACETEARDOWN, and then just remove the device you end up > > with a panic: > > I think this patch makes this all cleaner anyway, but - without the apparent > loop bug mentioned by Bart which allows removal of the loop device while blktrace > is active (if I read that right), can this still happen? I have not tested that, but some modifications of the break-blktrace program could enable us to test that, however I don't think the race would be possible after patch 3/5 "blktrace: refcount the request_queue during ioctl" is merged, as removal then a pending blktrace would refcount the request_queue and the removal would have to wait until the refcount is decremeneted, until after the blktrace ioctl. Luis