Re: [PATCH v2] module: check if memory leak by module.

2017-04-03 Thread Michal Hocko
On Fri 31-03-17 10:05:29, Joel Fernandes wrote: > On Fri, Mar 31, 2017 at 1:00 AM, Michal Hocko wrote: > > On Thu 30-03-17 23:49:52, Joel Fernandes wrote: > >> Hi Michal, > >> > >> On Wed, Mar 29, 2017 at 3:43 AM, Michal Hocko wrote: > >> > On Wed 29-03-17 09:23:32, Vaneet Narang wrote: > >> >> H

Re: [PATCH v2] module: check if memory leak by module.

2017-03-31 Thread Jessica Yu
+++ Vaneet Narang [29/03/17 09:23 +]: Hi, Hmm, how can you track _all_ vmalloc allocations done on behalf of the module? It is quite some time since I've checked kernel/module.c but from my vague understading your check is basically only about statically vmalloced areas by module loader. Is

Re: [PATCH v2] module: check if memory leak by module.

2017-03-31 Thread Joel Fernandes
On Fri, Mar 31, 2017 at 1:00 AM, Michal Hocko wrote: > On Thu 30-03-17 23:49:52, Joel Fernandes wrote: >> Hi Michal, >> >> On Wed, Mar 29, 2017 at 3:43 AM, Michal Hocko wrote: >> > On Wed 29-03-17 09:23:32, Vaneet Narang wrote: >> >> Hi, >> >> >> >> >> Hmm, how can you track _all_ vmalloc allocat

Re: [PATCH v2] module: check if memory leak by module.

2017-03-31 Thread Michal Hocko
On Thu 30-03-17 23:49:52, Joel Fernandes wrote: > Hi Michal, > > On Wed, Mar 29, 2017 at 3:43 AM, Michal Hocko wrote: > > On Wed 29-03-17 09:23:32, Vaneet Narang wrote: > >> Hi, > >> > >> >> Hmm, how can you track _all_ vmalloc allocations done on behalf of the > >> >> module? It is quite some ti

Re: [PATCH v2] module: check if memory leak by module.

2017-03-30 Thread Joel Fernandes
Hi Michal, On Wed, Mar 29, 2017 at 3:43 AM, Michal Hocko wrote: > On Wed 29-03-17 09:23:32, Vaneet Narang wrote: >> Hi, >> >> >> Hmm, how can you track _all_ vmalloc allocations done on behalf of the >> >> module? It is quite some time since I've checked kernel/module.c but >> >> from my vague un

Re: [PATCH v2] module: check if memory leak by module.

2017-03-30 Thread Andrey Ryabinin
On 03/30/2017 04:37 PM, Pavel Machek wrote: > >> 3) This might produce false positives. E.g. module may defer vfree() in >> workqueue, so the >> actual vfree() call happens after module unloaded. > > Umm. Really? > I should have been more specific. I meant vfree() called by module fr

Re: [PATCH v2] module: check if memory leak by module.

2017-03-30 Thread Pavel Machek
> 3) This might produce false positives. E.g. module may defer vfree() in > workqueue, so the > actual vfree() call happens after module unloaded. Umm. Really? I agree that module may alloc memory and pass it to someone else. Ok so far. But if module code executes after module is unloa

Re: [PATCH v2] module: check if memory leak by module.

2017-03-29 Thread Michal Hocko
On Wed 29-03-17 09:23:32, Vaneet Narang wrote: > Hi, > > >> Hmm, how can you track _all_ vmalloc allocations done on behalf of the > >> module? It is quite some time since I've checked kernel/module.c but > >> from my vague understading your check is basically only about statically > >> vmalloced

Re: [PATCH v2] module: check if memory leak by module.

2017-03-29 Thread Andrey Ryabinin
On 03/29/2017 09:02 AM, Maninder Singh wrote: > diff --git a/kernel/module.c b/kernel/module.c > index f953df9..98a8018 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -2117,9 +2117,31 @@ void __weak module_arch_freeing_init(struct module > *mod) > { > } > > +static void check_mem

Re: [PATCH v2] module: check if memory leak by module.

2017-03-29 Thread Vaneet Narang
Hi, >> Hmm, how can you track _all_ vmalloc allocations done on behalf of the >> module? It is quite some time since I've checked kernel/module.c but >> from my vague understading your check is basically only about statically >> vmalloced areas by module loader. Is that correct? If yes then is thi

Re: [PATCH v2] module: check if memory leak by module.

2017-03-29 Thread Miroslav Benes
On Wed, 29 Mar 2017, Michal Hocko wrote: > On Wed 29-03-17 11:32:02, Maninder Singh wrote: > > This patch checks if any module which is going to be unloaded > > is doing vmalloc memory leak or not. > > Hmm, how can you track _all_ vmalloc allocations done on behalf of the > module? It is quite so

Re: [PATCH v2] module: check if memory leak by module.

2017-03-29 Thread Michal Hocko
On Wed 29-03-17 11:32:02, Maninder Singh wrote: > This patch checks if any module which is going to be unloaded > is doing vmalloc memory leak or not. Hmm, how can you track _all_ vmalloc allocations done on behalf of the module? It is quite some time since I've checked kernel/module.c but from my

[PATCH v2] module: check if memory leak by module.

2017-03-28 Thread Maninder Singh
This patch checks if any module which is going to be unloaded is doing vmalloc memory leak or not. Logs:- [ 129.336368] Module [test_module] is getting unloaded before doing vfree [ 129.336371] Memory still allocated: addr:0xc90001461000 - 0xc900014c7000, pages 101 [ 129.336376] Alloca