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]
Message-ID: <20090529115306.GA19812@redhat.com>
Date:	Fri, 29 May 2009 13:53:06 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Roland McGrath <roland@...hat.com>
Cc:	Christoph Hellwig <hch@...radead.org>, Ingo Molnar <mingo@...e.hu>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 4/12 v2] ptrace: introduce the empty "struct
	ptrace_context"

On 05/28, Roland McGrath wrote:
>
> > +	task_lock(tsk);
> > +	if (likely(!tsk->ptrace_ctx))
> > +		tsk->ptrace_ctx = ptrace_ctx;
> > +	else
> > +		kfree(ptrace_ctx);
> > +	task_unlock(tsk);
>
> I don't think it's kosher call kfree with task_lock() held.

Yes, it always makes sense to move as much as possible outside of
spin_lock/etc, but

> The kfree case is a very unlikely path,

Exactly, this kfree() "never" runs under task_lock(), but the code
looks a bit simpler and shorter.

> so it can be:
>
> 	task_lock(tsk);
> 	if (likely(!tsk->ptrace_ctx)) {
> 		tsk->ptrace_ctx = ptrace_ctx;
> 		task_unlock(tsk);
> 		return 0;
> 	}
>
> 	task_unlock(tsk);
> 	kfree(ptrace_ctx);

OK, will change.

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