From nobody Tue May 02 19:26:49 2023 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 4Q9qp450QKz49KRj; Tue, 2 May 2023 19:26:52 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [195.93.173.158]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4Q9qp40vFyz45xs; Tue, 2 May 2023 19:26:51 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Authentication-Results: mx1.freebsd.org; none Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.17.1/8.16.1) with ESMTP id 342JQn8N013027; Tue, 2 May 2023 22:26:49 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.17.1/8.16.1/Submit) id 342JQnaw013026; Tue, 2 May 2023 22:26:49 +0300 (MSK) (envelope-from dchagin) Date: Tue, 2 May 2023 22:26:49 +0300 From: Dmitry Chagin To: Mark Johnston Cc: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: a1d71cebc05c - main - fstatat(2): restore AT_EMPTY_PATH handling Message-ID: References: <202305021512.342FCpbN056202@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4Q9qp40vFyz45xs X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:61400, ipnet:195.93.173.0/24, country:RU] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Tue, May 02, 2023 at 03:04:37PM -0400, Mark Johnston wrote: > On Tue, May 02, 2023 at 08:00:01PM +0300, Dmitry Chagin wrote: > > On Tue, May 02, 2023 at 03:12:51PM +0000, Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=a1d71cebc05ccfeedf95f2db3e94b17270167888 > > > > > > commit a1d71cebc05ccfeedf95f2db3e94b17270167888 > > > Author: Konstantin Belousov > > > AuthorDate: 2023-05-02 15:11:39 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2023-05-02 15:11:39 +0000 > > > > > > fstatat(2): restore AT_EMPTY_PATH handling > > > > > > Fixes: cb858340dcbf214cc4c4d78dbb741620d7b3a252 > > > Reported by: markj > > > Sponsored by: The FreeBSD Foundation > > > --- > > > sys/kern/vfs_syscalls.c | 6 +++++- > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c > > > index 5c0a291e3b0b..d68af4ea4d51 100644 > > > --- a/sys/kern/vfs_syscalls.c > > > +++ b/sys/kern/vfs_syscalls.c > > > @@ -2438,8 +2438,12 @@ kern_statat(struct thread *td, int flag, int fd, const char *path, > > > AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) | LOCKSHARED | LOCKLEAF | > > > AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights); > > > > > > - if ((error = namei(&nd)) != 0) > > > + if ((error = namei(&nd)) != 0) { > > > + if (error == ENOTDIR && > > > + (nd.ni_resflags & NIRES_EMPTYPATH) != 0) > > > + error = kern_fstat(td, fd, sbp); > > > return (error); > > > + } > > > > cache_fplookup_dirfd() doesnt set the NIRES_EMPTYPATH flag > > It doesn't, but for an AT_EMPTY_PATH lookup it aborts the lookup and > returns ENOTDIR to namei(), which sets NIRES_EMPTYPATH before passing > the error up. > it call cache_fpl_handled_error() which is set status to CACHE_FPL_STATUS_HADLED, namei() simply return error in that path > > > error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED); > > > NDFREE_PNBUF(&nd); > > > vput(nd.ni_vp); > >