lkml.org 
[lkml]   [2012]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: I finally prepared a testcase for read(inotify_fd) getting EINTR on PTRACE_ATTACH
On 02/10, Oleg Nesterov wrote:
>
> Add CC's,
>
> On 02/10, Denys Vlasenko wrote:
> >
> > I recalled that I saw a spurious EINTR on strace attach.
> > I found time/inspiration to create an isolated testcase for it.
> > Already committed it to ptrace-tests.
> >
> > The code: skip all the cruft, read reproduce() function body.
> > It's quite straightforward.
> >
> > $ gcc -Wall -Os eintr-on-attach.c -oeintr-on-attach
> > $ ./eintr-on-attach 1;echo 1
> > bug: read was interrupted by attach, errno: Interrupted system call
>
> At first glance this looks obvious? I never used inotify and I never
> looked into fs/notify/inotify/, but it seems that inotify_read() simply
> returns -EINTR if signal_pending() and doesn't implement restarts.
>
> Probably this trivial change
>
>
> --- x/fs/notify/inotify/inotify_user.c
> +++ x/fs/notify/inotify/inotify_user.c
> @@ -264,7 +264,7 @@ static ssize_t inotify_read(struct file
> ret = -EAGAIN;
> if (file->f_flags & O_NONBLOCK)
> break;
> - ret = -EINTR;
> + ret = -ERESTARTSYS;
> if (signal_pending(current))
> break;
>
>
> makes sense.

except I meant -ERESTARTNOHAND to avoid the behavioural change.

Oleg.



\
 
 \ /
  Last update: 2012-02-10 16:19    [W:0.042 / U:0.484 seconds]
©2003-2014 Jasper Spaans. Advertise on this site