From nobody Thu Feb 01 00:31:02 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TQKZZ60nXz58d0V; Thu, 1 Feb 2024 00:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TQKZZ5MZYz4KdS; Thu, 1 Feb 2024 00:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706747462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0ch/uTBqvihE23FrFRvOg8Aw8wa98T56qPnr9eirgks=; b=EK1x4yx+Fj642a4JZXXXvQm4CGdcsHralOsXvnqDwTAwIiQeZttczzR6QLo6YejfjPLpmV qpiOS/dV0p/0bNDvYb3chxDyKE8ukvifnRQoAMwB6v6HjoBu0yLNxlONEPezoiGjPeQauJ l+pTqHMCQGEHLYtzYTjUdvttfXmy3jb3DLFPEiLAuz+WJ2zAlu+VsSKXjCUlW65EsModzo UHEtufC8TUyw4/1smSvXKs6rF6itJlB1uw+CuGz7+eDVVfe4MY39Y9q57zf+X08YKF/3nR xEIHaNv9e/5sYglnEGlIK87gDwPnkwYRT9fDtr+O9mFgcJGGxEf7WRRGWLiUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706747462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0ch/uTBqvihE23FrFRvOg8Aw8wa98T56qPnr9eirgks=; b=ndvXM2YIuWNFEI9IjLyeYfiQI1u1HqH0DZRBmpQpjKpTO+kE+QfilclEpbstVupz+H2zJz wcylq1CZYeIWqYbcCvyfXnkGTmW1yVvxLuANsEQxGssaY6kJCKZ6KuPUR4pyyXW0z9ljz2 2L6SFVaZDFlYd6qa5NiMl4ZT0j75zu7uclrNH7alIHtKIl4NVeLgmH0kvOB4IlYfrhU85N AS+82rXuf9kE+8mPGTFCXOh+0083UD0d9EKMCOjKnsJqkbHZ29fac+3DtIX5rc9XT01afg v+gc9NwF66U/hdjv6mED+pCuC25xOQ9jZypBy0cKEpKSdo84N7re2A4mBOnWXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706747462; a=rsa-sha256; cv=none; b=ENssuAGq6VNyq+EkEqR7+dSiwopr2LF25OEw/E94mIlfsrqtx1N+Qua+/H7VcyGyeyMNxx gzLvN+tweKb9PEKrfyhOSktoQOjk3BSDqHYFTnmHX4q2D5oSkilXwfl8zkqJKENZqqXt6J xCyGAGOxehgk4Lt0xOHzh7RGPqb+MPD5wcn+7bB2loFKigj3W4f+90GZP7yhUDqTuMGYR5 RozAD0yObMRAZH/NW4p6ilkoe0dbIPqtOEUsAI5OdWcJDajyyQrCbWHDqYiLxUVp35fFoL J44AVAt4o0mAL6NnlntTiHDbhfIpj40wPnVjFyNCV07aTIQ03Ro19amJUYaJEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TQKZZ4Rw7zgJ2; Thu, 1 Feb 2024 00:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4110V2ZV063396; Thu, 1 Feb 2024 00:31:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4110V23Y063393; Thu, 1 Feb 2024 00:31:02 GMT (envelope-from git) Date: Thu, 1 Feb 2024 00:31:02 GMT Message-Id: <202402010031.4110V23Y063393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 14b7cf92e73a - stable/14 - open(2): describe *at behavior for dirfd opened without O_SEARCH List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 14b7cf92e73ab46f6b0eb22fc40a3f4c872c3598 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=14b7cf92e73ab46f6b0eb22fc40a3f4c872c3598 commit 14b7cf92e73ab46f6b0eb22fc40a3f4c872c3598 Author: Konstantin Belousov AuthorDate: 2024-01-29 17:54:32 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-01 00:30:40 +0000 open(2): describe *at behavior for dirfd opened without O_SEARCH (cherry picked from commit a570fe4d0dd979ce099374259ffc45d56ae4e471) --- lib/libc/sys/open.2 | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index ff0441d64507..67a059db10da 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -25,9 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)open.2 8.2 (Berkeley) 11/16/93 -.\" -.Dd May 29, 2023 +.Dd January 29, 2024 .Dt OPEN 2 .Os .Sh NAME @@ -316,6 +314,12 @@ may not be used for any read operations like The primary use for this descriptor will be as the lookup descriptor for the .Fn *at family of functions. +If +.Dv O_SEARCH +was not requested at open time, then the +.Fn *at +functions use the current directory permissions for the directory referenced +by the descriptor at the time of the call. .Pp .Dv O_PATH returns a file descriptor that can be used as a directory file descriptor for @@ -658,6 +662,23 @@ when is set in flags and the final component of pathname is a symbolic link to distinguish it from the case of too many symbolic link traversals in one of its non-final components. +.Pp +The Open Group Extended API Set 2 specification, that introduced the +.Fn *at +API, required that the test for whether +.Fa fd +is searchable is based on whether +.Fa fd +is open for searching, not whether the underlying directory currently +permits searches. +The present implementation of the +.Fa openat +system call is believed to be compatible with +.St -p1003.1-2017 , +which specifies that behavior for +.Dv O_SEARCH , +in the absence of the flag the implementation checks the current +permissions of a directory. .Sh HISTORY The .Fn open @@ -670,17 +691,6 @@ function was introduced in .Dv O_DSYNC appeared in 13.0. .Sh BUGS -The Open Group Extended API Set 2 specification requires that the test -for whether -.Fa fd -is searchable is based on whether -.Fa fd -is open for searching, not whether the underlying directory currently -permits searches. -The present implementation of the -.Fa openat -checks the current permissions of directory instead. -.Pp The .Fa mode argument is variadic and may result in different calling conventions