crosvm/arch
Fergus Dall fbe73af05b crosvm: Don't try to bind the logging socket
Currently both vmlog_forwarder and crosvm will try to bind the logging
socket with the idea that one will succeed and the other will get an
error and know to connect instead. This fails because once a socket
has been bound to a file path it will continue to hold that path (and
block further binds to it) even after the process that did the bind
exits.

This means that a failed bind can mean *both* that the other party has
already bound the socket and you should connect to it, *and* that
there's an old socket holding the address which needs to be deleted.

If both sides try to connect, then an old socket will block the
connection forever. If both sides try to delete and recreate, then
neither will ever connect. What we actually do is have one side try to
delete and recreate while the other falls back to connecting. This
works when the re-creator acts first, but if the connector acts first
they will bind a socket, and then have it removed from the file-system,
and again neither side ever connects.

The only correct option is for one side to bind (deleting old sockets
if needed) and the other only ever calls connect, never binding.

Since crosvm is sending and vmlog_forwarder is receiving, and
vmlog_forwarder is already acting correctly for the bind side of this
protocol, it makes sense for crosvm to do the connecting. Therefore,
this CL makes crosvm block in create_serial_device until it succeeds in
connecting to the logging socket.

BUG=chromium:1040272
TEST=manually tested

Disallow-Recycled-Builds: test-failures
Change-Id: I45fdbb325a06fc04e2e93fb5f5d47b5b82cb8592
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2497351
Tested-by: Fergus Dall <sidereal@google.com>
Commit-Queue: Fergus Dall <sidereal@google.com>
Reviewed-by: Nicholas Verne <nverne@chromium.org>
2020-11-12 10:15:51 +00:00
..
src crosvm: Don't try to bind the logging socket 2020-11-12 10:15:51 +00:00
Cargo.toml linux: Support GDB remote serial protocol for x86_64 2020-11-12 08:47:59 +00:00