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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Feb 2009 21:45:48 +0200
From:	Pekka Enberg <penberg@...helsinki.fi>
To:	Hugh Dickins <hugh@...itas.com>
CC:	Matt Mackall <mpm@...enic.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	David Vrabel <david.vrabel@....com>,
	Johannes Weiner <hannes@...xchg.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Chas Williams <chas@....nrl.navy.mil>,
	Evgeniy Polyakov <johnpol@....mipt.ru>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Christoph Lameter <cl@...ux-foundation.org>,
	Nick Piggin <npiggin@...e.de>
Subject: Re: [patch 1/7] slab: introduce kzfree()

Hi Hugh.

Hugh Dickins wrote:
> Thanks for that, I remember it now.
> 
> Okay, that's some justification for kfree(const void *).
> 
> But I fail to see it as a justification for kzfree(const void *):
> if someone has "const char *string = kmalloc(size)" and then
> wants that string zeroed before it is freed, then I think it's
> quite right to cast out the const when calling kzfree().

Quite frankly, I fail to see how kzfree() is fundamentally different 
from kfree(). I don't see kzfree() as a memset() + kfree() but rather as 
a kfree() "and make sure no one sees my data". So the zeroing happens 
_after_ you've invalidated the pointer with kzfree() so there's no 
"zeroing of buffer going on". So the way I see it, Linus' argument for 
having const for kfree() applies to kzfree().

That said, if you guys think it's a merge blocker, by all means remove 
the const. I just want few less open-coded ksize() users, that's all.

			Pekka
--
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