Open wjhun opened 2 years ago
I'm working on it. May you assign it to me.
@0x9n0p you have been assigned. Thanks!
It seems that there is nothing to do. It has already been done.
It has not been done, transfer of ancillary data through Unix domain socket is still not implemented. For example, if you try to run a Ruby application that uses the send_io
or recv_io
methods of the UNIXSocket class, you will get a [BUG] rb_maygvl_fd_fix_cloexec: fcntl(-2075168, F_GETFD) failed: Bad file descriptor
error message, due to the fact that the file descriptor that the application expects to receive as ancillary data in the socket is not being transferred. How to reproduce:
require 'socket'
s1, s2 = UNIXSocket.pair
s1.send_io STDOUT
stdout = s2.recv_io
p STDOUT.fileno #=> 1
p stdout.fileno #=> 6
stdout.puts "hello" # outputs "hello\n" to standard output.
{
"Args": ["send_io.rb"],
"Files": ["send_io.rb"],
"MapDirs": {
"/usr/local/lib/ruby/3.0.0/*": "/usr/local/lib/ruby/3.0.0/",
"/usr/local/lib/ruby/gems/3.0.0/*": "/usr/local/lib/ruby/gems/3.0.0/"
}
}
ops run /usr/local/bin/ruby -c config.json
sendmsg(2) and recvmsg(2) allow the exchange of out-of-band "ancillary data", such as file descriptors and errors. These messages are created and accessed using the CMSG_* macros (see the cmsg(3) man page). Some packages, such as erlang/OTP, use these messages to communicate file descriptors over unix domain sockets. The passage of file descriptors, using type SCM_RIGHTS, may require some special handling beyond simple copying, as queueing a file descriptor is actually storing a reference to the object being described, not the descriptor numbers themselves. (e.g. on a multi-process system, an fd written by one process may be read as a different fd by another process - yet both refer to the same object) Also, the writing of descriptors should count as a reference to the underlying object, as the descriptors may be closed after writing ancillary data containing them - while still allowing the receiving end to read open descriptors.
References: https://www.man7.org/linux/man-pages/man3/cmsg.3.html https://blog.cloudflare.com/know-your-scm_rights/