Created attachment 156148 [details] A patch to add the appropriate O_CLOEXEC flags and to remove the fcntl() calls The same report applies to both 11.0-CURRENT and 10.1-STABLE. In libdtrace there are a few calls to fcntl() to set FD_CLOEXEC for file descriptors for which the easier and more robust approach would be setting O_CLOEXEC already when calling open().
Cc: gnn in case of interest.
The patch looks good to me. Mark, as the one most likely to be affected by changes in cddl/contrib/opensolaris/lib/libdtrace on a future import, what do you think of the approach in the patch, vs #ifdef FreeBSD / #ifdef illumos guards throughout?
(In reply to Ed Maste from comment #2) I think the patch is fine as-is. Given the relatively slow pace of upstream development, I'm not inclined to add ifdefs around every small deviation. Also, illumos now has O_CLOEXEC, so it'd be easy to integrate this upstream at some point in the future.
A commit references this bug: Author: markj Date: Tue Sep 5 00:11:06 UTC 2017 New revision: 323166 URL: https://svnweb.freebsd.org/changeset/base/323166 Log: Use O_CLOEXEC when opening persistent handles in libdtrace. PR: 199810 Submitted by: jau@iki.fi MFC after: 1 week Changes: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
MFCed to stable/11 in r323495.
A commit references this bug: Author: markj Date: Tue Sep 12 14:38:11 UTC 2017 New revision: 323498 URL: https://svnweb.freebsd.org/changeset/base/323498 Log: Add a O_CLOEXEC use missed in r323166. PR: 199810 Reported by: Jukka A. Ukkonen <jau789@gmail.com> MFC after: 3 days Changes: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c