Skip to content
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

Prevent use of socat in firecracker-pilot #41

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Conversation

schaefi
Copy link
Contributor

@schaefi schaefi commented Apr 7, 2024

Do not shell out socat and use proper UnixListener/UnixStream to do this job. This version of the commit works but I stumbled across a few issues:

  1. Permission denied when the UnixListener runs as user and the firecracker process was called as root (run_as: root in the flake). The former implementation ran socat via sudo in the same way as the firecracker process. Thus if you register the flake to run as root it can now also only be called as root, which is acceptable.

  2. The behavior in interactive sessions differs compared to socat. When sci in the guest is called it creates a pty and all data is copied to the vsock stream. The host connects via an UDS socket to this data and we multiplex stdin->stream and stream->stdout. When doing this with socat the behavior is different in a way that e.g tabs are effectively interpreted and the pty prompt allows for input on the same line when my code now always needs a newline to renew the prompt. I did not debug further what is needed to make this look nicer.

@schaefi schaefi self-assigned this Apr 7, 2024
Do not shell out socat and use proper UnixListener/UnixStream
to do this job. This version of the commit works but I stumbled
across a few issues:

1. Permission denied when the UnixListener runs as user and the
   firecracker process was called as root (run_as: root in the flake).
   The former implementation ran socat via sudo in the same way as
   the firecracker process. Thus if you register the flake to
   run as root it can now also only be called as root, which is
   acceptable.

2. The behavior in interactive sessions differs compared to socat.
   When sci in the guest is called it creates a pty and all data
   is copied to the vsock stream. The host connects via an UDS
   socket to this data and we multiplex stdin->stream and
   stream->stdout. When doing this with socat the behavior
   is different in a way that e.g tabs are effectively interpreted
   and the pty prompt allows for input on the same line when
   my code now always needs a newline to renew the prompt.
   I did not debug further what is needed to make this look
   nicer.

This Fixes #8
@schaefi schaefi force-pushed the get_rid_of_socat branch from 221f228 to 75a4e56 Compare April 7, 2024 16:36
@schaefi schaefi merged commit e1091e8 into main Apr 8, 2024
7 checks passed
@schaefi schaefi deleted the get_rid_of_socat branch April 8, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant