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: <5d38ad4fa77fc9c3c6a0c28d649d852ee889a172.camel@yandex.ru>
Date: Thu, 08 Jan 2026 16:14:35 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Carlos Maiolino <cem@...nel.org>, Christoph Hellwig <hch@...radead.org>,
  Kees Cook <kees@...nel.org>, Andy Shevchenko <andy@...nel.org>,
 linux-xfs@...r.kernel.org, 	linux-hardening@...r.kernel.org
Subject: Re: [PATCH] lib: introduce simple error-checking wrapper for
 memparse()

On Wed, 2026-01-07 at 10:48 -0800, Andrew Morton wrote:

> I'm not understanding why negative numbers get this treatment - could
> you please add the reasoning to the code comment?

Hm. I suppose that memvalue() may (and hopefully will) be used to parse
and return an amount of "actually used" (for some particular task) memory,
allowing 0 with possible "use some default value" treatment in the caller.
Negative values just introduces some confusion (and possible weird effects
caused by an erroneous conversion of negative values to huge positive ones). 
If someone needs some special treatment of, say, "memsize=-32M" somewhere,
there should be a kind of an extra handling beyond memvalue(). 

> Presumably it's because memvalue() returns ULL, presumably because
> memparse() returns ULL?  Maybe that's all wrong, and memparse() should
> have returned LL - negative numbers are a bit odd, but why deny that
> option.  With the new memvalue() we get to partially address that?

I would rather try

int __must_check memvalue(const char *ptr, unsigned long long *addr);

as suggested by Kees. 

Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ