Yann Droneaud
a21b0b354d
perf: Introduce a flag to enable close-on-exec in perf_event_open()
Unlike recent modern userspace API such as:
epoll_create1 (EPOLL_CLOEXEC), eventfd (EFD_CLOEXEC),
fanotify_init (FAN_CLOEXEC), inotify_init1 (IN_CLOEXEC),
signalfd (SFD_CLOEXEC), timerfd_create (TFD_CLOEXEC),
or the venerable general purpose open (O_CLOEXEC),
perf_event_open() syscall lack a flag to atomically set FD_CLOEXEC
(eg. close-on-exec) flag on file descriptor it returns to userspace.
The present patch adds a PERF_FLAG_FD_CLOEXEC flag to allow
perf_event_open() syscall to atomically set close-on-exec.
Having this flag will enable userspace to remove the file descriptor
from the list of file descriptors being inherited across exec,
without the need to call fcntl(fd, F_SETFD, FD_CLOEXEC) and the
associated race condition between the current thread and another
thread calling fork(2) then execve(2).
Links:
- Secure File Descriptor Handling (Ulrich Drepper, 2008)
http://udrepper.livejournal.com/20407.html
- Excuse me son, but your code is leaking !!! (Dan Walsh, March 2012)
http://danwalsh.livejournal.com/53603.html
- Notes in DMA buffer sharing: leak and security hole
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/dma-buf-sharing.txt?id=v3.13-rc3#n428
Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/8c03f54e1598b1727c19706f3af03f98685d9fe6.1388952061.git.ydroneaud@opteya.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-01-12 10:16:59 +01:00
..
2013-09-21 15:43:12 +02:00
2013-09-08 14:34:22 -05:00
2013-10-14 18:01:01 +02:00
2013-08-02 12:33:54 -07:00
2013-08-02 12:33:54 -07:00
2013-11-19 15:19:18 +11:00
2013-10-02 16:39:11 -04:00
2013-08-02 12:33:54 -07:00
2013-11-21 19:18:14 -08:00
2013-11-10 21:56:33 -08:00
2013-09-01 08:16:01 -04:00
2013-08-28 19:26:38 -07:00
2013-11-09 18:20:22 -05:00
2013-08-02 12:33:54 -07:00
2013-08-20 16:53:58 -05:00
2013-09-16 18:20:24 -07:00
2013-12-03 15:35:52 +01:00
2013-08-03 10:40:23 -07:00
2013-08-16 22:05:14 -04:00
2013-07-27 20:24:36 +02:00
2013-09-10 18:56:29 -04:00
2013-11-28 18:26:30 -05:00
2013-10-25 17:14:03 -04:00
2013-11-03 23:20:14 -05:00
2013-09-03 22:11:44 -04:00
2013-10-03 15:36:38 -04:00
2013-08-02 12:33:54 -07:00
2013-11-03 23:20:14 -05:00
2013-11-30 12:48:14 -05:00
2013-08-29 16:43:29 -04:00
2013-08-13 15:10:22 -07:00
2013-08-21 12:21:45 -07:00
2013-11-07 19:11:41 -05:00
2013-09-04 13:12:43 -04:00
2013-11-05 21:52:27 -05:00
2013-12-05 12:49:37 -08:00
2013-10-15 10:36:01 +09:00
2013-08-26 16:37:08 -04:00
2013-08-29 15:32:08 -04:00
2013-09-26 13:50:56 -07:00
2013-09-24 10:35:19 +01:00
2013-08-26 12:46:01 +03:00
2013-11-04 10:20:57 +02:00
2013-09-04 13:12:43 -04:00
2013-11-11 21:56:51 -05:00
2013-11-06 23:32:59 -08:00
2013-11-27 11:03:38 -08:00
2013-09-27 17:20:19 -07:00
2013-11-28 18:16:43 -05:00
2013-09-25 02:30:47 +02:00
2013-10-28 15:37:56 -04:00
2013-10-28 15:05:21 +01:00
2013-09-03 16:32:26 -04:00
2013-11-01 18:43:45 -07:00
2013-11-28 18:16:43 -05:00
2013-11-14 11:28:18 -07:00
2014-01-12 10:16:59 +01:00
2013-10-29 17:33:17 -04:00
2013-11-15 21:01:52 -05:00
2013-11-11 14:32:14 -05:00
2013-07-25 19:30:03 +10:00
2013-07-24 17:53:38 -07:00
2013-09-06 11:14:33 -07:00
2013-08-27 16:02:18 -07:00
2013-08-16 15:37:26 -07:00
2013-07-24 17:54:48 -07:00
2013-07-31 10:33:05 +02:00
2013-11-28 18:16:43 -05:00
2013-10-28 15:17:30 -02:00
2013-08-18 08:13:51 -03:00
2013-08-18 07:23:07 -03:00
2013-09-04 11:28:04 -06:00
2013-08-18 08:17:35 -03:00
2013-08-02 12:33:54 -07:00