Re: [PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK

From: Oleg Nesterov
Date: Thu Nov 22 2018 - 06:47:57 EST


On 11/19, Andrei Vagin wrote:
>
> case PTRACE_SETSIGMASK: {
> sigset_t new_set;
> @@ -962,6 +971,8 @@ int ptrace_request(struct task_struct *child, long request,
> child->blocked = new_set;
> spin_unlock_irq(&child->sighand->siglock);
>
> + clear_tsk_restore_sigmask(child);
> +

I am not sure I understand this change...

I forgot everything I knew about criu, but iiuc PTRACE_SETSIGMASK is used
at "restore" time, doesn't this mean that TIF_RESTORE_SIGMASK/restore_sigmask
can not be set?

IOW, could you please explain how PTRACE_SETSIGMASK should be used, and why
it doesn't do something like

if (test_tsk_restore_sigmask(child))
child->saved_sigmask = new_set;
else
child->blocked = new_set;

which looks symmetrical to PTRACE_GETSIGMASK?

Oleg.