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: <Pine.LNX.4.64.1101081340250.1879@hs20-bc2-1.build.redhat.com>
Date:	Sat, 8 Jan 2011 13:50:50 -0500 (EST)
From:	Mikulas Patocka <mpatocka@...hat.com>
To:	Kay Sievers <kay.sievers@...y.org>
cc:	Greg KH <gregkh@...e.de>, linux-kernel@...r.kernel.org,
	dm-devel@...hat.com
Subject: Re: kobject_put vs module unload



On Sat, 8 Jan 2011, Kay Sievers wrote:

> On Sat, Jan 8, 2011 at 19:01, Mikulas Patocka <mpatocka@...hat.com> wrote:
> > On Sat, 8 Jan 2011, Kay Sievers wrote:
> >> On Sat, Jan 8, 2011 at 14:19, Mikulas Patocka <mpatocka@...hat.com> wrote:
> >> > On Fri, 7 Jan 2011, Greg KH wrote:
> >>
> >> >> > 4) the reference obtained at point 1) is dropped, kobject reference count
> >> >> > reaches zero and the release callback is called. But that callback points
> >> >> > to an unloaded module and causes a crash.
> >> >> >
> >> >> > How is it solved? Am I missing something?
> >> >>
> >> >> You have the code that creates and frees the object, to not be in the
> >> >> module that could have been unloaded.  It's really just that simple.
> >> >
> >> > If the whole device mapper subsystem can be a module, where can I put the
> >> > code?
> >> >
> >> > I think a similar bug exists in md, it can also be unloaded as a module
> >> > and it has "release" method in its module code.
> >>
> >> If you still have data structures hanging around, these structures are
> >> supposed to take a reference on the module -- and you can not unload
> >> the module as long as this is the case.
> >>
> >> Kay
> >
> > kobject references don't increase module reference count. If kobject held
> > module references, it would be a fix for this bug, but could cause other
> > bugs (some modules could be unloadable due to self-references to its own
> > kobjects).
> 
> Sure, they don't automatically take references. It's the job of the
> driver/module, to make sure to pin the module for any data of it,
> which might be still in use.
> 
> Kay

A module can't unpin itself. If it does, the module can be unloaded 
immediatelly after module_put(THIS_MODULE) call and the function that 
called module_put crashes.

A module must be unpinned by someone else. The question is: who unpins the 
module when kobject references are gone?

Mikulas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ