Re: [PATCH] perf tools: enable close-on-exec flag on perf filedescriptor

From: Andi Kleen
Date: Mon Jan 06 2014 - 11:52:37 EST


> AFAICT its got nothing to do with threaded or not, but only with exec()
> and we do in fact call exec() quite a lot in perf.
>
> It ensures we do not leak open perf FDs into our child processes. Now
> I'm not entirely sure how we do the exec these days but I think we were
> good about not not leaking them anyway, but more paranoia never really
> hurts.

Then you can just set it with fcntl, which works everywhere,
instead of doing extra feature tests.

The atomic setup is only needed for threaded programs to avoid
races with other threads doing exec.

-Andi

--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/