Re: Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Kees Cook
On Mon, Oct 15, 2018 at 12:32 PM, Christian Brauner wrote: > On Mon, Oct 15, 2018 at 9:27 PM Alexey Dobriyan wrote: >> >> > int kstrtoul_bounded(const char *s, unsigned int base, >> > char **trailing, unsigned long long *res) >> >> NO! The whole point is not have million variants of slightly diff

Re: Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Christian Brauner
On Mon, Oct 15, 2018 at 9:27 PM Alexey Dobriyan wrote: > > > int kstrtoul_bounded(const char *s, unsigned int base, > > char **trailing, unsigned long long *res) > > NO! The whole point is not have million variants of slightly different > integer parsing functions. > Cap it in the sysctl -- noone

Re: Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Alexey Dobriyan
> int kstrtoul_bounded(const char *s, unsigned int base, > char **trailing, unsigned long long *res) NO! The whole point is not have million variants of slightly different integer parsing functions. Cap it in the sysctl -- noone would care.

Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Christian Brauner
On Mon, Oct 15, 2018 at 6:30 PM Christian Brauner wrote: > > On Mon, Oct 15, 2018 at 09:18:40AM -0700, Kees Cook wrote: > > On Mon, Oct 15, 2018 at 3:55 AM, Christian Brauner > > wrote: > > > proc_get_long() is a funny function. It uses simple_strtoul() and for a > > > good reason. proc_get_long

Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Christian Brauner
On Mon, Oct 15, 2018 at 09:18:40AM -0700, Kees Cook wrote: > On Mon, Oct 15, 2018 at 3:55 AM, Christian Brauner > wrote: > > proc_get_long() is a funny function. It uses simple_strtoul() and for a > > good reason. proc_get_long() wants to always succeed the parse and return > > the maybe incorrec

Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Kees Cook
On Mon, Oct 15, 2018 at 3:55 AM, Christian Brauner wrote: > proc_get_long() is a funny function. It uses simple_strtoul() and for a > good reason. proc_get_long() wants to always succeed the parse and return > the maybe incorrect value and the trailing characters to check against a > pre-defined l

[PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()

2018-10-15 Thread Christian Brauner
proc_get_long() is a funny function. It uses simple_strtoul() and for a good reason. proc_get_long() wants to always succeed the parse and return the maybe incorrect value and the trailing characters to check against a pre-defined list of acceptable trailing values. However, simple_strtoul() explic