Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-11 Thread Kees Cook
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, > >

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-11 Thread Michal Hocko
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 (

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-10 Thread Xiaoming Ni
On 2021/1/9 9:50, Andrew Morton wrote: On Fri, 8 Jan 2021 21:10:25 +0100 Michal Hocko wrote: Why would that matter? A missing value is clearly a error path and it should be reported. This test is in the correct place. I think it's just a question of the return values. I was probably not cl

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-10 Thread Xiaoming Ni
On 2021/1/9 17:10, Andy Shevchenko wrote: On Friday, January 8, 2021, Xiaoming Ni > wrote: The process_sysctl_arg() does not check whether val is empty before  invoking strlen(val). If the command line parameter () is incorrectly  configured and val

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-08 Thread Andrew Morton
On Fri, 8 Jan 2021 21:10:25 +0100 Michal Hocko wrote: > > > Why would that matter? A missing value is clearly a error path and it > > > should be reported. > > > > This test is in the correct place. I think it's just a question of the > > return values. > > I was probably not clear. The test fo

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-08 Thread Michal Hocko
On Fri 08-01-21 11:56:33, Kees Cook wrote: > On Fri, Jan 08, 2021 at 12:47:18PM +0100, Michal Hocko wrote: > > On Fri 08-01-21 18:01:52, Xiaoming Ni wrote: > > > On 2021/1/8 17:21, Michal Hocko wrote: > > > > On Fri 08-01-21 10:33:39, Xiaoming Ni wrote: > > > > > The process_sysctl_arg() does not c

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-08 Thread Kees Cook
On Fri, Jan 08, 2021 at 12:47:18PM +0100, Michal Hocko wrote: > On Fri 08-01-21 18:01:52, Xiaoming Ni wrote: > > On 2021/1/8 17:21, Michal Hocko wrote: > > > On Fri 08-01-21 10:33:39, Xiaoming Ni wrote: > > > > The process_sysctl_arg() does not check whether val is empty before > > > > invoking s

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-08 Thread Michal Hocko
On Fri 08-01-21 18:01:52, Xiaoming Ni wrote: > On 2021/1/8 17:21, Michal Hocko wrote: > > On Fri 08-01-21 10:33:39, Xiaoming Ni wrote: > > > The process_sysctl_arg() does not check whether val is empty before > > > invoking strlen(val). If the command line parameter () is incorrectly > > > conf

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-08 Thread Xiaoming Ni
On 2021/1/8 17:21, Michal Hocko wrote: On Fri 08-01-21 10:33:39, Xiaoming Ni wrote: The process_sysctl_arg() does not check whether val is empty before invoking strlen(val). If the command line parameter () is incorrectly configured and val is empty, oops is triggered. For example, "hung_ta

Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-08 Thread Michal Hocko
On Fri 08-01-21 10:33:39, Xiaoming Ni wrote: > The process_sysctl_arg() does not check whether val is empty before > invoking strlen(val). If the command line parameter () is incorrectly > configured and val is empty, oops is triggered. > > For example, "hung_task_panic=1" is incorrectly written

[PATCH v2] proc_sysctl: fix oops caused by incorrect command parameters.

2021-01-07 Thread Xiaoming Ni
The process_sysctl_arg() does not check whether val is empty before invoking strlen(val). If the command line parameter () is incorrectly configured and val is empty, oops is triggered. For example, "hung_task_panic=1" is incorrectly written as "hung_task_panic". log: Kernel command lin