From nobody Wed Feb 18 08:04:34 2026 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 4fG8Df5JwJz6QTwN for ; Wed, 18 Feb 2026 08:04:34 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fG8Df3bjSz45Jh for ; Wed, 18 Feb 2026 08:04:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771401874; 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=qKyDSUL1amNwxlBr23pQPkafbtd3ICwJA927eXJeYCw=; b=kOFSA7CHqV2coHZ4Z9dc4dCNl2bI18Ww9lam0Q65n9YmJMCaxi8N3ACI1h/tmmTG+TPzrc GOIUKhV05W39jbC1BSHp3XIYnvhHYg3fZR++v7DbR8YwRcPC9ii98DJnI/olvAe3xerMFx /h8Am3RTo/SWkicM+DGUAc/+yu0Xq0yq79ri0ivvSDNjqyxReD+6jO/BxukubMR4e7g78v WD+xXz1b2Et0VpEHuU2i1WwRch/aE0AFtSrzcSs3dPhEqXrgtZGAI4wX+ibdpQ3kr4uoCr 7jyJYbKPb8UwQd/lRFIHLOUkBkSoIx7VlDuUvJAlipM2G0mV5F87fQvNLKQTVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771401874; a=rsa-sha256; cv=none; b=bAEA1Utt28bOLJmwGck2ZdE0JG02hZUBtAtVZmWUQyo+aCi7vDWnIM1/mPziGI/CJeUBQe sd/1/zosonXP0c58JzGoSzacNu4YT1j+rb8AVcVY+znruw7ySRE3OHuyHTkxd5WJLkqbyc v9T1n80cPeB5Cc/aY7bHqipvcUWbirUZCW4K0VDxxLKC+IqMX5IWHAgGEeDcYqYJpk1Ley nx1JV33vJRWWK5VNkJW2bz9W7WRrE7L9Mf5oZfYx7b9L88+imKpSmEOcCfzx4GmrWlpoVY WqwkOT2sjj/WZglvQd+NUkSkTTzlqsESSnxcUWR189fEZqeNgkwbG6Yk8eQJQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771401874; 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=qKyDSUL1amNwxlBr23pQPkafbtd3ICwJA927eXJeYCw=; b=yFPbusdoe06f24fzglBG49dTvotamjTrYl9xyVArYg7Z/OicagqHmYHPzx8RAkCXUsf19u IFBeoHvUz7qYv1DN3OpSNlU4U2wXRfrztquKE3GjUzvhKMYjAy5shM/McPY82JC/r+rp/T 6B0h+txYofc2jSzjiVR2JV6Ye5OtMxjYuTBWvImRB3ZqIcXJoi9h/QmCiUJuGFqhnObwt2 B/1ZbVJxobv3EwkTszIq2Q3Ft8DwL9mVWRqfeUQPv4ahkwu5nNYlq0lNVR7EllqFQSOslF K9VUImZpcLNMmYSgISQKwKpsj/IwaNLhtgbZpm55di8GJqWU94c1m8rwBakbgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fG8Df2cnfznr6 for ; Wed, 18 Feb 2026 08:04:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 43fe3 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Feb 2026 08:04:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4338c437910b - stable/15 - open.2: stop making impression that fd must be directory 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/15 X-Git-Reftype: branch X-Git-Commit: 4338c437910bfd3ab262e4f4f544590f968b8d30 Auto-Submitted: auto-generated Date: Wed, 18 Feb 2026 08:04:34 +0000 Message-Id: <69957292.43fe3.2fc76e8e@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4338c437910bfd3ab262e4f4f544590f968b8d30 commit 4338c437910bfd3ab262e4f4f544590f968b8d30 Author: Konstantin Belousov AuthorDate: 2026-02-16 07:28:22 +0000 Commit: Konstantin Belousov CommitDate: 2026-02-18 08:00:04 +0000 open.2: stop making impression that fd must be directory (cherry picked from commit 5bcccc702b29a0e173a5916b001771dd7b280c7c) --- lib/libsys/open.2 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index a0e905a8f375..b4463180e4bc 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -72,11 +72,18 @@ function is equivalent to the .Fn open function except in the case where the .Fa path -specifies a relative path. +specifies a relative path or the +.Va O_EMPTY_PATH +flag is specified. For .Fn openat and relative .Fa path , +when +.Fa fd +references directory and without the +.Va O_EMPTY_PATH +flag, the file to be opened is determined relative to the directory associated with the file descriptor .Fa fd @@ -104,6 +111,14 @@ it ignores the .Fa fd argument. .Pp +When +.Fn openat +is called with the +.Fa fd +argument that does not reference a directory, the call fails unless +.Va O_EMPTY_PATH +flag is specified, see below. +.Pp In .Xr capsicum 4 capability mode, @@ -421,9 +436,11 @@ 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 +returns a file descriptor that can be used as the first argument for .Fn openat -and other system calls taking a file descriptor argument, like +and other filesystem-related system calls collectively named +.Fn *at +taking a file descriptor argument, like .Xr fstatat 2 and others. The other functionality of the returned file descriptor is limited to