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
| ||
|
Date: Mon, 4 Jun 2007 11:47:18 -0700 (PDT) From: Linus Torvalds <torvalds@...ux-foundation.org> To: Christoph Lameter <clameter@....com> cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org, Jeremy Fitzhardinge <jeremy@...p.org> Subject: Re: SLUB: Return ZERO_SIZE_PTR for kmalloc(0) On Fri, 1 Jun 2007, Christoph Lameter wrote: > > Instead of returning the smallest available object return ZERO_SIZE_PTR. Ok, I just noticed that this still has a bug: not just kfree(), but krealloc() needs to treat ZERO_SIZE_PTR properly. Your patch introduces two bugs in mm/slub.c:krealloc(): - The if (unlikely(!p)) return kmalloc(new_size, flags); test needs to be for NULL or ZERO_SIZE_PTR. Otherwise it will oops in ksize(p), I think. - And the if (unlikely(!new_size)) { kfree(p); return NULL; } thing should logically return ZERO_SIZE_PTR instead of NULL. So basically krealloc(kmalloc(0), n, flags); must work, and krealloc(old, 0, flags) should return a zero-sized allocation. I'd forgotten about krealloc(), because that whole concept is fairly new. Linus - 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