[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k26w0w6b.fsf@xmission.com>
Date: Fri, 07 Apr 2017 16:01:16 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Liping Zhang <zlpnobody@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
David Miller <davem@...emloft.net>,
Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Liping Zhang <zlpnobody@...il.com>
Subject: Re: [PATCH 3/3] sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
Linus Torvalds <torvalds@...ux-foundation.org> writes:
> On Fri, Apr 7, 2017 at 8:51 AM, Liping Zhang <zlpnobody@....com> wrote:
>> From: Liping Zhang <zlpnobody@...il.com>
>>
>> Currently, inputting the following command will succeed but actually the
>> value will be truncated:
>> # echo 0x12ffffffff > /proc/sys/net/ipv4/tcp_notsent_lowat
>>
>> This is not friendly to the user, so instead, we should report error
>> when the value is larger than UINT_MAX.
>
> I applied the two other patches, but I didn't apply this one.
>
> It's entirely possible that people end up doing something like
>
> echo -1 > /proc/sys/some_random_uint
>
> because that's a fairly normal thing to do to set all bits. Making
> that an error seems wrong.
Except that doesn't help in this case. The function do_uintvec_conv
rules already rejects all negative values on write. So -1 is already
rejected.
In fact the function proc_douintvec_conv has always rejected negative
values so this change won't even create a regression.
So it looks perfectly reasonable to reject values that are simply too
large to be written to the uint.
So even today to write all bits set you do have to do:
echo 0xffffffff > /proc/sys/some_random_uint
Eric
Powered by blists - more mailing lists