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:	Tue, 1 Apr 2008 14:38:11 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Christoph Lameter <clameter@....com>,
	Hugh Dickins <hugh@...itas.com>,
	Andrea Arcangeli <andrea@...ranet.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [patch 1/9] EMM Notifier: The notifier calls

On Tue, Apr 01, 2008 at 11:14:40PM +0200, Peter Zijlstra wrote:
> (Christoph, why are your CCs so often messed up?)
> 
> On Tue, 2008-04-01 at 13:55 -0700, Christoph Lameter wrote:
> > plain text document attachment (emm_notifier)
> 
> > +/* Register a notifier */
> > +void emm_notifier_register(struct emm_notifier *e, struct mm_struct *mm)
> > +{
> > +	e->next = mm->emm_notifier;
> > +	/*
> > +	 * The update to emm_notifier (e->next) must be visible
> > +	 * before the pointer becomes visible.
> > +	 * rcu_assign_pointer() does exactly what we need.
> > +	 */
> > +	rcu_assign_pointer(mm->emm_notifier, e);
> > +}
> > +EXPORT_SYMBOL_GPL(emm_notifier_register);
> > +
> > +/* Perform a callback */
> > +int __emm_notify(struct mm_struct *mm, enum emm_operation op,
> > +		unsigned long start, unsigned long end)
> > +{
> > +	struct emm_notifier *e = rcu_dereference(mm)->emm_notifier;
> > +	int x;
> > +
> > +	while (e) {
> > +
> > +		if (e->callback) {
> > +			x = e->callback(e, mm, op, start, end);
> > +			if (x)
> > +				return x;
> > +		}
> > +		/*
> > +		 * emm_notifier contents (e) must be fetched after
> > +		 * the retrival of the pointer to the notifier.
> > +		 */
> > +		e = rcu_dereference(e)->next;
> > +	}
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(__emm_notify);
> > +#endif
> 
> Those rcu_dereference()s are wrong. They should read:
> 
>   e = rcu_dereference(mm->emm_notifier);
> 
> and
> 
>   e = rcu_dereference(e->next);

Peter has it right.  You need to rcu_dereference() the same thing that
you rcu_assign_pointer() to.

							Thanx, Paul
--
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