Re: [RFC][PATCH] x86: Verify access_ok() context

From: Thomas Gleixner
Date: Thu Jan 19 2017 - 13:46:19 EST


On Wed, 18 Jan 2017, David Smith wrote:
> On 01/16/2017 03:14 PM, Thomas Gleixner wrote:
> >> If you put that new access_ok() call in a module that gets
> >> loaded/unloaded, you see one warning for every module load, which gets a
> >> bit annoying.
> >
> > Can you please elaborate where this access_ok() is placed in the module
> > code?
>
> It doesn't really matter where you place the access_ok() call in the
> module code.

It does matter very much, because the fact that the warning triggers tells
me that it's placed in code which is NOT executed in task context.

> If you call access_ok() in a module, then that module has
> its own WARN_ON_ONCE() static variable. If access_ok() was a function
> exported from the kernel, then there would be only one copy of the
> WARN_ON_ONCE() static variable.

Not a big deal. If access_ok() is called from the wrong context in that
module then this should be fixed and not the warning supressed.

We are not papering over problems.

Thanks,

tglx