Fix SGX delayed host lookup via ToSocketAddr#152851
Fix SGX delayed host lookup via ToSocketAddr#152851jethrogb wants to merge 2 commits intorust-lang:mainfrom
Conversation
|
r? @joboet rustbot has assigned @joboet. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
2048ae7 to
0fb111f
Compare
This comment has been minimized.
This comment has been minimized.
0fb111f to
4c9ee0e
Compare
This comment has been minimized.
This comment has been minimized.
4c9ee0e to
ab3d190
Compare
|
I don't think we should fix this in this way. In #146541 (comment) you mentioned Fortanix's specification, but that's not really relevant here. The documentation for
In my opinion, special-casing SGX here is very weird; even incorrect when considering that the "pass the string via the error" hack leads to incorrect code when users try to write manual implementations of
But I'm not in T-libs-api, let's hear what they think... |
|
We reviewed this in today's @rust-lang/libs-api meeting. We are willing to consider preserving the SGX behavior (which is self-described as a "terrible, terrible hack" that "leads to buggy code"). However, we felt that this implementation was too invasive in the way it affects all other targets. We'd prefer to see this hack more self-contained in one place. Separately from that, we'd like to understand more specifically what SGX does with something like |
|
(Feel free to reach out to me via Zulip if you need more detail on what "more self-contained" means here.) |
I should point out that I added that line in #145327. But I stand by it, this completely breaks the API of |
ab3d190 to
79eb9ea
Compare
This comment has been minimized.
This comment has been minimized.
79eb9ea to
67b6a79
Compare
This comment has been minimized.
This comment has been minimized.
67b6a79 to
7d9053a
Compare
This comment has been minimized.
This comment has been minimized.
705c342 to
e2b3087
Compare
The comment about the “hack” wasn't introduced by the SGX target maintainers.
The string is passed directly outside the enclave for the bind/connect usercall. Details on the platform interface are available at https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#networking
This is technically possible, but it would significantly impact compatibility and ease of use. One of the design goals for the target is “Compatible with most Rust code”. When application developers are using a 3rd party crate that creates network connections, it's unlikely that that crate would have support for such an extension trait. So now you'd have to vendor/upstream a change to support this. |
#146541 introduced a regression in the
x86_64-fortanix-unknown-sgxtarget, where arguments to TcpStream::connect and TcpListener::bind are no longer being passed down correctly to the underlying platform, resulting in connection/bind failuresFixes #152848
cc @joboet