[PATCH v6 4/5] io: Add closefrom [BZ #10353]

Florian Weimer fweimer@redhat.com
Tue Jul 6 11:37:08 GMT 2021


* Adhemerval Zanella via Libc-alpha:

> Valgrind can overwrite it because it make is invisible to user program and 
> libc, and for your tool I think the best course of action would be to 
> interpose closefrom() and clone_range() and exclude the file descriptors 
> you want to keep it opened.

I agree.

Just to be clear: glibc will not clean up descriptors behind the
application's back.  The application has to request that, so interposing
the call should be sufficient for your purposes.

(We even have a policy of not opening long-term file descriptors for
internal use because we know that extra file descriptors confuse many
applications.)

Thanks,
Florian



More information about the Libc-alpha mailing list