Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2023 20:00:01 +0300
From:      Dmitry Chagin <dchagin@freebsd.org>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        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:  <ZFFBke7JKtnwyj23@heemeyer.club>
In-Reply-To: <202305021512.342FCpbN056202@gitrepo.freebsd.org>
References:  <202305021512.342FCpbN056202@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <kib@FreeBSD.org>
> AuthorDate: 2023-05-02 15:11:39 +0000
> Commit:     Konstantin Belousov <kib@FreeBSD.org>
> 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

>  	error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED);
>  	NDFREE_PNBUF(&nd);
>  	vput(nd.ni_vp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZFFBke7JKtnwyj23>