linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andrei Vagin <avagin@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	linux-kernel@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [PATCH] ptrace: take into account saved_sigmask in PTRACE_{GET,SET}SIGMASK
Date: Wed, 21 Nov 2018 18:16:50 -0800	[thread overview]
Message-ID: <20181121181650.8d2d6abcf83b9defb7195cd3@linux-foundation.org> (raw)
In-Reply-To: <20181120060616.6043-1-avagin@gmail.com>

On Mon, 19 Nov 2018 22:06:16 -0800 Andrei Vagin <avagin@gmail.com> wrote:

> There are a few system calls (pselect, ppoll, etc) which replace a task
> sigmask while they are running in a kernel-space
> 
> When a task calls one of these syscalls, the kernel saves a current
> sigmask in task->saved_sigmask and sets a syscall sigmask.
> 
> On syscall-exit-stop, ptrace traps a task before restoring the
> saved_sigmask, so PTRACE_GETSIGMASK returns the syscall sigmask and
> PTRACE_SETSIGMASK does nothing, because its sigmask is replaced by
> saved_sigmask, when the task returns to user-space.
> 
> This patch fixes this problem. PTRACE_GET_SIGMASK returns saved_sigmask
> is it's set. PTRACE_SETSIGMASK drops the TIF_RESTORE_SIGMASK flag.

Looks good to me, but what would I know.  I'll await input from Eric
and/or Oleg (please).

> --- a/include/linux/sched/signal.h
> +++ b/include/linux/sched/signal.h
> @@ -417,10 +417,20 @@ static inline void set_restore_sigmask(void)
>  	set_thread_flag(TIF_RESTORE_SIGMASK);
>  	WARN_ON(!test_thread_flag(TIF_SIGPENDING));
>  }
> +
> +static inline void clear_tsk_restore_sigmask(struct task_struct *tsk)
> +{
> +	clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK);
> +}

How irritating is it that this file uses "task" 85 times and "tsk" 19
times?  What did that gain us?  This patch worsens things.

Oh well.

  reply	other threads:[~2018-11-22  2:16 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 [this message]
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
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=20181121181650.8d2d6abcf83b9defb7195cd3@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).