Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp164947lqh; Fri, 3 May 2024 17:58:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5VaFoFvuFh0e9hhCgxMv+Lic7dXUhpet45t7VvSTkHnqGP1GmIMq9FdVH2eHDBTsyUYh5iTZaCSeS/B8ayNSoWi2I+bHwGIoCJvTdlw== X-Google-Smtp-Source: AGHT+IGwuwLv9Ru4THT9eT3n4NaILWUTJVwmVIlfWWKyEbm/5ydqWfGVhh81v2xU4J9Dy0jRHZul X-Received: by 2002:a05:6808:6348:b0:3c8:63d6:293a with SMTP id eb8-20020a056808634800b003c863d6293amr4015809oib.26.1714784307492; Fri, 03 May 2024 17:58:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714784307; cv=pass; d=google.com; s=arc-20160816; b=0wdfc8KdSGzyDvawsjoWSe8j9/G2/gyMd38b3acZyRvlbIb0zj/lrvGSVnh0LLeHuD VX/6iQn0V49DJ4ozlQUUAmhb2TEYxvJAaZP4nL+YFHfik0KaQVCCTGV3wpYC/0Qv4dIa HTKW94NgjcqN9PjbZ3GHdJxsi1v6kqWjTISlsumrHkk+pH+K8plIJXCqkPDJ9EEON2cy pe6gplLLQZxqV7iUUTz9dJ/tyQwwKK9uFa/a6i7uoTGBP3deyYvi1//l6lgvfIHx41QL usOd8m8HGDZJr6c4aG2SLi/qoWjSS0/gmTNBuCLPCSQB+0X6wgzPeMELHxvNSqIoGmNb u+iw== 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=RM0gQuvw5vrpD7I8AUwAP4n456JHvifrZgveaZJKmdE=; fh=hxePG1BGijs/rXVBKGOmkW+HOGB71tpUTq213gajtcU=; b=podb469u+/Pqu+LiU9pSU+z4j5zoVVtVNXSkPRhlAOLOKwuDoR9geSXDMBcNcdMU9u Qponl1E5SCt/aqlFTEFxor+MRf4K/u/iZTl8i5uYzKeISaKDR0r5ONJAgyXX/xmjcHqb pmMTwbkPRAk3irlBYUjnGm03Uv/vLB9ftNd2r18K+Cx3EzNJ5Ms8YR0uE2bPnmwKvwbc QWaq6bj3HIgdB/gCeylZTBdUy0Mhm+IlfRyDaPZomq+jIcuGgAlho/xz8lalT5qILzmE Chxb2IYr7gdmSFVRZeezxR9MH4DMOvbicoMXoTGW50OTUqV4ITZpWBFzdq3TRLlBQIPx LfgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=uPPrhUlI; 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-168323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168323-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 sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y27-20020a056a00181b00b006f45c6196d6si207791pfa.181.2024.05.03.17.58.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 17:58:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=uPPrhUlI; 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-168323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168323-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5B1C0283247 for ; Fri, 3 May 2024 21:53:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6323774420; Fri, 3 May 2024 21:53:11 +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="uPPrhUlI" 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 D44AB38DDD; Fri, 3 May 2024 21:53:08 +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=1714773190; cv=none; b=TQpakMVC6d4j/V/LPw1MmoM2KdL68pxrhOZI8smIwX84ossTyYExGI0NJ8qjVDps5IfWXVuO0o+8p/arXjsfwXJS8VIxe/sjcQlfuPfKaz0TZvgM4BppE1F8/urab75OoIrsda0MqDTnNaHQmHtbtFNY8nnDWSFSEdSD6Pk9ibo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714773190; c=relaxed/simple; bh=bExJpdyXIdMIq8/+qTePccS+7WON3s7AOlpfVjopwp0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RrWZA2BdPJbt7ImYcqGUdbfqtfE1jT0jnBr1yDqsiB9reCNvlRnnC2HwKSHF0YxTWvOr20u8PFFRAlpfQRKO/yxr1OWve71XcSZVW1r1bAxtm9rXEZCs5UrWhbBJngmvLQ51Nu2NFNlnFf3yN6SDi43YeEgDLO7sd5m2V2vuPJ4= 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=uPPrhUlI; 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=RM0gQuvw5vrpD7I8AUwAP4n456JHvifrZgveaZJKmdE=; b=uPPrhUlILbBbJfo6/OhWVeAbu8 vvKn1CG9kgelugjtObY1dI4pNbQXkZIW6pXr2dc0D6qKypOtbaQBml/wdQDHlIMzvfUJmoVwYGsJn fA4PaeOD3BaZTDGM8djdR0WoP8j8VEVDIDkDDcul8gNfa9TPQLlGSTmYPCfcwv2C87YIgZA0ttd+k tSChqsyTaVKQu+LGbkHrPMYX+EIi3msdOV9A/Hdh5A1JnJUuZmQln8p/PoX4NkCiWVsNMbqpyA56c g4JUV2/tw5QhQBueA3SbOHD/TX9duqmuzKywCDUhAdOVdAfgznrbJmMOmACfYGqm098yFnGkundvY KnSQcN+Q==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1s30pz-00B9qR-1v; Fri, 03 May 2024 21:53:03 +0000 Date: Fri, 3 May 2024 22:53:03 +0100 From: Al Viro To: Linus Torvalds Cc: Kees Cook , Jens Axboe , Bui Quang Minh , Christian Brauner , syzbot , io-uring@vger.kernel.org, jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Sumit Semwal , Christian =?iso-8859-1?Q?K=F6nig?= , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Laura Abbott Subject: Re: get_file() unsafe under epoll (was Re: [syzbot] [fs?] [io-uring?] general protection fault in __ep_remove) Message-ID: <20240503215303.GC2118490@ZenIV> References: <7c41cf3c-2a71-4dbb-8f34-0337890906fc@gmail.com> <202405031110.6F47982593@keescook> <64b51cc5-9f5b-4160-83f2-6d62175418a2@kernel.dk> <202405031207.9D62DA4973@keescook> <202405031237.B6B8379@keescook> <202405031325.B8979870B@keescook> <20240503211109.GX2118490@ZenIV> <20240503213625.GA2118490@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 Fri, May 03, 2024 at 02:42:22PM -0700, Linus Torvalds wrote: > On Fri, 3 May 2024 at 14:36, Al Viro wrote: > > > > ... the last part is no-go - poll_wait() must be able to grab a reference > > (well, the callback in it must) > > Yeah. I really think that *poll* itself is doing everything right. It > knows that it's called with a file pointer with a reference, and it > adds its own references as needed. Not really. Note that select's __pollwait() does *NOT* leave a reference at the mercy of driver - it's stuck into poll_table_entry->filp and the poll_freewait() knows how to take those out. dmabuf does something very different - it grabs the damn thing into its private data structures and for all we know it could keep it for a few hours, until some even materializes.