All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vagin <avagin@parallels.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Vagin <avagin@openvz.org>, <linux-kernel@vger.kernel.org>,
	Roland McGrath <roland@redhat.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH] ptrace: add ability to get/set signal-blocked mask (v2)
Date: Mon, 6 May 2013 12:03:54 +0400	[thread overview]
Message-ID: <20130506080354.GA25568@paralelels.com> (raw)
In-Reply-To: <20130423152143.GA30125@redhat.com>

Andrew, let me know if you are waiting something to accept this patch.

Thanks.

On Tue, Apr 23, 2013 at 05:21:43PM +0200, Oleg Nesterov wrote:
> On 04/23, Andrey Vagin wrote:
> >
> > @@ -841,6 +841,48 @@ int ptrace_request(struct task_struct *child, long request,
> >  			ret = ptrace_setsiginfo(child, &siginfo);
> >  		break;
> >  
> > +	case PTRACE_GETSIGMASK:
> > +		if (addr != sizeof(sigset_t)) {
> > +			ret = -EINVAL;
> > +			break;
> > +		}
> > +
> > +		if (copy_to_user(datavp, &child->blocked, sizeof(sigset_t)))
> > +			ret = -EFAULT;
> 
> Yes, we can do this lockless. Only the task itself (or the debugger with
> this patch) can change ->blocked, and the tracee can't run.
> 
> > +	case PTRACE_SETSIGMASK:
> > +	{
> > +		sigset_t new_set;
> > +
> > +		if (addr != sizeof(sigset_t)) {
> > +			ret = -EINVAL;
> > +			break;
> > +		}
> > +
> > +		if (copy_from_user(&new_set, datavp, sizeof(sigset_t))) {
> > +			ret = -EFAULT;
> > +			break;
> > +		}
> > +
> > +		sigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP));
> > +
> > +		/*
> > +		 * Every thread does recalc_sigpending() after resume, so
> > +		 * retarget_shared_pending() and recalc_sigpending() are not
> > +		 * called here.
> > +		 */
> > +		spin_lock_irq(&child->sighand->siglock);
> > +		child->blocked = new_set;
> > +		spin_unlock_irq(&child->sighand->siglock);
> > +
> > +		ret = 0;
> > +		break;
> > +	}
> 
> And this looks fine too.
> 
> Personally I am not sure we need to check addr == sizeof(), debugger
> should know what it does... But I won't argue.

We do the same thing in sys_rt_sigaction. I think it may be useful in a
future, if we decide to change the size of sigset_t.

> 
> Oleg.
> 

  reply	other threads:[~2013-05-06  8:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 15:10 [PATCH] ptrace: add ability to get/set signal-blocked mask (v2) Andrey Vagin
2013-04-23 15:21 ` Oleg Nesterov
2013-05-06  8:03   ` Andrew Vagin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-05-22 16:51 Andrey Vagin

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=20130506080354.GA25568@paralelels.com \
    --to=avagin@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@openvz.org \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=xemul@parallels.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.