[CRIU] [PATCH] restorer: block signals before restoring SIGCHLD handler
Pavel Emelyanov
xemul at parallels.com
Fri Sep 20 12:05:01 EDT 2013
On 09/20/2013 07:09 PM, Andrew Vagin wrote:
> On Fri, Sep 20, 2013 at 06:59:33PM +0400, Pavel Emelyanov wrote:
>> On 09/20/2013 06:21 PM, Andrey Vagin wrote:
>>> Otherwise the process can handler this signal before calling sigreturn.
>>>
>>> And threads must block signals before switching on
>>> CR_STATE_RESTORE_SIGCHLD, because signals are restoring on this stage.
>>>
>>> So if a thread leader starts restoring shared signals before another
>>> thread has blocked signals, this thread can start to hadle the signal.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> The previous two lines describe the race
>
> __export_restore_task | __export_restore_thread
>
> restore_finish_stage(CR_STATE_RESTORE); | restore_finish_stage(CR_STATE_RESTORE);
> sys_sigaction(SIGCHLD, &args->sigchld_act, ...) |
> restore_signals() |
> ksigfillset(&to_block); |
> sys_rt_sigqueueinfo(sys_getpid(), ...); |
> | execute signal handler() <------ ALARM !!!
> | restore_signals()
> | ksigfillset(&to_block);
>
>>> I have seen this race in static/sigpending.
>>
>> What race? Plz, elaborate.
>
>>
>>> Signed-off-by: Andrey Vagin <avagin at openvz.org>
ok, applied
More information about the CRIU
mailing list