Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp283177lqn; Fri, 12 Apr 2024 00:54:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHlmYquKHZm52W2GajUpW+HSsWs2dwo7ZnBPBApNRd0IXyjDY7JG4d94bciWut/lpScbkDm3wwQ+j/i8F3OU1vc944BoTRTeKYHaOEYA== X-Google-Smtp-Source: AGHT+IGvqgLIEye1+bnJ6NERXsap01GJFwSS4HhaY9zfbVqke+MbLtto6zv/IxyNxcrqQK4J/+i/ X-Received: by 2002:a17:90b:4ad0:b0:2a2:6d9a:7062 with SMTP id mh16-20020a17090b4ad000b002a26d9a7062mr1909933pjb.9.1712908459673; Fri, 12 Apr 2024 00:54:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712908459; cv=pass; d=google.com; s=arc-20160816; b=C4AvRS2EZZ3wg7epr2k2zSMQbjhTw67NGM8s0HMm/kq4/02rnaV5y132OT5lrO/4kG 06w7MxQqdtTegIJMp3ZuYpXLY4orRmUcDyYI2ZWQ8pza/HeJe4HHgjWVLSm+NsqJoBpO dF2dU0fQV0Jgp9PEz6m2q6NbVN2fzogOHbWqm982FWTTyHoYvIw9FpADhRZsspy7ZJA+ FW5zH9ajBm9wrolaFBqg5PEKUOl8e+L2SiPVJyFiTUZ1t6ZPokTaKLQcn8W68ZZ8Zj+r 9qRDdnVrpvU0uLsO2E8G0Z5alXLVD0Xb5K8opzlVOd/zKb0xOYNsMCSq4aMr3u/H8rpz DKMA== 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=DrYETk1fqX47qYZYNkMA+efdpFMnWqzlx5d/JzqXYOM=; fh=gP5PS6Z/8aOww6Qq3tz15UFL3g+h0vkbMungNzijpmQ=; b=o3yYsBOT9yySQRVFeNdGFQUVFuhdpztHVuv0dj4dNEvmnAaE2k48NV5+xfJYAZEej9 a57dr9jFRUg1yF/NadAIBY9S17negGu558sXngT0Q+F1DqSIEdtZ0Ev0v2JZAkMT51Wt HBwUeFfZdaJ0k+GL35tUeBczZoRhAs8TKb6AaODO4OrsZ2lSvGKY7+sLf7W4X0rFopgi cCGZCQrvXyWW/RTYw2x5aNek1ziH17+LhUOz3ubT1JLaZRyohq+MRxOLoFi+joh3PtGE ezyR6YUZHuXb5cmD4YWjnOfUQ+9HesMf1mvIllbc5txTIXDNmGN0WEtOeNDLcoWRBJby rD1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M1F2Q5jh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id on11-20020a17090b1d0b00b002a5debb6badsi3007794pjb.36.2024.04.12.00.54.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:54:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M1F2Q5jh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142173-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142173-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 64415B23A51 for ; Fri, 12 Apr 2024 07:46:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C768A4D5BF; Fri, 12 Apr 2024 07:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M1F2Q5jh" 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 F10202C683; Fri, 12 Apr 2024 07:46:00 +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=1712907961; cv=none; b=EhrMZpmSuXxHwCRNhFJch4LLMVSptILalBZATLwE7o4L7vuTrmLgxVP2XsmK2lFVqyRff6W0AXE7jxBB3yZTQNqNhAWqxbfoBYgHgiw+Q9Hpz+eL8PNw7xRIaZmeBV0ipoKY+H8kiuIpOWQ446+LioU4RGGCnvUd7ES1+uUugq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712907961; c=relaxed/simple; bh=d9Fj19nto8yMpblmpYciB+bMkDw4NUhzh99gQX4C+Es=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GP3SlRZX2vgD1TabL9AOSw1epzZFwWi8R3YdJZsSQdPl1EVLSBJWgrZaVIeRv7u1PXgvlm3h7R3Ics3PLHwyyoc4PcPqIvVYzsZgZwYLIBU0IWnZshk97s8r/ToetbPrTd2B+9tF8rj6yNSNewnoA1l+IdrYaaWWOALaK0hItI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M1F2Q5jh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21857C113CC; Fri, 12 Apr 2024 07:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712907960; bh=d9Fj19nto8yMpblmpYciB+bMkDw4NUhzh99gQX4C+Es=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M1F2Q5jhVqFqvTPQxTegfczkiEv3krTlYYVQakY7k3YeK9Rdbe9aHvwlDYzatJhSY dVwfTzwxWU28Zr5UvyjWToLz657a7bCVTL8ivdXSuq1rEhge2vc3zz6JYqR6dNjJ/q f5l3bzr2TcyderpaYu6ew6IOWfvBtsDMVg3Sn+oCeZqD+0ZRBjDActfTT9RMoYdtpA qQDc5Hrcn2mDP+kLEFguiLwIOlyfnL8LvPknMo4hoMA2vZiWwkeSQH+YooVqF/V0fW D7PIpvOuclhbFyhSp35R2lGlBkar+rYV7Rwko8IdPDyPZPJVul5HSrRH2kCqffmaA5 c0CGMh5BW5aXQ== Date: Fri, 12 Apr 2024 09:45:54 +0200 From: Christian Brauner To: Linus Torvalds Cc: Charles Mirabile , Alexander Viro , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lutomirski , Peter Anvin Subject: Re: [PATCH] vfs: relax linkat() AT_EMPTY_PATH - aka flink() - requirements Message-ID: <20240412-labeln-filmabend-42422ec453d7@brauner> References: <20240411001012.12513-1-torvalds@linux-foundation.org> <20240411-alben-kocht-219170e9dc99@brauner> 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: On Thu, Apr 11, 2024 at 12:34:52PM -0700, Linus Torvalds wrote: > On Thu, 11 Apr 2024 at 11:13, Linus Torvalds > wrote: > > > > So while I understand your motivation, I actually think it's actively > > wrong to special-case __O_TMPFILE, because it encourages a pattern > > that is bad. > > Just to clarify: I think the ns_capable() change is a good idea and > makes sense. The whole "limited to global root" makes no sense if the > file was opened within a namespace, and I think it always just came > from the better check not being obvious at the point where > AT_EMPTY_PATH was checked for. > > Similarly, while the FMODE_PATH test _looks_ very similar to an > O_TMPFILE check, I think it's fundamentally different in a conceptual > sense: not only is FMODE_PATH filesystem-agnostic, a FMODE_PATH file > is *only* useful as a pathname (ie no read/write semantics). But the annoying part imho is that we also allow stuff like fsetxattr() to work on O_PATH file descriptors. Something that I really dislike. > > And so if a FMODE_PATH file descriptor is passed in from the outside, > I feel like the "you cannot use this to create a path" is kind of a > fundamentally nonsensical rule. Hm, I would like to avoid adding an exception for O_PATH. While it is useful for lookup O_PATH is also often used simply as an opaque handle to a file. O_PATH is often used to simply identify or compare files, or for execveat(). Especially for cross-container interactions it would be nice to not generally allow O_PATH to be linkat()ed. The current behavior proposed in this patch should be enough.