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: <1f027931-8781-4c6c-86c8-2d680b86974f@nfschina.com>
Date: Fri, 30 May 2025 18:29:27 +0800
From: Su Hui <suhui@...china.com>
To: Jeffrey E Altman <jaltman@...istor.com>, dhowells@...hat.com,
 marc.dionne@...istor.com
Cc: linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org,
 kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] afs: Replace simple_strtoul with kstrtoul in
 afs_parse_address

On 5/30/25 7:35 AM, Jeffrey E Altman wrote:
> On 5/27/2025 4:49 AM, Su Hui wrote:
>> kstrtoul() is better because simple_strtoul() ignores overflow which
>> may lead to unexpected results.
>>
>> Signed-off-by: Su Hui<suhui@...china.com>
>> ---
>>
> Su Hui,
>
> Thank you for the contribution but I do not believe this patch is 
> correct.
>
Oh, really sorry for my stupid mistake. Thanks for your review too :) .
> The second block is required even if the simple_stroul() is replaced 
> by kstrtoul() as it protects against an input string which does not 
> contain the optional subnet mask but has some other characters after 
> the address.
>
> afs_parse_address() already has its own overflow checks following the 
> simple_strtoul() call which is specific to the interpretation of the 
> allowed subnet mask values.
Agreed, it's my fault that I only see the pattern about 
'simple_strtoxx(....)' and 'if (*p)'.....
>
> Do you see an overflow condition which would not be caught by those 
> checks which would be caught by use of kstrtoul()?
Actually, no example in reality.
If p can equal to '0xffffffffffffffff0000000000000001', simple_strtoul() 
and kstroul() all transform 'p' to unsigned long value '0x1'.
But kstrtoul() return an error and we can know overflow happens.  If 'p' 
can be a very long string, kstroul() make sense.

Su Hui


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ