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, 5 Jun 2013 18:13:59 +0200
From:	Willy Tarreau <w@....eu>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Luis Henriques <luis.henriques@...onical.com>,
	linux-kernel@...r.kernel.org, stable@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Colin King <colin.king@...onical.com>,
	Tim Gardner <tim.gardner@...onical.com>,
	John Johansen <john.johansen@...onical.com>
Subject: Re: [ 020/184] ptrace: ensure arch_ptrace/ptrace_request can never

Hi Oleg,

On Wed, Jun 05, 2013 at 05:49:51PM +0200, Oleg Nesterov wrote:
> On 06/05, Oleg Nesterov wrote:
> >
> > Note: I can make a _much_ simpler patch for 2.6.32, please let me know
> > if you need it.
> >
> > We can rely on sys_ptrace()->lock_kernel() and simply do lock/unlock
> > if fatal_signal_pending() in ptrace_stop/do_signal_stop. This is not
> > the same, this doesn't prevent wakeup(), but this should be enough.
> 
> Something like below. Untested/uncompiled. I think it should close the
> security problems.
> 
> Oleg.
> 
> 
> --- x/kernel/signal.c
> +++ x/kernel/signal.c
> @@ -1545,6 +1545,14 @@ static int sigkill_pending(struct task_s
>  		sigismember(&tsk->signal->shared_pending.signal, SIGKILL);
>  }
>  
> +static void ptrace_sync(void)
> +{
> +	if (fatal_signal_pending(current)) {
> +		lock_kernel();
> +		unlock_kernel();
> +	}
> +}
> +
>  /*
>   * This must be called with current->sighand->siglock held.
>   *
> @@ -1603,6 +1611,7 @@ static void ptrace_stop(int exit_code, i
>  		read_unlock(&tasklist_lock);
>  		preempt_enable_no_resched();
>  		schedule();
> +		ptrace_sync();
>  	} else {
>  		/*
>  		 * By the time we got the lock, our tracer went away.
> @@ -1722,6 +1731,9 @@ static int do_signal_stop(int signr)
>  		schedule();
>  	} while (try_to_freeze());
>  
> +	if (current->ptrace)
> +		ptrace_sync();
> +
>  	tracehook_finish_jctl();
>  	current->exit_code = 0;
>  

While I'm unable to tell whether the patch fixes the issue, I totally
trust you on this. So if you have the time to propose a tested patch
(or suggest me how to reliably test it), I'd gladly apply it instead.

Thanks!
Willy

--
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