lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130624183931.GA4464@redhat.com>
Date:	Mon, 24 Jun 2013 20:39:31 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Denys Vlasenko <dvlasenk@...hat.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] epoll_wait: fix EINTR leak

On 06/24, Oleg Nesterov wrote:
>
> On 06/24, Denys Vlasenko wrote:
> >
> > Usage of EINTR is wrong.
>
> I agree, this is not nice. However "fix EINTR leak" doesn't look
> accurate, -EINTR is fine as an error code. Just the syscall should
> restart if possible.
>
> > --- a/fs/eventpoll.c
> > +++ b/fs/eventpoll.c
> > @@ -1598,7 +1598,7 @@ fetch_events:
> >  			if (ep_events_available(ep) || timed_out)
> >  				break;
> >  			if (signal_pending(current)) {
> > -				res = -EINTR;
> > +				res = -ERESTARTNOHAND;
>
> This and other similar changes do look right.
>
> Say, sys_epoll_wait(). With this patch it can sleep, then return
> ERESTARTNOHAND.
>
> And we restart it with the same timeout again. If you want to
> make it restartable, you need ERESTART_RESTARTBLOCK and
> do_restart_epoll_wait() which we do not have.
>
> See for example sys_poll() which implements this logic.

But, to avoid the confusion, please note that this change won't
make it restartable wrt SA_RESTART. But it will help PTRACE_ATTACH
or PTRACE_INTERRUPT or other "spurious" signal.

We simply can't do this because there is no way to update
"timeout" later if the task actually returns to user-mode.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ