lkml.org 
[lkml]   [2006]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [take23 0/5] kevent: Generic event handling mechanism.
Date
On Wednesday 08 November 2006 09:21, Evgeniy Polyakov wrote:
> On Tue, Nov 07, 2006 at 02:17:18PM -0800, Andrew Morton (akpm@osdl.org)
wrote:
> > From: Andrew Morton <akpm@osdl.org>
> >
> > If kevent_user_wait() gets -EFAULT on the attempt to copy the first
> > event, it will return 0, which is indistinguishable from "no events
> > pending".
> >
> > It can and should return EFAULT in this case.
>
> Correct, I missed that.
> Thanks Andrew, I will put into my tree, -mm seems to have it already.

I believe eventpoll has a similar problem. Not a big problem, but we can be
cleaner. Normally, the access_ok() done in sys_epoll_wait() should catch non
writeable user area, unless another thread play VM game (the thread in
sys_epoll_wait() can sleep)

[PATCH] eventpoll : In case a fault occurs during copy_to_user(), we should
report the count of events that were successfully copied into user space,
instead of EFAULT. That would be consistent with behavior of read/write()
syscalls for example.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

--- linux/fs/eventpoll.c 2006-11-08 15:37:36.000000000 +0100
+++ linux/fs/eventpoll.c 2006-11-08 15:38:31.000000000 +0100
@@ -1447,7 +1447,7 @@
&events[eventcnt].events) ||
__put_user(epi->event.data,
&events[eventcnt].data))
- return -EFAULT;
+ return eventcnt ? eventcnt : -EFAULT;
if (epi->event.events & EPOLLONESHOT)
epi->event.events &= EP_PRIVATE_BITS;
eventcnt++;
\
 
 \ /
  Last update: 2006-11-08 15:53    [W:0.133 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site