linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()
@ 2018-10-15 19:27 Alexey Dobriyan
  2018-10-15 19:32 ` Christian Brauner
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2018-10-15 19:27 UTC (permalink / raw)
  To: christian; +Cc: linux-kernel

> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()
  2018-10-15 19:27 Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long() Alexey Dobriyan
@ 2018-10-15 19:32 ` Christian Brauner
  2018-10-15 21:15   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Brauner @ 2018-10-15 19:32 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: LKML, Eric W . Biederman, Luis R. Rodriguez, Andrew Morton,
	Joe Lawrence, Waiman Long, Dominik Brodowski, Al Viro, Kees Cook

On Mon, Oct 15, 2018 at 9:27 PM Alexey Dobriyan <adobriyan@gmail.com> 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 would care.

(Please keep the CC list when replying.)

Whatever works; I prefer the local strtoul_cap_erange() in kernel/sysctl.c as
well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long()
  2018-10-15 19:32 ` Christian Brauner
@ 2018-10-15 21:15   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2018-10-15 21:15 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Alexey Dobriyan, LKML, Eric W . Biederman, Luis R. Rodriguez,
	Andrew Morton, Joe Lawrence, Waiman Long, Dominik Brodowski,
	Al Viro

On Mon, Oct 15, 2018 at 12:32 PM, Christian Brauner
<christian@brauner.io> wrote:
> On Mon, Oct 15, 2018 at 9:27 PM Alexey Dobriyan <adobriyan@gmail.com> 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 would care.
>
> (Please keep the CC list when replying.)
>
> Whatever works; I prefer the local strtoul_cap_erange() in kernel/sysctl.c as
> well.

This does match the standard of "evolution" for the kernel: there is
only one user currently, so keep it a static in sysctl.c. If we grow a
greater need, we can move it into lib/.

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-15 21:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 19:27 Re: [PATCH v1 1/2] sysctl: cap to ULONG_MAX in proc_get_long() Alexey Dobriyan
2018-10-15 19:32 ` Christian Brauner
2018-10-15 21:15   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).