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] [day] [month] [year] [list]
Message-ID: <aXJBf5mYUOFCli1P@smile.fi.intel.com>
Date: Thu, 22 Jan 2026 17:25:51 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Dmitry Antipov <dmantipov@...dex.ru>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Kees Cook <kees@...nel.org>,
	"Darrick J . Wong" <djwong@...nel.org>,
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH 1/2] lib/cmdline_kunit: add test case for memparse()

On Thu, Jan 22, 2026 at 06:00:43PM +0300, Dmitry Antipov wrote:
> On Thu, 2026-01-22 at 13:46 +0200, Andy Shevchenko wrote:
> 
> > Can we also have one with more than 20 decimal digits?
> 
> Hmmm... running simple userspace test,
> 
> strtoull("569202370375329612767", ...)
> 
> returns ULLONG_MAX (and sets errno to -ERANGE), but
> 
> memparse("569202370375329612767", ...)
> 
> seems blindly overflows to -2646695909666487329.
> 
> I'm strongly suspecting that 'memparse()' should be carefully
> tweaked to use 'kstrtoull()' instead of 'simple_strtoull()'.

It will require an intermediate buffer which your series is exactly against,
right? It's better to actually create a safe wrapper on top of
simple_strtoull().

The points are the following:
If there is a decimal base, we need to count leading 0:s.
Then add a check for how many characters were actually processed.

Partially something similar is done here:
drivers/crypto/intel/qat/qat_common/qat_uclo.c:206

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ