Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp341272lqh; Sat, 4 May 2024 03:44:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX19IfLbnIkyuJ6JeI5Dmt0c07hDK7vWLKO7gZWXpLCEazj75/lvuLZZzZmNRcQTk/vN/TA+QxEQF/MjjRdswt26wryQW6C3Shrd2nipw== X-Google-Smtp-Source: AGHT+IEdjpz0Hfv9/tB60UWxl2NaoWvAhn0iH76B5C1C4piumv0GyZ35w7MGmL2e7o7vaWQ+OMQL X-Received: by 2002:a05:6a20:9f9a:b0:1a7:8610:bccd with SMTP id mm26-20020a056a209f9a00b001a78610bccdmr6415737pzb.57.1714819491500; Sat, 04 May 2024 03:44:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714819491; cv=pass; d=google.com; s=arc-20160816; b=EeRO4O502HSuERrrP5X25pCGclnqtX5kyEe6xiRDek8H4fJ1a5KrpeKqKOjhxeDVNY 4u47j3o7JCCu7dNrDzXDk0lrtCFCqPA0RZXtVe1sfZ+w4pjf6Zgs74iaAVKqRyMO5nHs 6pCx3mYlefy5BsE7bBp+IJmDd6Er5ejjLe4EJ8QaG3Nk/dejaDv0czfkWq8USYtZgusw szFeOCsjUvAQpS8X3S+obaOtU70Z7GeEYpsxnqdFrMWGA3y6GOiSa+6vUpyDCETHL0r2 mEuE9QxLjNSYNC8EgMSc5JU12lt7ryMybgNicrtZTHU2mWgfIFd8ADeVBwoqTR2U1JeN xbFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LnYGs5bJSg3eyr8oJBAKdyaMlTV9ouen8uCW0QvmcW0=; fh=L6d4ypdCYxZ0XpU2ESH86vM49Fh7tcAo041CaicfVDU=; b=rkP0JSRvumUE1Tv+HBEgK8dPc8gMrwlPSKebb7SEXzZaA0934kTWguadWtH7nQR7J+ WHFzHQ5vAQUlKVyWO/zBpLPaUQt3K38Pl5JG6d8zn8ShLldwYkr60NnEB/vo8OlNADA9 vuypLUTIBKtL3yJ4hmqk4i09TwZthbQMpqXSHLTU64PdAJWCxHl4v2OBg3F71V79e5DT 2Ke2x9BHTO4ESCyAlUPV1IJLuV94zhDKiGLUep7Ejq+grjV8c+BNWWDLFe2M7XozkYKU PYHKizxNvcejW1AqYQWYbfGmc34sEHmyglAZXzE3IjlmQ0B0cm0Lm9eJve1V3b2bL4oW cofw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gIVHK8rJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168592-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f13-20020a63554d000000b0061afbfee29csi4189474pgm.726.2024.05.04.03.44.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 03:44:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168592-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gIVHK8rJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168592-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168592-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 284CD2825F2 for ; Sat, 4 May 2024 10:44:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 709C71CAA6; Sat, 4 May 2024 10:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gIVHK8rJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8343F18C3D; Sat, 4 May 2024 10:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714819475; cv=none; b=f9FlggnLAClQYuUGve9GDh9aVbeFY/wd5AcE5/Kri/xHMqsQPDU5rpO4fHJk3F7Ei3cpKwl9q895vRz9ZAkOWN/5IlarNWYLJ+qGn32SSZbgUwEmCxqyppGNISmL9EXa10/tyJv+vGPf7TthJfFt0uvNnsMYO0OZ/ZAlziPt11o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714819475; c=relaxed/simple; bh=BLItYotWYbyfjyaUpV2xQFYIZr6/mKHn7Hcq1DddZd4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TemzpVE/UgkgN5DQgxQFuvb96KDELhEpvlfQdVso2SBFgj5XMQ17B+eSLWxCvl3RjepZm8TQ1/paDpdIXdeohFGFQEjeAEEk0qn+OKzDGNLYhb6r1WZF5d6iERXLreqLGcOoXLZM2WRlCCCCmKFBqnxH9xHzSJ1VatCR468qBhg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gIVHK8rJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F3E0C072AA; Sat, 4 May 2024 10:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714819475; bh=BLItYotWYbyfjyaUpV2xQFYIZr6/mKHn7Hcq1DddZd4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gIVHK8rJGTpZuS9PubMDG4bY2YumcGjk6TzRhJqqAh/plbNUsquxQFGCUWECGrJRE EzEvSIxTo4EYaTNfUE2NBTtvQOeoS6PxKjWcxkktWj4E/WHJr8O8fAnG3sfoTBN/4+ G8i9tDMgpoyUa85xPHmgl+X+CQSc0wuLRN7dziptjOtID8DTpn20rQzI5uVZV/AEjb 4Ape1g8W24bX7M1DAREc4k2jprCEjKPolqNkqjfYm83hFYMcF9DEBJfSs+DW6g3CfW 1/6/xZZebHis+jmMY6X8+A/X1qDg3q6lPjUs79o8NavTNxTFe91+9fo0VupPerS0F3 7PiA+rIodq4lg== Date: Sat, 4 May 2024 12:44:28 +0200 From: Christian Brauner To: Al Viro Cc: Linus Torvalds , keescook@chromium.org, axboe@kernel.dk, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, io-uring@vger.kernel.org, jack@suse.cz, laura@labbott.name, linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, minhquangbui99@gmail.com, sumit.semwal@linaro.org, syzbot+045b454ab35fd82a35fb@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] epoll: try to be a _bit_ better about file lifetimes Message-ID: <20240504-chatten-unbelastet-b308db41727c@brauner> References: <202405031110.6F47982593@keescook> <20240503211129.679762-2-torvalds@linux-foundation.org> <20240503212428.GY2118490@ZenIV> <20240503214531.GB2118490@ZenIV> <20240503220145.GD2118490@ZenIV> <20240503220744.GE2118490@ZenIV> <20240503233900.GG2118490@ZenIV> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240503233900.GG2118490@ZenIV> On Sat, May 04, 2024 at 12:39:00AM +0100, Al Viro wrote: > On Fri, May 03, 2024 at 04:16:15PM -0700, Linus Torvalds wrote: > > On Fri, 3 May 2024 at 15:07, Al Viro wrote: > > > > > > Suppose your program calls select() on a pipe and dmabuf, sees data to be read > > > from pipe, reads it, closes both pipe and dmabuf and exits. > > > > > > Would you expect that dmabuf file would stick around for hell knows how long > > > after that? I would certainly be very surprised by running into that... > > > > Why? > > > > That's the _point_ of refcounts. They make the thing they refcount > > stay around until it's no longer referenced. > > > > Now, I agree that dmabuf's are a bit odd in how they use a 'struct > > file' *as* their refcount, but hey, it's a specialty use. Unusual > > perhaps, but not exactly wrong. > > > > I suspect that if you saw a dmabuf just have its own 'refcount_t' and > > stay around until it was done, you wouldn't bat an eye at it, and it's > > really just the "it uses a struct file for counting" that you are > > reacting to. > > *IF* those files are on purely internal filesystem, that's probably > OK; do that with something on something mountable (char device, > sysfs file, etc.) and you have a problem with filesystem staying > busy. In this instance it is ok because dma-buf is an internal fs. I had the exact same reaction you had initially but it doesn't matter for dma-buf afaict as that thing can never be unmounted.