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-04-23 13:25:51 -04:00
2013-09-21 15:43:12 +02:00
2013-09-08 14:34:22 -05:00
2013-04-08 06:53:15 -03:00
2012-11-09 16:28:37 -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-04-02 12:25:57 +02:00
2013-11-19 15:19:18 +11:00
2013-10-02 16:39:11 -04:00
2013-07-16 15:33:02 -07:00
2013-08-02 12:33:54 -07:00
2013-03-13 15:21:48 -07:00
2013-03-13 15:21:48 -07:00
2013-11-21 19:18:14 -08:00
2013-02-08 20:42:18 +01:00
2013-04-26 16:08:16 +10:00
2013-11-10 21:56:33 -08:00
2013-07-01 15:10:53 +02:00
2013-09-01 08:16:01 -04:00
2013-01-21 15:40:35 -05:00
2013-08-28 19:26:38 -07:00
2013-03-20 13:23:21 -04:00
2013-03-15 12:12:36 -07:00
2013-06-25 15:50:04 -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-03-27 14:37:47 +00:00
2013-05-27 22:42:50 -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-03-20 13:15:45 -04:00
2013-07-27 20:24:36 +02:00
2013-09-10 18:56:29 -04:00
2013-05-01 14:37:21 +02:00
2013-06-11 02:51:03 -07: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
2012-11-19 22:21:03 +00:00
2013-09-03 22:11:44 -04:00
2013-06-24 16:39:05 -07:00
2013-10-03 15:36:38 -04:00
2013-08-02 12:33:54 -07:00
2013-05-08 13:13:30 -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
2012-11-20 13:43:28 -05:00
2013-02-10 20:37:22 -05: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-02-27 19:10:21 -08:00
2012-11-16 01:47:40 -05: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-03-21 14:05:31 -03:00
2012-12-11 14:42:48 +00:00
2013-02-05 18:23:47 -02:00
2013-11-27 11:03:38 -08:00
2013-09-27 17:20:19 -07:00
2012-12-14 13:05:23 +10:30
2013-01-21 13:55:14 -05:00
2013-01-21 13:55:14 -05:00
2013-07-09 10:33:25 -07:00
2013-01-04 16:11:45 -08:00
2013-02-27 19:10:22 -08:00
2013-03-17 12:23:46 -04:00
2012-12-04 13:08:10 -05:00
2013-11-28 18:16:43 -05:00
2013-04-19 14:57:57 -04: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
2012-11-16 10:15:35 -08: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
2012-11-01 11:41:34 -04:00
2013-07-03 16:08:01 -07:00
2013-11-11 14:32:14 -05:00
2013-07-25 19:30:03 +10:00
2013-04-12 16:54:38 +02:00
2013-06-19 23:06:51 -07: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
2012-12-19 18:07:39 -05:00
2013-08-16 15:37:26 -07:00
2012-12-06 01:22:31 +00:00
2013-07-24 17:54:48 -07:00
2013-03-22 16:19:59 -07:00
2013-06-17 15:53:00 -07:00
2013-06-17 15:53:00 -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-05-02 13:40:15 +03:00
2013-08-18 08:17:35 -03:00
2013-04-02 16:42:58 +10:30
2013-07-09 10:47:45 +09:30
2013-07-03 13:09:06 -07:00
2013-03-20 14:06:06 +10:30
2013-08-02 12:33:54 -07:00
2013-05-20 12:08:09 +09:30
2013-03-08 12:24:48 -05:00
2013-01-31 19:56:35 -05:00
2013-02-27 19:10:10 -08:00
2013-03-06 07:02:45 +01:00