[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190702193222.GP19023@42.do-not-panic.com>
Date: Tue, 2 Jul 2019 19:32:22 +0000
From: Luis Chamberlain <mcgrof@...nel.org>
To: Zhiqiang Liu <liuzhiqiang26@...wei.com>
Cc: Kees Cook <keescook@...omium.org>, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
ebiederm@...ssion.com, pbonzini@...hat.com,
viro@...iv.linux.org.uk, adobriyan@...il.com,
mingfangsen@...wei.com, wangxiaogang3@...wei.com,
"Zhoukang (A)" <zhoukang7@...wei.com>, netdev@...r.kernel.org
Subject: Re: [PATCH next] sysctl: add proc_dointvec_jiffies_minmax to limit
the min/max write value
On Tue, Jun 04, 2019 at 11:27:51PM +0800, Zhiqiang Liu wrote:
> > On Wed, May 15, 2019 at 10:53:55PM +0800, Zhiqiang Liu wrote:
> >>>> In proc_dointvec_jiffies func, the write value is only checked
> >>>> whether it is larger than INT_MAX. If the write value is less
> >>>> than zero, it can also be successfully writen in the data.
> >
> > This appears to be "be design", but I see many "unsigned int" users
> > that might be tricked into giant values... (for example, see
> > net/netfilter/nf_conntrack_standalone.c)
> >
> > Should proc_dointvec_jiffies() just be fixed to disallow negative values
> > entirely? Looking at the implementation, it seems to be very intentional
> > about accepting negative values.
> >
> > However, when I looked through a handful of proc_dointvec_jiffies()
> > users, it looks like they're all expecting a positive value. Many in the
> > networking subsystem are, in fact, writing to unsigned long variables,
> > as I mentioned.
> >
> I totally agree with you. And I also cannot find an scenario that expects
> negative values. Consideing the "negative" scenario may be exist, I add the
> proc_dointvec_jiffies_minmax like proc_dointvec_minmax.
If no negative values exist, and there is no real point to it, then just
rename the existing one and update the docs.
Luis
Powered by blists - more mailing lists