From nobody Thu Feb 01 00:32:04 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 4TQKbm5MC9z58cqB; Thu, 1 Feb 2024 00:32:04 +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 4TQKbm4gwYz4LMx; Thu, 1 Feb 2024 00:32:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706747524; 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=KZxstPqWgDQChtawMN4zpnf5Mhh4TQrveCyctknMhzQ=; b=T4pHgp5lmeEkHcCyh7ac5KXQmbFrnM+2YBC1t7O1T94vZEzCYgzjAxrI9Jaaeqx9Q5lrqa Q7Pexbi84wzzG1rAWigCB25QfAqKE+fQImg89VzzT6S/6D98XAjmZKsIiDc/1eDY/3mS0w MGUPatLRVQPFYV/W2U+21z9by3qB4qjOQL+nUbxhFtu/ZiGqdby2oyWvnopUQf2msT4JzS Y01dWTYtD1sqGNt/OtOU6g4DsM1xgcTHIUcfm6UVuxVmkE/8NELU5AfQRLt7pfDtudHitX CD/VtcxvjM97F06YuIkOw+HlhDqPttqib9xh2sBU6rrfPzm3tJ6Xg9qi2RgiDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706747524; 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=KZxstPqWgDQChtawMN4zpnf5Mhh4TQrveCyctknMhzQ=; b=ijpMl523qv14lfrso+LRX6oAx7khqt1JYhQ5bMbVnq0a2dC9kkSPPYQ0m1+DpBlAZq7kRq 6QU8mSR6nxY8ilISscpPTteBPiend96ANgnGFvjDghIt7fweOSbdWgDsJZRvJZ8Pik2qhq Zwki8bBnGj/y+1UtOgQjfYjWMB4ixaaQLsnZlp+NxxiHJlsHINF9COQlMuwYfhSReJ8K+P PKpNOUjSNdfOLYN0xhkPEGQ1FxkH0Ot6FjVehsuS2vdINypj3DiTADnK1EyyuQE3GpUK9N 56iL3969Qf/F5iYcSXQfO4v8k14V9zjqh3Tm4isOFMem+gw1cTxI63iBB77ZcQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706747524; a=rsa-sha256; cv=none; b=S9nxeYWErmXjzdxHzELkMcfH1kTMwW00eHox6p8e1HcBIM9qgpTzzewp2U4Pg8yRGcu4my 1g8+XxNUrX0MLMqcQAPeGfCVmr/KtvGtDJdkMtkgXR/gYdQN3NIL+M+Cf0bvN0Q1HYBmty k6VSYMn/WeB+AGiCmIoiKmZg5EY+6lHraU62MAO+BiS8y7U51P8o7t1Q207hhpVG+anlXM E06YttavWzZOE0gcL2v/zKtRKb8eA65l/vZVODjrXxXQUzc4pN8lU/TgFk9ZtHvBap9p0l VbD0Lzh9EPVohWqkUCi93awmN1iv/27U4YgdU2oK3UY8D/aYiKutu3GB6mMsIw== 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 4TQKbm3MhnzgJB; Thu, 1 Feb 2024 00:32:04 +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 4110W4an068431; Thu, 1 Feb 2024 00:32:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4110W4Rk068416; Thu, 1 Feb 2024 00:32:04 GMT (envelope-from git) Date: Thu, 1 Feb 2024 00:32:04 GMT Message-Id: <202402010032.4110W4Rk068416@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: 617695812a38 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 617695812a3821ab9767df5f5c6959ad01daec8c Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=617695812a3821ab9767df5f5c6959ad01daec8c commit 617695812a3821ab9767df5f5c6959ad01daec8c Author: Konstantin Belousov AuthorDate: 2024-01-29 17:54:32 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-01 00:31:38 +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 74149ddba487..61722c7e08ea 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 @@ -651,6 +655,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 @@ -663,17 +684,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