This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] PR 31228, Fix close-on-exec race.


David Daney wrote:
Tom Tromey wrote:
"David" == David Daney <ddaney@avtrex.com> writes:

David> I hope someone can think of a better way to fix the race. If David> only there were some way to set the default value of the David> FD_CLOEXEC flag...

We could wrap each "open + set FD_CLOEXEC" in a mutex, and do the same
for the fork.

That does not work in a blocking socket accept situation. It would prevent Runtime.exec() from starting the subprocess until a connection arrived.



OK, I will respond to myself:


Make the accept non-blocking, and do a select/poll on the ServerSocket. That way the accept would never block and you could use a mutex.

This is workable. I think there are only 4 or 5 places file descriptors are obtained in libgcj.

This makes me think that ld.so is probably broken also. When we do dlopen ld.so opens the library file and does several mmaps before closing the file descriptor. These could leak out as well.

David Daney


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]