From: Andrei Vagin <avagin@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK
Date: Mon, 26 Nov 2018 22:38:00 -0800 [thread overview]
Message-ID: <20181127063758.GA10422@gmail.com> (raw)
In-Reply-To: <20181122114751.GA28270@redhat.com>
On Thu, Nov 22, 2018 at 12:47:52PM +0100, Oleg Nesterov wrote:
> 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?
PTRACE_SETSIGMASK isn't used on restore. On restore, criu generates
sigframe and calls sigreturn to restore registers, fpu state, sigmask
and resume a process. When the kernel constructs a signal frame, it
calls sigmask_to_save() to get a process signal mask. With this patch,
PTRACE_GETSIGMASK returns the same signal mask what is returned by
sigmask_to_save().
In CRIU, we don't need to set TIF_RESTORE_SIGMASK, because all processes
are dumped when they are in user-space.
>
> IOW, could you please explain how PTRACE_SETSIGMASK should be used, and why
> it doesn't do something like
>
CRIU uses PTRACE_SETSIGMASK when it injects a parasite code into a
target process. In this case, we have to be sure that when the process
is resumed by PTRACE_CONT, it will not start handling signals and
executing signal handlers.
> if (test_tsk_restore_sigmask(child))
> child->saved_sigmask = new_set;
> else
> child->blocked = new_set;
>
> which looks symmetrical to PTRACE_GETSIGMASK?
If we set child->saved_sigmask, the child can start handling signals
which are not set in child->blocked.
>
> Oleg.
>
next prev parent reply other threads:[~2018-11-27 6:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 6:06 [PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK Andrei Vagin
2018-11-22 2:16 ` Andrew Morton
2018-11-29 18:05 ` [PATCH] include: replace tsk to task in linux/sched/signal.h Andrei Vagin
2019-02-02 10:04 ` [PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK Andrei Vagin
2018-11-22 11:47 ` Oleg Nesterov
2018-11-27 6:38 ` Andrei Vagin [this message]
2018-11-27 16:23 ` Oleg Nesterov
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=20181127063758.GA10422@gmail.com \
--to=avagin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox