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

Leaking FDs: Close non-std FDs between pty_forkpty and pty_execvpe #657

Open
htfy96 opened this issue Jan 21, 2024 · 0 comments
Open

Leaking FDs: Close non-std FDs between pty_forkpty and pty_execvpe #657

htfy96 opened this issue Jan 21, 2024 · 0 comments
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities

Comments

@htfy96
Copy link

htfy96 commented Jan 21, 2024

Environment details

  • OS: Linux
  • OS version: Linux 6.7
  • node-pty version: The one bundled in VSCode, and I believe it still exists on master

Issue description

Related to microsoft/vscode#202558 .

Currently node-pty doesn't close unwanted fds before spawning the process in pty_execvpe. This caused the above issue where Node's open fd(s) accidentally leaks into the spawned process. Considering that very few spawned shell process are aware to the non-std fds, I doubt if this would ever be the desired behavior.

To reduce the amount of surprise, I hope it could do something like https://github.com/facebook/folly/blob/main/folly/Subprocess.cpp#L559 to close all unwanted fds before spawning the shell.


EDIT from @Tyriar:

Lots more information in #710

@Tyriar Tyriar changed the title Close non-std FDs between pty_forkpty and pty_execvpe Leaking FDs: Close non-std FDs between pty_forkpty and pty_execvpe Dec 17, 2024
@Tyriar Tyriar added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

2 participants