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]
Date:	Thu, 8 Mar 2012 08:34:54 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Peter Seebach <peter.seebach@...driver.com>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Anton Blanchard <anton@...ba.org>, paulus@...ba.org,
	dsahern@...il.com, fweisbec@...il.com,
	yanmin_zhang@...ux.intel.com, emunson@...bm.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf: Incorrect use of snprintf results in SEGV


* Peter Zijlstra <peterz@...radead.org> wrote:

> On Wed, 2012-03-07 at 21:37 +0100, Ingo Molnar wrote:
> >         size_needed = snprintf_size(...);
> 
> This would require 3 passes over the fmt+args, first to find 
> the allocated size is insufficient, 2nd to compute the size, 
> 3rd to fill buffer.

No. The 1% case would use this separate API with its quirky 
return value. snprintf_size() works like today's snprintf, it's 
just *named* clearly to signal that it returns something not 
quite intuitive and results in bugs even in code that *tries* to 
be aware of the corner cases.

> Whereas with the current "creative" API only 2 passes are 
> needed.
> 
> I can imagine that back in the day of small memory and small 
> CPU this was deemed important enough.
> 
> Anyway, its all moot, this API exists and has been out in the 
> wild for several decades now, its not like we can actually 
> change it :-)

Of course it is moot - I am not arguing for a change in the API.

But the self-justification, as outlined in the mail I replied 
to, is brutally wrong, and nowhere in this discussion did I see 
the important notion mentioned that the *common case matters* - 
so maybe reading this will keep others from committing the same 
mistake, with newly introduced APIs.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ