[CRIU] [PATCH] criu: restore blocked signals correctly

Pavel Emelyanov xemul at parallels.com
Mon Oct 12 01:08:17 PDT 2015


On 10/12/2015 11:03 AM, Andrey Vagin wrote:
> 
> On Oct 12, 2015 10:50, "Pavel Emelyanov" <xemul at parallels.com <mailto:xemul at parallels.com>> wrote:
>>
>> On 10/09/2015 10:47 PM, Andrey Vagin wrote:
>> > From: Andrew Vagin <avagin at openvz.org <mailto:avagin at openvz.org>>
>> >
>> > We need to use SIG_SETMASK instead of SIG_BLOCK.
>>
>> Why?
>>
>> > SIG_SETMASK
>> >       The set of blocked signals is set to the argument set.
> 
> Because sig_setmask sets a specified mask, sig_blockmask adds signals from a specified mask to the current mask

Yes, that's clear. Why should we _set_ a specified mask, instead of _adding_ one?

>> >
>> > Signed-off-by: Andrew Vagin <avagin at openvz.org <mailto:avagin at openvz.org>>
>> > ---
>> >  namespaces.c | 2 +-
>> >  sysctl.c     | 2 +-
>> >  2 files changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/namespaces.c b/namespaces.c
>> > index 7d0690c..4233c59 100644
>> > --- a/namespaces.c
>> > +++ b/namespaces.c
>> > @@ -1201,7 +1201,7 @@ int stop_usernsd(void)
>> >                       ret = -1;
>> >
>> >               usernsd_pid = 0;
>> > -             sigprocmask(SIG_BLOCK, &oldmask, NULL);
>> > +             sigprocmask(SIG_SETMASK, &oldmask, NULL);
>> >
>> >               if (ret != 0)
>> >                       pr_err("UNS: daemon exited abnormally\n");
>> > diff --git a/sysctl.c b/sysctl.c
>> > index 7dd08ba..489c599 100644
>> > --- a/sysctl.c
>> > +++ b/sysctl.c
>> > @@ -314,7 +314,7 @@ static int __userns_sysctl_op(void *arg, int proc_fd, pid_t pid)
>> >               kill(worker, SIGKILL);
>> >               goto out;
>> >       }
>> > -     sigprocmask(SIG_BLOCK, &oldmask, NULL);
>> > +     sigprocmask(SIG_SETMASK, &oldmask, NULL);
>> >
>> >       if (!WIFEXITED(status) || WEXITSTATUS(status)) {
>> >               pr_err("worker failed: %d\n", status);
>> >
>>
> 



More information about the CRIU mailing list