-
Notifications
You must be signed in to change notification settings - Fork 220
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
fix: Prevent fork bomb on Windows #1761
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Thanks for tackling this! Can you comment on the specific trigger condition and the mechanics of how it recurses? Without a good understanding of the overall root cause of the recursion, it's difficult to be confident that we're completely resolving the issue. We're already working around some of the oddities of If that's the case, we may be able to resolve this in a less intrusive way by detecting the CWD is one of the Volta dirs. I worry a little about the extra copying / allocating needed to hold onto the command, args, and env vars through the process. It's a relatively small impact, but this block is on the hot path for every call to any of the shims, so it's one of the most performance-sensitive areas of the app. |
One thought, if the above is accurate for how this recursion starts, would be to check on Windows right before executing if the CWD is one of the Volta directories. If it is, we can do the absolute path resolution and then copy the values (since we’ll need to create a new |
I see that it had tried to remove the Volta directory from the
That's the root cause.
I get your thought here but it does not really help imo by just detecting CWD. It should only find the right executable by only checking from the PATH environment variable we give. (and this is why |
Signed-off-by: Chawye Hsu <[email protected]>
Btw, I don't quite understand why the infinite recursive call is allowed. I believe there should be a limit of max recursive depth, say 10, and once it exceeds it should halt. This should help to resolve from another perspective. |
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Signed-off-by: Chawye Hsu <[email protected]>
Fix #1741
Before this patch,
volta-shim
(and its aliases) spawns itself in some cases causing recursive call (fork bomb). This is a critical issue but only occurs on Windows.