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: <20070426102151.0da2e928@gondolin.boeblingen.de.ibm.com>
Date:	Thu, 26 Apr 2007 10:21:51 +0200
From:	Cornelia Huck <cornelia.huck@...ibm.com>
To:	Alan Stern <stern@...land.harvard.edu>
Cc:	Greg KH <greg@...ah.com>, Tejun Heo <htejun@...il.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>
Subject: Re: [PATCH RFD] alternative kobject release wait mechanism

On Wed, 25 Apr 2007 16:13:12 -0400 (EDT),
Alan Stern <stern@...land.harvard.edu> wrote:

> > Documentation/driver-model/lifetime-rules.txt?
> 
> When (if) such a file is added, it should contain more than just these few 
> paragraphs.

This file may be a good idea in general. I'll see if I can come up with
something useful.

> > The remove() method must also unset driver_data.
> 
> It doesn't really have to.  The driver core could do it.

I think it is more consistent if the driver takes care of the fields
specifically designed for its usage.

> It should never need to make that transition.  The only routines in the
> driver which get passed a pointer to the device (as opposed to a pointer
> to the private data) should be the methods called by the driver core or
> sysfs.  Neither will make any calls to the driver after remove() has
> returned, unless the driver does something wrong.

OK, thinko on my side.

> > Uhm. This would imply that a driver may never create a device itself.
> 
> A trivial omission on my part -- "The driver must also retain a module 
> reference to the owner of the device (unless the driver is itself the 
> device's owner)."
> 
> > However, the kobject->owner and module refcounting stuff should remove
> > this restriction.
> 
> If every driver follows this rule, we may not need the kobject->owner 
> stuff.  Although it wouldn't hurt to keep it for safety's sake.

I'm still concerned about that problem. It is that there is simply no
guarantee that everybody released their reference before the module's
exit function returned (the driver itself can and must assure that it
drops its last reference before it finishes exit, but it just can't
control who else holds a reference). I'm much in favour of adding a bit
of code than to risk oopses about which the driver can't do anything
itself (plus, the race exists now, but the immediate disconnect will
involve auditing all drivers).

> > > 		The driver must restrict itself to reading (not
> > > 		writing!) the fields in the device structure.  The
> > > 		only exception is that the driver may lock/unlock
> > > 		dev->sem.
> > 
> > And it may decrease the reference count, of course :)
> 
> :-)  Actually this should be a little more general, since the device will 
> generally be embedded in a larger structure created by the subsystem.  The 
> driver should also be able to acquire and release locks in that larger 
> structure.

Yes. Especially since the "gone"-field may be contained in that
embedding structure if the subsystem controls it.
-
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