erickt / rust-zmq

Rust zeromq bindings.
Apache License 2.0
886 stars 189 forks source link

rust-zmq may be unsound due to calls to `getenv` #332

Open xerxes12354 opened 3 years ago

xerxes12354 commented 3 years ago

I was looking at the time crate wondering why the time crate didn't give offsets, and I stumbled upon this thread on Internals. This seems like a big problem so I went looking for FFI crates where this could be a problem.

Zmq uses getenv internally https://github.com/zeromq/libzmq/blob/3070a4b2461ec64129062907d915ed665d2ac126/src/ip.cpp#L896, so it looks like this wrapper has a data race when set_env is called in another thread.