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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aV95h8JyKvGkDfBw@infradead.org>
Date: Thu, 8 Jan 2026 01:31:51 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Kees Cook <kees@...nel.org>
Cc: Dmitry Antipov <dmantipov@...dex.ru>, Carlos Maiolino <cem@...nel.org>,
	Christoph Hellwig <hch@...radead.org>,
	Andy Shevchenko <andy@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-xfs@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] lib: introduce simple error-checking wrapper for
 memparse()

On Wed, Jan 07, 2026 at 12:08:54PM -0800, Kees Cook wrote:
> On Wed, Jan 07, 2026 at 09:36:13PM +0300, Dmitry Antipov wrote:
> > Introduce 'memvalue()' which uses 'memparse()' to parse a string with
> > optional memory suffix into a number and returns this number or ULLONG_MAX
> > if the number is negative or an unrecognized character was encountered.
> 
> ULLONG_MAX is a valid address, though. I don't like this as an error
> canary. How about using __must_check with 0/negative return value and
> put the parsed value into a passed-by-reference variable instead? This
> has the benefit of also performing type checking on the variable so that
> a returned value can never be truncated accidentally:
> 
> 
> int __must_check memvalue(const char *ptr, unsigned long long *addr);

That does sound pretty nice as an API.  Should addr better be an
u64 instead of unsligned long long, though?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ