Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-08 Thread Michal Hocko
On Wed 08-11-17 07:21:20, Kees Cook wrote: > On Tue, Nov 7, 2017 at 11:43 PM, Vlastimil Babka wrote: > > On 11/07/2017 10:38 PM, Kees Cook wrote: [...] > >> +static DEFINE_MUTEX(vm_numa_stat_lock); > >> + > >> int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write, >

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-08 Thread Michal Hocko
On Wed 08-11-17 07:21:20, Kees Cook wrote: > On Tue, Nov 7, 2017 at 11:43 PM, Vlastimil Babka wrote: > > On 11/07/2017 10:38 PM, Kees Cook wrote: [...] > >> +static DEFINE_MUTEX(vm_numa_stat_lock); > >> + > >> int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write, > >>

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-08 Thread Kees Cook
On Tue, Nov 7, 2017 at 11:43 PM, Vlastimil Babka wrote: > On 11/07/2017 10:38 PM, Kees Cook wrote: >> The mutex in sysctl_vm_numa_stat_handler() needs to be a global static, not >> a stack variable, otherwise it doesn't serve any purpose. Also, reading the >> file with

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-08 Thread Kees Cook
On Tue, Nov 7, 2017 at 11:43 PM, Vlastimil Babka wrote: > On 11/07/2017 10:38 PM, Kees Cook wrote: >> The mutex in sysctl_vm_numa_stat_handler() needs to be a global static, not >> a stack variable, otherwise it doesn't serve any purpose. Also, reading the >> file with CONFIG_LOCKDEP=y will

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-08 Thread Michal Hocko
On Wed 08-11-17 08:43:44, Vlastimil Babka wrote: > On 11/07/2017 10:38 PM, Kees Cook wrote: [...] > > +static DEFINE_MUTEX(vm_numa_stat_lock); > > + > > int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write, > > void __user *buffer, size_t *length, loff_t *ppos) > > { >

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-08 Thread Michal Hocko
On Wed 08-11-17 08:43:44, Vlastimil Babka wrote: > On 11/07/2017 10:38 PM, Kees Cook wrote: [...] > > +static DEFINE_MUTEX(vm_numa_stat_lock); > > + > > int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write, > > void __user *buffer, size_t *length, loff_t *ppos) > > { >

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-07 Thread Vlastimil Babka
On 11/07/2017 10:38 PM, Kees Cook wrote: > The mutex in sysctl_vm_numa_stat_handler() needs to be a global static, not > a stack variable, otherwise it doesn't serve any purpose. Also, reading the > file with CONFIG_LOCKDEP=y will complain: Oops, good catch. > [ 63.258593] INFO: trying to

Re: [PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-07 Thread Vlastimil Babka
On 11/07/2017 10:38 PM, Kees Cook wrote: > The mutex in sysctl_vm_numa_stat_handler() needs to be a global static, not > a stack variable, otherwise it doesn't serve any purpose. Also, reading the > file with CONFIG_LOCKDEP=y will complain: Oops, good catch. > [ 63.258593] INFO: trying to

[PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-07 Thread Kees Cook
The mutex in sysctl_vm_numa_stat_handler() needs to be a global static, not a stack variable, otherwise it doesn't serve any purpose. Also, reading the file with CONFIG_LOCKDEP=y will complain: [ 63.258593] INFO: trying to register non-static key. [ 63.259113] the code is fine but needs

[PATCH] mm, vmstat: Make sure mutex is a global static

2017-11-07 Thread Kees Cook
The mutex in sysctl_vm_numa_stat_handler() needs to be a global static, not a stack variable, otherwise it doesn't serve any purpose. Also, reading the file with CONFIG_LOCKDEP=y will complain: [ 63.258593] INFO: trying to register non-static key. [ 63.259113] the code is fine but needs