lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202101111149.20A58E1@keescook>
Date:   Mon, 11 Jan 2021 11:50:49 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Michal Hocko <mhocko@...e.com>
Cc:     Xiaoming Ni <nixiaoming@...wei.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, mcgrof@...nel.org,
        yzaikin@...gle.com, adobriyan@...il.com,
        linux-fsdevel@...r.kernel.org, vbabka@...e.cz, wangle6@...wei.com
Subject: Re: [PATCH v2] proc_sysctl: fix oops caused by incorrect command
 parameters.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ