You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2026/02/23 18:58:40 UTC
(trafficserver) 02/08: rpc: tolerate unsupported chmod on unix sockets (#12895)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 5a10eaa9251cdb7a63a7edc124d4bb0ad6d207fc
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Thu Feb 19 18:03:30 2026 -0600
rpc: tolerate unsupported chmod on unix sockets (#12895)
test_jsonrpcserver can fail on containerized macOS-host mounts where
chmod() on an AF_UNIX socket inode returns EINVAL or ENOTSUP.
When this happens, RPC server init aborts and the client test
fails with connection refused.
Treat unsupported chmod-on-socket errors as non-fatal and keep
running with umask-derived permissions, while preserving fatal
behavior for other chmod failures. Also zero-initialize
sockaddr_un before use to avoid carrying stale bytes into bind().
(cherry picked from commit e26b42498f6d04b87ae858179e0e6efc6144c8f5)
---
src/mgmt/rpc/server/IPCSocketServer.cc | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/mgmt/rpc/server/IPCSocketServer.cc b/src/mgmt/rpc/server/IPCSocketServer.cc
index c819c08fca..6b6ebbe7c2 100644
--- a/src/mgmt/rpc/server/IPCSocketServer.cc
+++ b/src/mgmt/rpc/server/IPCSocketServer.cc
@@ -140,6 +140,7 @@ std::error_code
IPCSocketServer::init()
{
std::error_code ec; // Flag possible errors.
+ _serverAddr = {};
// Need to run some validations on the pathname to avoid issue. Normally this would not be an issue, but some tests may fail on
// this.
if (_conf.sockPathName.empty() || _conf.sockPathName.size() > sizeof _serverAddr.sun_path) {
@@ -318,8 +319,13 @@ IPCSocketServer::bind(std::error_code &ec)
mode_t mode = restricted ? 00700 : 00777;
if (chmod(_conf.sockPathName.c_str(), mode) < 0) {
- ec = std::make_error_code(static_cast<std::errc>(errno));
- return;
+ // Some filesystems don't support chmod on AF_UNIX socket inodes.
+ // Keep running in that case and rely on default umask-derived permissions.
+ if (errno != EINVAL && errno != ENOTSUP && errno != EOPNOTSUPP) {
+ ec = std::make_error_code(static_cast<std::errc>(errno));
+ return;
+ }
+ Dbg(dbg_ctl, "chmod(%s) not supported on this filesystem: %s", _conf.sockPathName.c_str(), std::strerror(errno));
}
}