Re: Strange Linux behaviour with blocking syscalls and stopsignals+SIGCONT

From: Michael Kerrisk
Date: Thu Jul 06 2006 - 05:21:46 EST


Hi Manfred,

> Michael Kerrisk wrote:
>
> > c) The Linux baehviour has been arbitrary across kernel versions and
> > system calls. In particular, the following system calls showed this
> > behaviour in earlier kernel versions, but then the behaviour was
> > changed without forewarning and (AFAIK) without subsequent complaint:
> >
> > [snip]
> >
> > * msgsnd() and msgrcv() in kernels before 2.6.9.
> >
> That was my change - and I even forgot to mention it in the changelog
> (hiding in shame):
> I replaced -EINTR with -ERESTARTNOHAND.

Well, that change was useful for my argument: the change appears
to have affected no-one, and so why not make it also for futex(),
sigtimedwait(), semop()/semtimedop(), inotify read(),
epoll_wait()...

> That hides signals that are handled in the kernel from user space -
> probably what we want.

Yes.

> Michael: Could you replace the EINTR in inotify.c with ERESTARTNOHAND?
> That should prevent the kernel from showing the signal to user space.
> I'd guess that most instances of EINTR are wrong, except in device
> drivers: It means we return from the syscall, even if the signal handler
> wants to restart the system call.

I'll try patching a kernel to s/EINTR/ERESTARTNOHAND/ in relevant
places, and see how that goes. If it goes well, I'll submit a
patch.

Cheers,

Michael

--
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7

Want to help with man page maintenance?
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/,
read the HOWTOHELP file and grep the source
files for 'FIXME'.
-
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/