From: Oleg Nesterov <oleg@redhat.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>,
Anders Johansson <ajohansson@novell.com>,
David Miller <davem@davemloft.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Neil Horman <nhorman@tuxdriver.com>
Subject: Re: possible ERESTARTNOHAND leak into userspace
Date: Fri, 23 Dec 2011 16:02:27 +0100 [thread overview]
Message-ID: <20111223150227.GA27059@redhat.com> (raw)
In-Reply-To: <20111223131139.GA26157@tiehlicka.suse.cz>
On 12/23, Michal Hocko wrote:
>
> Hi,
> this has already been discussed few years back with reports that select
> returned with ERESTARTNOHAND in multi-threaded applications
> (http://forum.soft32.com/linux/PATCH-select-fix-sys_select-leak-ERESTARTNOHAND-userspace-ftopict338572.html)
>
> Dave has come up with a possible explanation of the race but there was
> no further follow up with a conclusion.
>
> Just for reference:
> Thread_A Thread_B
> CPU0 CPU1
> syscall_XYZ
> core_sys_select
> ret = -ERESTARTNOHAND;
> if (signal_pending(current))
> do_notify_resume
> do_signal (clear signal pending)
"clear signal pending" can't affect Thread_A. Even if it steals
the signal sent to Thread_A.
> return ret;
> return from syscall
> no pending signal
please see above. Only the task itself can clear its TIF_DIGPENDING.
> return ERESTARTNOHAND
do_signal() should take care and restart the syscall.
> The race window is rather small and hard to trigger but we have seen
> reports where people really saw select returning ERESTARTNOHAND (on
> 2.6.16 based kernel - x86_64).
> I am not able to reproduce that myself neither with .16 kernel nor with
> the current vanilla so I am not sure whether the problem has been fixed
> already. But I do not see what prevents the race with vanilla.
I hope the problem was already fixed, at least I do not see anything
wrong in core_sys_select().
Oleg.
next prev parent reply other threads:[~2011-12-23 15:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 13:11 possible ERESTARTNOHAND leak into userspace Michal Hocko
2011-12-23 15:02 ` Oleg Nesterov [this message]
2011-12-23 16:16 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111223150227.GA27059@redhat.com \
--to=oleg@redhat.com \
--cc=ajohansson@novell.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.cz \
--cc=nhorman@tuxdriver.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.