Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1084527lqh; Sun, 5 May 2024 15:56:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXu4Jx2Ytz4hwazMq4IBm+asW5kQjgAmumGoOwU2eiy0V1l3CAxhf0FayIB8aBoPAXRxyhimEdcTi2PBoTmvDTdbMAMqxvSKcZCUyHy9w== X-Google-Smtp-Source: AGHT+IE+r9C70VO9YgdvJCqbifTGHYJ1AsFx64cK0oiCIAMsN7DY+NAU9VLbEJkAU+Hok3GGEn5x X-Received: by 2002:ad4:5cc1:0:b0:69b:6e98:2f33 with SMTP id iu1-20020ad45cc1000000b0069b6e982f33mr10503083qvb.39.1714949819300; Sun, 05 May 2024 15:56:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714949819; cv=pass; d=google.com; s=arc-20160816; b=k6/HCS4jye3PrgJGmb1ECcMhIKRVBomQyKeyQGHt7V/qWdXyU1p7DLdyJmgR+pVad2 lS9Yexak833jWvQdRObFt1FtYzVVD2J1YTK+xhvGRNoyqdwbLFKlnhSl5bQiHPwsSGNN BAcHG/0G66lsAvoE9biM45DO2Pv0iFAUnru/HVfJVmb4754meEb6cYwgX5/lYj4NUhdj 0Q6mnHqsUwyIbxfrNrVVCXuajnsBA19b0altfwmOC5F5ossBjcIMDPjiDVrvKudInLHC 64KPkiJjObjVmIU3gZQM40IrDXBxbrDMdHDDYMLfC0cnMDguPoFAGuWp95EZqb8GvZph 5n+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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=5RAK72tlhDi40d79TYqG9Ma0z3H3FbbwyjJuCY2Mj0g=; fh=Wv6X2ItDhZuZvDU4Dzdd1S8Lg/GSHnsUlYSrAIJm2LU=; b=x58BEK2onOWKMbF/Q/4Bd+j7g1ileWXAoJtKGeIOc4x7cbSIzdHsI5emk9iyW0N0V9 9KhxfBJ09T7hozQafnqEWiHGzePdT7EK921Qj4ReTRK31RXLS4rh81cAKKYbZIxy1NTt OEFH7FHqvPQtVAVjy6rurBsOlCiQFoqTxURksZL+3StPPaxA0Kh6MslMSWuKeHyZuk9l BSw7gjoo2a9qAgZSgCiugig0fTM8ZrWKhBKnZiRXq0UVeiryGyCsEhfCubwvh6wpFZIS 2WKvYHw9cH1unHBr6cETVSX1MARfTTSpcxb3whtk6U5CJz57n77bTOQ2NxvD7bxxVK/d 8meA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=UfQ6ajUK; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-169142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fv12-20020a056214240c00b0069b5a4a26cfsi8565312qvb.546.2024.05.05.15.56.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 15:56:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=UfQ6ajUK; arc=pass (i=1 dkim=pass dkdomain=linux.org.uk dmarc=pass fromdomain=zeniv.linux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-169142-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CD12D1C216B2 for ; Sun, 5 May 2024 20:31:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E7B97602A; Sun, 5 May 2024 20:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="UfQ6ajUK" Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 678421DA22; Sun, 5 May 2024 20:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714941065; cv=none; b=NKyRKWXj+eYTNhy7E4LZF2DcC0H3qCUId+UmsImsGpmlMq1xXqgJMdoVKANuvh7bPnJusLykW8n/AkONyeXpMsUqbMg/uv9+3ZWNfqV4cqskaB4Pm2awVoBNqdU6ULh3MQKF1D6o1rkVNPqp61OR3NRwRVazZLxywfhe4NklxvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714941065; c=relaxed/simple; bh=LsVx8cpGZ4aiXnbcdtdFjsafF8HGe3xu/guXdG44lpM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dgrjE5LrKV7N+P4aq1Rnk3u1jyuG7rb/CH78HxEd3CYurbX/dndbZ9jIUxYVIQhSPX9pC6SWqa9o0A8GXcBwVOm2u91MTyMugxg/QHMT9hd6MmRkzl7e9srbyZZfJk3eBjJhRTyu3JtEtWEysFM/EuBok9n9hlfrDnDbLXBofYA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=UfQ6ajUK; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=5RAK72tlhDi40d79TYqG9Ma0z3H3FbbwyjJuCY2Mj0g=; b=UfQ6ajUKgstMS3HVj5tD2ob8VO stYeg0HZNzZNfx4cYhUE7d0Scc8SqF1+moMBwFzuODitNrdwZpJZb47uoa530T3RPHmHdvRpbYjhS Cv7MyQR3qW2lypos8PGtwndBWDLmiJsJnqaFLoWAH0NktoT3B1tkWoiWn2nVS28gzbs+fAo2qQTbw 2FOep8GKGHO+SqNuP6P0z0T/KamtEJ27/kG6GtUBxlK0dlEffF4UPW7O+asyiwGvX7QqdyZ7UTYcH SK7bGmTeXoKeboHRTY5oplOGNkIIVSKCO7E2OSC1q5IwTKsim1m6ccbHnBYUgzQCfmpZc8gmFO9j6 7vuGcYvA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s3iVY-00DHdX-14; Sun, 05 May 2024 20:30:52 +0000 Date: Sun, 5 May 2024 21:30:52 +0100 From: Al Viro To: Linus Torvalds Cc: Christian Brauner , 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: <20240505203052.GJ2118490@ZenIV> References: <202405031110.6F47982593@keescook> <20240503211129.679762-2-torvalds@linux-foundation.org> <20240503212428.GY2118490@ZenIV> <20240504-wohngebiet-restwert-6c3c94fddbdd@brauner> <20240505194603.GH2118490@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=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro On Sun, May 05, 2024 at 01:03:07PM -0700, Linus Torvalds wrote: > On Sun, 5 May 2024 at 12:46, Al Viro wrote: > > > > I've no problem with having epoll grab a reference, but if we make that > > a universal requirement ->poll() instances can rely upon, > > Al, we're note "making that a requirement". > > It always has been. Argh. We keep talking past each other. 0. special-cased ->f_count rule for ->poll() is a wart and it's better to get rid of it. 1. fs/eventpoll.c is a steaming pile of shit and I'd be glad to see git rm taken to it. Short of that, by all means, let's grab reference in there around the call of vfs_poll() (see (0)). 2. having ->poll() instances grab extra references to file passed to them is not something that should be encouraged; there's a plenty of potential problems, and "caller has it pinned, so we are fine with grabbing extra refs" is nowhere near enough to eliminate those. 3. dma-buf uses of get_file() are probably safe (epoll shite aside), but they do look fishy. That has nothing to do with epoll.