[CRIU] [PATCH 2/7] parasite: Rework init to be able to handle per-threads data
Pavel Emelyanov
xemul at parallels.com
Tue Nov 6 05:12:24 EST 2012
On 11/06/2012 01:49 PM, Cyrill Gorcunov wrote:
> On Tue, Nov 06, 2012 at 01:35:13PM +0400, Pavel Emelyanov wrote:
>> On 11/06/2012 01:04 PM, Cyrill Gorcunov wrote:
>>> On Tue, Nov 06, 2012 at 01:01:59PM +0400, Pavel Emelyanov wrote:
>>>>> static int fini(void)
>>>>> {
>>>>> - if (reset_blocked == 1)
>>>>> - sys_sigprocmask(SIG_SETMASK, &old_blocked, NULL, sizeof(k_rtsigset_t));
>>>>> + int ret = 0, i;
>>>>> +
>>>>> + for (i = 0; i < nr_tid_state; i++) {
>>>>> + if (tid_state[i].use_sig_blocked) {
>>>>> + ret |= sys_sigprocmask(SIG_SETMASK, &tid_state[i].sig_blocked,
>>>>> + NULL, sizeof(k_rtsigset_t));
>>>>> + }
>>>>
>>>> WTF is that???
>>>
>>> We need to restore original mask once parasite is fini'ting, of course
>>> for all threads which we have.
>>
>> And why doing this in the context of one of them is correct?
>
> Say problem is happened on the last thread in a group. Thus our main
> crtools code will return error in parasite_init_threads_seized() which
> triggers "cure" code to start executing. Finally the fini() will be called
> in parasite code and then all previous threads which were successfully
> blocked are to be restored here. Or you mean something else?
I do. sigprocmask(SIG_SETMASK) should be called by every thread for himself,
not by master thread for everyone.
More information about the CRIU
mailing list