Re: [Bugme-new] [Bug 8957] New: Exported functions and variables should not be reachable by the outside of the module until module_init finishes

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

On Wed, 29 Aug 2007, Robert Hancock wrote:


Hmm, can you post some sample code / sample module to reproduce this?

I don't think exported symbols can be resolved till our module finishes
loading + initializing. There's a whole lot of dancing in the libusual
module precisely to cope with this behaviour.



See drivers/usb/storage/libusual.c -- pretty unusual goings on there :-)

It needs to request_module() another module (that will reference our
exported symbols). To cope with the fact that our exported modules
_cannot_ be resolved till we finish loading, it uses semaphore-used-as-
completion-handler kludge to let another "probe" kthread know when our
module_init() function is done, so that it can proceed to request_module()
the other module.

Interestingly, the kthread that request_module()s the other module is
spawned from the struct usb_driver ->probe() function (not an exported
function) and the claim there is that (1) usb_driver ->probe() can be
called out without the module_init() of libusual having finished, and,
(2) the newly requested module's loading will fail because it cannot
resolve libusual's exported symbols till we have finished module_init().


Satyam
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [Bugme-new] [Bug 8957] New: Exported functions and var ..., Satyam Sharma, (Thu Aug 30, 10:35 am)