8194734 : Handle to jimage file inherited into child processes (win)

Alan Bateman Alan.Bateman at oracle.com
Sun Apr 8 16:26:34 UTC 2018

On 06/04/2018 22:01, Martin Buchholz wrote:
> History:
> The design on Unix was that all file descriptors greater than 3 are 
> closed on fork and before exec.
> But regardless of that, we should try to set the CLOEXEC bit on all 
> our file descriptor (who knows, there might be native code that does 
> fork+exec).
> File descriptor 3 is indeed deep magic, used for error reporting.  
> It's a serious bug if FAIL_FILENO ends up being used for something 
> other than the error reporting pipe.
> I don't think I'm the last (or the first!) person who touched this.
STDERR_FILENO is 2 so I'm curious which error reporting pipe is bring 
discussed here. The jimage file is opened very early when initializing 
the VM so it will get a low file descriptor number, seems to be 3. The 
only surprise is that it doesn't close as it shouldn't need the file 
descriptor after it mmapped.


More information about the core-libs-dev mailing list