Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Rusty Russell
On Mon, 2007-03-19 at 13:21 +0300, Alexey Dobriyan wrote: > I very much agree with proto-patch which _copies_ all relevant > information into caller-supplied structure, keeping module_mutex private. > Time to split it sanely. Indeed. The current interface needs to be ripped apart and put

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Paulo Marques
Alexey Dobriyan wrote: On Sat, Mar 17, 2007 at 08:37:18PM +1100, Rusty Russell wrote: On Fri, 2007-03-16 at 12:51 +0100, Ingo Molnar wrote: [...] looking at the problem from another angle: wouldnt this be something that would benefit from freeze_processes()/unfreeze_processes(), and hence no

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Alexey Dobriyan
On Sat, Mar 17, 2007 at 08:37:18PM +1100, Rusty Russell wrote: > On Fri, 2007-03-16 at 12:51 +0100, Ingo Molnar wrote: > > * Alexey Dobriyan <[EMAIL PROTECTED]> wrote: > > > > > [cc'ing folks whose proc files are affected] > > > > > > kallsyms_lookup() can call module_address_lookup() which

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Alexey Dobriyan
On Fri, Mar 16, 2007 at 08:27:29PM +, Paulo Marques wrote: > Andrew Morton wrote: > >On Fri, 16 Mar 2007 17:16:39 + Paulo Marques <[EMAIL PROTECTED]> > >wrote: > > > >>Does freeze_processes() / unfreeze_processes() solve this by only > >>freezing processes that have voluntarily scheduled

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Alexey Dobriyan
On Fri, Mar 16, 2007 at 08:27:29PM +, Paulo Marques wrote: Andrew Morton wrote: On Fri, 16 Mar 2007 17:16:39 + Paulo Marques [EMAIL PROTECTED] wrote: Does freeze_processes() / unfreeze_processes() solve this by only freezing processes that have voluntarily scheduled (opposed to

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Alexey Dobriyan
On Sat, Mar 17, 2007 at 08:37:18PM +1100, Rusty Russell wrote: On Fri, 2007-03-16 at 12:51 +0100, Ingo Molnar wrote: * Alexey Dobriyan [EMAIL PROTECTED] wrote: [cc'ing folks whose proc files are affected] kallsyms_lookup() can call module_address_lookup() which iterates over

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Paulo Marques
Alexey Dobriyan wrote: On Sat, Mar 17, 2007 at 08:37:18PM +1100, Rusty Russell wrote: On Fri, 2007-03-16 at 12:51 +0100, Ingo Molnar wrote: [...] looking at the problem from another angle: wouldnt this be something that would benefit from freeze_processes()/unfreeze_processes(), and hence no

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-19 Thread Rusty Russell
On Mon, 2007-03-19 at 13:21 +0300, Alexey Dobriyan wrote: I very much agree with proto-patch which _copies_ all relevant information into caller-supplied structure, keeping module_mutex private. Time to split it sanely. Indeed. The current interface needs to be ripped apart and put together

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-17 Thread Rusty Russell
On Fri, 2007-03-16 at 12:51 +0100, Ingo Molnar wrote: > * Alexey Dobriyan <[EMAIL PROTECTED]> wrote: > > > [cc'ing folks whose proc files are affected] > > > > kallsyms_lookup() can call module_address_lookup() which iterates over > > modules list without module_mutex taken. Comment at the top

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-17 Thread Rusty Russell
On Fri, 2007-03-16 at 12:49 -0800, Andrew Morton wrote: > > Ok, I've just done a few tests with the attached patch. It basically > > creates a freeze_machine_run function that is equivalent in interface to > > stop_machine_run, but uses freeze_processes / thaw_processes to stop the > > machine.

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-17 Thread Rusty Russell
On Fri, 2007-03-16 at 14:44 +0300, Alexey Dobriyan wrote: > [cc'ing folks whose proc files are affected] > > kallsyms_lookup() can call module_address_lookup() which iterates over > modules list without module_mutex taken. Comment at the top of > module_address_lookup() says it's for oops

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-17 Thread Rusty Russell
On Fri, 2007-03-16 at 14:44 +0300, Alexey Dobriyan wrote: [cc'ing folks whose proc files are affected] kallsyms_lookup() can call module_address_lookup() which iterates over modules list without module_mutex taken. Comment at the top of module_address_lookup() says it's for oops resolution

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-17 Thread Rusty Russell
On Fri, 2007-03-16 at 12:51 +0100, Ingo Molnar wrote: * Alexey Dobriyan [EMAIL PROTECTED] wrote: [cc'ing folks whose proc files are affected] kallsyms_lookup() can call module_address_lookup() which iterates over modules list without module_mutex taken. Comment at the top of

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-17 Thread Rusty Russell
On Fri, 2007-03-16 at 12:49 -0800, Andrew Morton wrote: Ok, I've just done a few tests with the attached patch. It basically creates a freeze_machine_run function that is equivalent in interface to stop_machine_run, but uses freeze_processes / thaw_processes to stop the machine. I've

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Andrew Morton
On Fri, 16 Mar 2007 20:27:29 + Paulo Marques <[EMAIL PROTECTED]> wrote: > Andrew Morton wrote: > > On Fri, 16 Mar 2007 17:16:39 + Paulo Marques <[EMAIL PROTECTED]> wrote: > > > >> Does freeze_processes() / unfreeze_processes() solve this by only > >> freezing processes that have

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Paulo Marques
Andrew Morton wrote: On Fri, 16 Mar 2007 17:16:39 + Paulo Marques <[EMAIL PROTECTED]> wrote: Does freeze_processes() / unfreeze_processes() solve this by only freezing processes that have voluntarily scheduled (opposed to just being preempted)? It goes much much further than that.

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Andrew Morton
On Fri, 16 Mar 2007 17:16:39 + Paulo Marques <[EMAIL PROTECTED]> wrote: > Does freeze_processes() / unfreeze_processes() solve this by only > freezing processes that have voluntarily scheduled (opposed to just > being preempted)? It goes much much further than that. Those processes need

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Paulo Marques
Ingo Molnar wrote: * Paulo Marques <[EMAIL PROTECTED]> wrote: looking at the problem from another angle: wouldnt this be something that would benefit from freeze_processes()/unfreeze_processes(), and hence no locking would be required? I also considered this, but it seemed a little too

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Ingo Molnar
* Paulo Marques <[EMAIL PROTECTED]> wrote: > >looking at the problem from another angle: wouldnt this be something > >that would benefit from freeze_processes()/unfreeze_processes(), and > >hence no locking would be required? > > I also considered this, but it seemed a little too "blunt" to

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Paulo Marques
Ingo Molnar wrote: * Alexey Dobriyan <[EMAIL PROTECTED]> wrote: [cc'ing folks whose proc files are affected] kallsyms_lookup() can call module_address_lookup() which iterates over modules list without module_mutex taken. Comment at the top of module_address_lookup() says it's for oops

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Ingo Molnar
* Alexey Dobriyan <[EMAIL PROTECTED]> wrote: > [cc'ing folks whose proc files are affected] > > kallsyms_lookup() can call module_address_lookup() which iterates over > modules list without module_mutex taken. Comment at the top of > module_address_lookup() says it's for oops resolution so

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Ingo Molnar
* Alexey Dobriyan [EMAIL PROTECTED] wrote: [cc'ing folks whose proc files are affected] kallsyms_lookup() can call module_address_lookup() which iterates over modules list without module_mutex taken. Comment at the top of module_address_lookup() says it's for oops resolution so races are

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Paulo Marques
Ingo Molnar wrote: * Alexey Dobriyan [EMAIL PROTECTED] wrote: [cc'ing folks whose proc files are affected] kallsyms_lookup() can call module_address_lookup() which iterates over modules list without module_mutex taken. Comment at the top of module_address_lookup() says it's for oops

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Ingo Molnar
* Paulo Marques [EMAIL PROTECTED] wrote: looking at the problem from another angle: wouldnt this be something that would benefit from freeze_processes()/unfreeze_processes(), and hence no locking would be required? I also considered this, but it seemed a little too blunt to stop

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Paulo Marques
Ingo Molnar wrote: * Paulo Marques [EMAIL PROTECTED] wrote: looking at the problem from another angle: wouldnt this be something that would benefit from freeze_processes()/unfreeze_processes(), and hence no locking would be required? I also considered this, but it seemed a little too blunt to

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Andrew Morton
On Fri, 16 Mar 2007 17:16:39 + Paulo Marques [EMAIL PROTECTED] wrote: Does freeze_processes() / unfreeze_processes() solve this by only freezing processes that have voluntarily scheduled (opposed to just being preempted)? It goes much much further than that. Those processes need to

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Paulo Marques
Andrew Morton wrote: On Fri, 16 Mar 2007 17:16:39 + Paulo Marques [EMAIL PROTECTED] wrote: Does freeze_processes() / unfreeze_processes() solve this by only freezing processes that have voluntarily scheduled (opposed to just being preempted)? It goes much much further than that. Those

Re: [PATCH RESEND 2/2] Fix some kallsyms_lookup() vs rmmod races

2007-03-16 Thread Andrew Morton
On Fri, 16 Mar 2007 20:27:29 + Paulo Marques [EMAIL PROTECTED] wrote: Andrew Morton wrote: On Fri, 16 Mar 2007 17:16:39 + Paulo Marques [EMAIL PROTECTED] wrote: Does freeze_processes() / unfreeze_processes() solve this by only freezing processes that have voluntarily scheduled