If a process was itself created by PR_CreateProcess with an inherited fd, it won't be able to pass any inheritable fd's to a child process created by PR_CreateProcess. NSPR passes the values of inheritable fd's in a magic environment variable in the child process's environment. If a process was itself created by PR_CreateProcess, it will have that magic environment variable in its environment. If this process calls PR_CreateProcess with an inheritable fd, it will append the magic environment variable to the current environment, without checking if the magic environment variable already exists. So the child's environment array ends up with two entries of that magic environment variable, with the wrong one appearing before the right one. When the child process gets its inherited fd, it gets the wrong value.
Created attachment 124021 [details] [diff] [review] Proposed patch Search for existing NSPR_INHERIT_FDS environment variable in the environment. If it exists, replace it with the new value rather than appending the new value to the environment.
Created attachment 124044 [details] [diff] [review] Proposed patch v1.1 The previous patch has a bug in the Windows code. The second argument to qsort() may be incorrect.
Attachment #124021 - Attachment is obsolete: true
Do we still need this?
Yes, we should still fix this bug even though the affected customer has implemented a workaround.
is this ready for check in?
I checked in the patch on the NSPR trunk for NSPR 4.7. Checking in beos/bproc.c; /cvsroot/mozilla/nsprpub/pr/src/md/beos/bproc.c,v <-- bproc.c new revision: 3.7; previous revision: 3.6 done Checking in unix/uxproces.c; /cvsroot/mozilla/nsprpub/pr/src/md/unix/uxproces.c,v <-- uxproces.c new revision: 3.21; previous revision: 3.20 done Checking in windows/ntmisc.c; /cvsroot/mozilla/nsprpub/pr/src/md/windows/ntmisc.c,v <-- ntmisc.c new revision: 3.23; previous revision: 3.22 done
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.7
You need to log in before you can comment on or make changes to this bug.