-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to libuv version 1.46.0 broke connecting to abstract unix sockets #49656
Comments
Sounds reasonable. Do you want to send a PR? |
@santigimeno thanks for getting back so quickly. I'm not familiar with any of the C / C++ types and could use a hint on how to determine the correct length from Lines 170 to 171 in 44084b8
I feel like there may be some subtleties here when going from utf8 to |
For the length, I guess |
I have the naive set of changes here. Currently running Any tips on validating changes before kicking off a PR? |
Those changes are perfect imo. Use |
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect. This broke the ability to connect to abstract domain sockets on linux. This change ports PipeWrap to use the new uv_pipe_bind2 and uv_pipe_connect2 methods to restore abstract domain socket support. Fixes: nodejs#49656 Refs: libuv/libuv#4030
Introduce a new linux-only test for binding to an abstract unix socket and then making an http request against that socket. Refs: nodejs#49656
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect. This broke the ability to connect to abstract domain sockets on linux. This change ports PipeWrap to use the new uv_pipe_bind2 and uv_pipe_connect2 methods to restore abstract domain socket support. Fixes: nodejs#49656 Refs: libuv/libuv#4030
Introduce a new linux-only test for binding to an abstract unix socket and then making an http request against that socket. Refs: nodejs#49656
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect. This broke the ability to connect to abstract domain sockets on linux. This change ports PipeWrap to use the new uv_pipe_bind2 and uv_pipe_connect2 methods to restore abstract domain socket support. Fixes: nodejs#49656 Refs: libuv/libuv#4030
Introduce a new linux-only test for binding to an abstract unix socket and then making an http request against that socket. Refs: nodejs#49656
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect. This broke the ability to connect to abstract domain sockets on linux. This change ports PipeWrap to use the new uv_pipe_bind2 and uv_pipe_connect2 methods to restore abstract domain socket support. Fixes: #49656 Refs: libuv/libuv#4030 PR-URL: #49667 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect. This broke the ability to connect to abstract domain sockets on linux. This change ports PipeWrap to use the new uv_pipe_bind2 and uv_pipe_connect2 methods to restore abstract domain socket support. Fixes: #49656 Refs: libuv/libuv#4030 PR-URL: #49667 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect. This broke the ability to connect to abstract domain sockets on linux. This change ports PipeWrap to use the new uv_pipe_bind2 and uv_pipe_connect2 methods to restore abstract domain socket support. Fixes: nodejs#49656 Refs: libuv/libuv#4030 PR-URL: nodejs#49667 Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Version
>= 20.4.0
Platform
Linux b9efe00af536 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux
Subsystem
net
What steps will reproduce the bug?
If you have access to docker to facilitate cross-version testing:
Output:
How often does it reproduce? Is there a required condition?
It requires 100% of the time.
What is the expected behavior? Why is that the expected behavior?
Abstract unix socket connections are possible.
What do you see instead?
See repro steps.
Additional information
In libuv/libuv#4030, we introduced
uv_pipe_bind2
as a successor touv_pipe_bind
that now accepts asize_t
representing the socket name length (since it starts with aNULL
byte). InPipeWrap::Bind
, we only ever calluv_pipe_bind
:node/src/pipe_wrap.cc
Lines 167 to 173 in 44084b8
That means that the
namelen
argument touv_pipe_bind2
will always default to the result ofstrlen(name)
. I suspect thatstrlen("\0anything")
will always yield 0, resulting inEINVAL
here: https://github.com/libuv/libuv/blob/0d78f3c758fdc41019093353a7ff4fed83005ac9/src/unix/pipe.c#L65-L66.I think that the fix might be to detect strings with a leading
"\0"
and pass an explicitnamelen
touv_pipe_bind2
inPipeWrap::Bind
.The text was updated successfully, but these errors were encountered: