Repository navigation
shard_connection: Support abstract Unix socket clients - #257
Conversation
cd61c5f to
862e5cc
Compare
|
@filipecosta90 This is still a patch we are interested in. Could you help review this? Thanks. |
862e5cc to
86637a8
Compare
86637a8 to
bccd703
Compare
|
@fcostaoliveira While this PR is quite old, we have been running this patch in production for some time, and are still interested in having this upstream. Can you review? Thanks. |
|
🤖 Automated first-pass review — a human maintainer's review is still required before merge. Thanks for this, and for picking the original 2024 commit back up rather than starting over. I went through it and have a few comments below. The address construction looks right to me.
Nitpicking: The core change looks solid to me. I'd just like the validation-location question answered and the CI change split out before this merges. |
|
Addressed these against final head 3793976 (runtime unchanged from 0d0fa08):
The semantics lens passes 22 independent probes, 13 unit tests and all five committed Unix tests. Owner ASan/LSan tests also pass 5/5. The remaining independent lenses and fresh CI still gate merge. |
|
Rechecked the edited 05:57:59Z review on 3793976:
All seven independent lenses are MERGE. Native macOS evidence is now in the body: all three OpenSSL cells pass the two filesystem tests, skip three Linux-only cases and pass13 units. The combined master+verification+JSON tree also passes14 units and10 focused interaction cases. Fresh final-head CI still gates merging. |
|
Follow-up on the latest review:
|

Problem
Support servers that expose only Linux abstract Unix sockets, including environments with no writable socket directory.
--unix-socket @NAMEselects that namespace; ordinary filesystem sockets remain supported.Root cause
Upstream constructs only filesystem socket addresses. Abstract addresses instead require a leading NUL and an exact address length without a trailing terminator. The original PR also copied a source-sized string into the fixed
sun_pathbuffer; one byte over the limit reproducibly aborted in the fortified build.Fix
@NAMEto the abstract namespace, including the leading NUL in the address length and excluding a terminating NUL.@, including a completely filledsun_path. Reject longer names with exit 1 before creating a socket; never truncate to another abstract endpoint../@NAMEfor a Linux relative filesystem path beginning with@. On other platforms a bare@NAMEremains a filesystem path.bc8e3161fc1a04b4204361b06ec5a66793e213eawith normal merges.Tests
d3006c0, the new overlong-name regression fails with SIGABRT / buffer overflow detected. Four other cases pass.bc8e316: format checks pass;make checkpasses 13/13 unit tests.@. A listener at the truncated prefix verifies oversized abstract names never connect there.@pathname), skips three Linux-only cases, and passes 13/13 unit tests.Compatibility decision
The Linux
@NAMEsyntax is deliberate: it follows the familiar abstract-socket display convention and reuses the existing endpoint option. A separate flag would add another permanent endpoint configuration; a new textual prefix would also reserve pathname syntax. The explicit./@NAMEescape preserves access to relative filesystem sockets. Filesystem truncation and non-Linux path interpretation retain their existing behavior. An empty abstract name remains valid and is covered by an independently bound endpoint.Affected versions
This is a new feature, not a regression fix in a released version. Linux abstract Unix sockets are unavailable in upstream master
bc8e316; the unmerged feature therefore has no released introducing commit. The unbounded copy is confined to the original unmerged PR implementation. Existing filesystem Unix sockets keep their prior behavior apart from reserving a leading@for abstract names on Linux;./@NAMEretains filesystem access.Note
Medium Risk
Changes connection address construction for
--unix-socketon Linux (new@NAMEsemantics) but rejects overlong names instead of truncating; filesystem behavior is preserved aside from reserving@on Linux.Overview
Adds Linux abstract Unix socket support so
--unix-socket @NAMEconnects in the abstract namespace without a filesystem path, while filesystem sockets and./@NAMEfor a path starting with@stay unchanged.shard_connectionnow builds the correctsockaddr_unlength (leading NUL for abstract names, no silent truncation) and fails with a clear error when the name exceeds 107 bytes after@. Help text, man page, and README document the Linux-only@syntax and security note.CI smoke tests fall back to a default image matrix when repo variables are missing on fork PRs, and macOS jobs run the new
tests/test_unix_socket.pyregression suite (filesystem, escaped@paths, abstract names, and overlong-name rejection).Reviewed by Cursor Bugbot for commit e620dc8. Bugbot is set up for automated code reviews on this repo. Configure here.
CI compatibility: fork PRs can receive an empty
vars.SMOKE_TEST_IMAGES; that prevented the distro matrix from being created while all visible jobs passed. The workflow now falls back to the same seven images currently configured upstream. An explicit repository variable still takes precedence. Independent focused build review and actionlint pass; fresh matrix execution is required.🤖 Generated with Claude Code