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

Send a copy of the SOCKETS to intproxy, and have it initialize a new layer with those SOCKETS. #2566

Closed
wants to merge 2 commits into from

Conversation

meowjesty
Copy link
Member

(wip)

Copy link
Contributor

@Razz4780 Razz4780 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you got it a bit wrong :V

Forking is not a problem, because the child process inherits both descriptor and the memory (SOCKETS map). So layer actually works fine with forks. What you need to hook is the exec functions family. When the user app does exec, a new process is spawned with fresh memory and the layer initializes from scratch (from lib constructor). The problem is that this new process does inherit some of the descriptors (those without the CLOEXEC flag).

I imagine a flow like this:

  1. In exec* detours, set parent layer id in env.
  2. In layer's constructor, read parent layer id from env and clear it. If it was set, it means that the current process came from exec. At this point you should fetch sockets info from the intproxy, maybe with a new variant of NewSessionRequest

@Razz4780
Copy link
Contributor

Superseded by #2610

@Razz4780 Razz4780 closed this Jul 24, 2024
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.

2 participants