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] [thread-next>] [day] [month] [year] [list]
Message-ID: <5845055F.2090203@huawei.com>
Date:   Mon, 5 Dec 2016 14:12:47 +0800
From:   Xishi Qiu <qiuxishi@...wei.com>
To:     "Eric W. Biederman" <ebiederm@...ssion.com>
CC:     Yisheng Xie <xieyisheng1@...wei.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        <linux-kernel@...r.kernel.org>, <acme@...hat.com>,
        <mgorman@...hsingularity.net>, <viro@...iv.linux.org.uk>,
        <hannes@...xchg.org>, <bristot@...hat.com>,
        <subashab@...eaurora.org>, <dcashman@...gle.com>, <w@....eu>,
        <arnd@...db.de>, <guohanjun@...wei.com>
Subject: Re: [PATCH] kernel/sysctl: return -EINVAL if write invalid val to
 ulong type sysctl

On 2016/12/3 3:24, Eric W. Biederman wrote:

> Yisheng Xie <xieyisheng1@...wei.com> writes:
> 
>> On 2016/12/1 5:33, Andrew Morton wrote:
>>> On Wed, 30 Nov 2016 18:30:52 +0800 Yisheng Xie <xieyisheng1@...wei.com> wrote:
>>>
>>>> I tried to echo an invalid value to an unsigned long type sysctl on
>>>> 4.9.0-rc6:
>>>>    linux:~# cat /proc/sys/vm/user_reserve_kbytes
>>>>    131072
>>>>    linux:~# echo -1 > /proc/sys/vm/user_reserve_kbytes
>>>>    linux:~# cat /proc/sys/vm/user_reserve_kbytes
>>>>    131072
>>>>
>>>> The echo operation got error and the value do not write to
>>>> user_reserve_kbytes, however, user do not know it until checking
>>>> the value again.
>>>>
>>>> This patch return -EINVAL when write an invalid value to unsigned
>>>> long type sysctl to make user know  what happened without
>>>> checking its value once more, just as what proc_douintvec do.
>>>
>>> hmpf.
>>>
>>> # echo 18446744073709551615  > /proc/sys/vm/user_reserve_kbytes                                             
>>> # cat /proc/sys/vm/user_reserve_kbytes
>>> 18446744073709551615
>>>
>>> I think that when taking in an unsigned long the kernel should simply
>>> treat -1 as 0xffffffff (or 0xffffffffffffffff).  It's natural and
>>> normal and everyone knows what it means?
>>>
>> Hi Andrew,
>> Thank you for your reply.
>> Do you means it should be like this:
>>   # echo -1 > /proc/sys/vm/user_reserve_kbytes
>>   # cat /proc/sys/vm/user_reserve_kbytes
>>   18446744073709551615
>>
>> I looks ok to me, however, I not sure whether other code in the kernel
>> will also use its complement if user write a negative number for an
>> unsigned long.  Does anyone have other opinion ?
> 
> Largely we need to be very careful with changing these functions as
> they have been around for a long time, and have a very diverse set of
> users.
> 
> So while changes are possible a reasonable argument needs to be made
> that nothing in userspace cares.
> 
> Eric
> 

Hi Eric,

This patch is aimed to change the return value if write invalid value to
ulong type sysctl, just to keep the same as int type sysctl.

Thanks,
Xishi Qiu

> .
> 



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ