git: a248c5545f6f - main - connectat(2): do not enable EMPTYPATH for AT_FDCWD
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Jun 2026 21:10:25 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=a248c5545f6fb861ea4200b69a58b2abcf815ce4
commit a248c5545f6fb861ea4200b69a58b2abcf815ce4
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-06-09 05:27:49 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-06-09 21:09:48 +0000
connectat(2): do not enable EMPTYPATH for AT_FDCWD
This restores existing error code for connect(2) over unix domain socket
when the empty string is specified as socket address.
Reported by: eduardo
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57509
---
sys/kern/uipc_usrreq.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 920588627914..b28aed291895 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -2921,8 +2921,9 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam,
sa = malloc(sizeof(struct sockaddr_un), M_SONAME, M_WAITOK);
else
sa = NULL;
- NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | EMPTYPATH,
- UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_CONNECTAT));
+ NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
+ (fd == AT_FDCWD ? 0 : EMPTYPATH), UIO_SYSSPACE, buf, fd,
+ cap_rights_init_one(&rights, CAP_CONNECTAT));
error = namei(&nd);
if (error)
vp = NULL;