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, 07 Jul 2009 14:21:33 +0100
From:	David Howells <dhowells@...hat.com>
To:	Gregory Haskins <ghaskins@...ell.com>
Cc:	dhowells@...hat.com, linux-kernel@...r.kernel.org, mst@...hat.com,
	swhiteho@...hat.com
Subject: Re: [PATCH v4] slow-work: add (module*)work->ops->owner to fix races with module clients

Gregory Haskins <ghaskins@...ell.com> wrote:

> +	struct module *owner = work->ops->owner;
> +
> +	work->ops->put_ref(work);
> +	module_put(owner);

Hmmm...  There needs to be an smp_mb() between the read of the module owner
and the call to put_ref(), lest the CPU reorder things...  However, if
put_ref(), say, calls atomic_dec_and_test(), then inserting one here would be
superfluous.

I think documenting this will be enough - perhaps something like:

 (*) Release a reference on an item:

	void (*put_ref)(struct slow_work *work);

     This allows the thread pool to unpin an item by releasing the reference on
     it.  The thread pool will not touch the item again once this has been
     called.

     This function must interpolate a general SMP memory barrier before freeing
     or re-using the work struct as the caller may have read the module
     pointer.  Implying a barrier with something like atomic_dec_and_test() is
     sufficient.

Do you agree?

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