On Mon, Jan 11, 2021 at 03:21:31PM +0100, Michal Hocko wrote:
> On Mon 11-01-21 11:48:19, Xiaoming Ni wrote:
> [...]
> > patch3:
> >     +++ b/fs/proc/proc_sysctl.c
> >     @@ -1770,6 +1770,9 @@ static int process_sysctl_arg(char *param, char 
> > *val,
> >                                                     return 0;
> >                     }
> > 
> >     +       if (!val)
> >     +               return -EINVAL;
> >     +
> >                     /*
> >                      * To set sysctl options, we use a temporary mount of 
> > proc, look up the
> >                      * respective sys/ file and write to it. To avoid 
> > mounting it when no
> > 
> > sysctl log for patch3:
> >     Setting sysctl args: `' invalid for parameter `hung_task_panic'
> [...]
> > When process_sysctl_arg() is called, the param parameter may not be the
> > sysctl parameter.
> > 
> > Patch3 or patch4, which is better?
> 
> Patch3

Oh, I see the issue here -- I thought we were only calling
process_sysctl_arg() with valid sysctl fields. It looks like we're not,
which means it should silently ignore everything that isn't a sysctl
field, and only return -EINVAL when it IS a sysctl but it lacks a value.

-- 
Kees Cook

Reply via email to