From nobody Mon Jan 29 21:40:10 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 4TP1tM2lS4z59Sm8; Mon, 29 Jan 2024 21:40:11 +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 4TP1tM0qVWz4WMk; Mon, 29 Jan 2024 21:40:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706564411; 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=2qe/eHzfjAD1GWKw7TWOaL/mQSAOO6QZzZjPGxXljq0=; b=cjoZVwv4ZmfqziGtv1fpur9+eMUPbEs6KViqZXOapoDiL+nhQZ+EClXr5FKpm+Ir5y0AE3 Da0OLPrt2yHrO/MYll5rXBd3QiRrvri/q2MpoEYQa+RI7lee10V+jD8tfKLtn75NRCkqHk jnEwSeb7+0v+TcLR7mp8y0EfnRs6DjqD+JqVH7gKL0hL0tU/dKhmBmfkfKPKktJkVsvbdR FeiuP9o2ncVL2P95kPICmvNR54zfHGS9L2uIm2cdXWC++v13CMo9GBAANQQaIJwxnq4diB SymoBB9XopGQaJTNTOriVM8FQ7i60yE7JeS+EX2Xxw232+miAvZsozNyMbZ9lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706564411; 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=2qe/eHzfjAD1GWKw7TWOaL/mQSAOO6QZzZjPGxXljq0=; b=hALeZKAbMJly7bAN2gj6alvSehG+97s32o15Z+QySjJHesRV66lPK3CObe/BKIEmlhkNB4 s43YlxKRCQ4jlUnKovLhSo/ALWa/BhKIATFt3iSnYjxN1IkZEC0kdB6+b5NQnKSzm7TRv4 96/xfZRWtEgS6VFqYFcpGoqGogJQ2q1inwWeHh+PCKt2mTwG5HBW5dWasu3LY1QhZD/iqb hPnjKGbcHLi/4aGOrnmtY7EWnWpcJo/jqWK9zSgBS0ea6TWmDbjTGf70tQEt+mO4Sb2vor H7ELqT5knFTIdR6nzY21mR8OzPfqAxY1AsRh6Ku9EdQbdQ+/nqGpsMr3cFknQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706564411; a=rsa-sha256; cv=none; b=NUa0De6ESjXfREBw5/EkP7ZYbACHasVze2YskhvmEG+32C5n5j5KZ/u7vdyFuUpoCSLZao E+RG6xSoJZ7QwXu8NBp6jVVgOadVzEoj8sGafdYEm/4/Y4mZSsQO/QADzma4KiJgSWkW7R 76wBdxsfN2kFJBfxYvmCbSQwtXR4ptd3XcmC1JaOul2gK2UgyPvnvbwZZpg1cXNYyAkylo 0yVxJ/w5fup1pemJNDEHksXqAjW3HtySC9H+/klmzpKgvj3oMny6Sc9Zo10+lyj06KB1kV QYVaQQSbmHK0TBZt+LiQgDe+MK/EYIZDPAgs5D6VaxYBXrzp1p5IqyvdJ5UKcA== 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 4TP1tL6hF2z16wg; Mon, 29 Jan 2024 21:40:10 +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 40TLeAxU016528; Mon, 29 Jan 2024 21:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40TLeAA7016517; Mon, 29 Jan 2024 21:40:10 GMT (envelope-from git) Date: Mon, 29 Jan 2024 21:40:10 GMT Message-Id: <202401292140.40TLeAA7016517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a570fe4d0dd9 - main - 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/main X-Git-Reftype: branch X-Git-Commit: a570fe4d0dd979ce099374259ffc45d56ae4e471 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a570fe4d0dd979ce099374259ffc45d56ae4e471 commit a570fe4d0dd979ce099374259ffc45d56ae4e471 Author: Konstantin Belousov AuthorDate: 2024-01-29 17:54:32 +0000 Commit: Konstantin Belousov CommitDate: 2024-01-29 21:38:48 +0000 open(2): describe *at behavior for dirfd opened without O_SEARCH and move the BUGS paragraph about dirfd permissions into STANDARDS section, noting that we provide POSIX-mandated implementation. Reviewed by: emaste, kevans Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D43652 --- lib/libc/sys/open.2 | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index a6859a6c4931..383dd58b2a31 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 29, 2023 +.Dd January 29, 2024 .Dt OPEN 2 .Os .Sh NAME @@ -314,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 @@ -661,6 +667,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 @@ -673,17 +696,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