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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 18 May 2011 20:17:56 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	jan.kratochvil@...hat.com, vda.linux@...glemail.com,
	linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
	akpm@...ux-foundation.org, indan@....nu, bdonlan@...il.com
Subject: Re: [PATCH 03/10] ptrace: implement PTRACE_SEIZE

On 05/16, Tejun Heo wrote:
>
> @@ -315,6 +338,9 @@ static int ptrace_attach(struct task_struct *task)
>  	if (task_is_stopped(task)) {
>  		task->jobctl |= JOBCTL_TRAP_STOP | JOBCTL_TRAPPING;
>  		signal_wake_up(task, 1);
> +	} else if (seize) {
> +		task->jobctl |= JOBCTL_TRAP_STOP;

So, this can race with do_signal_stop(), it can clear TRAP_STOP and
JOBCTL_STOP_PENDING can guarantee the tracee will trap later.

> +	 * When PT_SEIZED, it's used for both group stop and explicit
> +	 * SEIZE/INTERRUPT traps.  Both generate PTRACE_EVENT_STOP trap
> +	 * with accompanying siginfo.
> +	 *
> +	 * When !PT_SEIZED, it's used only for group stop trap with
> +	 * CLD_STOPPED as exit_code and no siginfo.
>  	 */
>  	if (unlikely(current->jobctl & JOBCTL_TRAP_MASK)) {
> -		signr = current->jobctl & JOBCTL_STOP_SIGMASK;
> -		WARN_ON_ONCE(!signr);
> -		ptrace_stop(signr, CLD_STOPPED, 0, NULL);
> -		current->exit_code = 0;
> +		if (current->ptrace & PT_SEIZED) {
> +			ptrace_do_notify(SIGTRAP | PTRACE_EVENT_STOP << 8,
> +					 CLD_STOPPED);

So. When PT_SEIZED, we always report PTRACE_EVENT_STOP and PTRACE_GET_SIGINFO
always works.

Personally I agree, this looks more clean and natural.

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