lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 6 May 2013 12:03:54 +0400
From:	Andrew Vagin <avagin@...allels.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	Andrey Vagin <avagin@...nvz.org>, <linux-kernel@...r.kernel.org>,
	Roland McGrath <roland@...hat.com>,
	Michael Kerrisk <mtk.manpages@...il.com>,
	Pavel Emelyanov <xemul@...allels.com>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH] ptrace: add ability to get/set signal-blocked mask (v2)

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.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ