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]
Message-ID: <20210325182735.GA28349@redhat.com>
Date:   Thu, 25 Mar 2021 19:27:35 +0100
From:   Oleg Nesterov <oleg@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        linux-kernel@...r.kernel.org, adobriyan@...il.com,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Ingo Molnar <mingo@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [RFC][PATCH] task_struct::state frobbing

On 03/25, Peter Zijlstra wrote:
>
>  static void ptrace_unfreeze_traced(struct task_struct *task)
>  {
> -	if (task->state != __TASK_TRACED)
> +	if (READ_ONCE(task->__state) != __TASK_TRACED)
>  		return;

this change is correct,

> @@ -201,11 +201,11 @@ static void ptrace_unfreeze_traced(struct task_struct *task)
>  	 * Recheck state under the lock to close this race.
>  	 */
>  	spin_lock_irq(&task->sighand->siglock);
> -	if (task->state == __TASK_TRACED) {
> +	if (READ_ONCE(task->__state) == __TASK_TRACED) {

this too,

> @@ -240,7 +240,7 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
>  	 */
>  	read_lock(&tasklist_lock);
>  	if (child->ptrace && child->parent == current) {
> -		WARN_ON(child->state == __TASK_TRACED);
> +		WARN_ON(task_is_traced(child));
>  		/*
>  		 * child->sighand can't be NULL, release_task()
>  		 * does ptrace_unlink() before __exit_signal().
> @@ -257,7 +257,7 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
>  			 * ptrace_stop() changes ->state back to TASK_RUNNING,
>  			 * so we should not worry about leaking __TASK_TRACED.
>  			 */
> -			WARN_ON(child->state == __TASK_TRACED);
> +			WARN_ON(task_is_traced(child));


the two above are not.

"state == __TASK_TRACED" and task_is_traced() is not the same thing.

"state == __TASK_TRACED" means that debugger changed the state from TASK_TRACED
to __TASK_TRACED (iow, removed TASK_WAKEKILL) to ensure the tracee can not run,
this doesn't affect task_is_traced().

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ