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: <20090504200925.GD31176@lenovo>
Date:	Tue, 5 May 2009 00:09:25 +0400
From:	Cyrill Gorcunov <gorcunov@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	cl@...ux.com, mingo@...e.hu, mel@....ul.ie,
	linux-kernel@...r.kernel.org, penberg@...helsinki.fi,
	riel@...hat.com, rientjes@...gle.com, xemul@...nvz.org
Subject: Re: [PATCH -tip] mm: introduce __GFP_PANIC modifier

[Andrew Morton - Mon, May 04, 2009 at 12:34:53PM -0700]
| On Mon, 4 May 2009 23:21:17 +0400
| Cyrill Gorcunov <gorcunov@...il.com> wrote:
| 
| > [Andrew Morton - Mon, May 04, 2009 at 11:53:35AM -0700]
| > | On Mon, 4 May 2009 09:47:45 -0400 (EDT)
| > | Christoph Lameter <cl@...ux.com> wrote:
| > | 
| > | > 
| > | > 
| > | > Could you try to avoid consuming another GFP flag? __GFP_BITS_SHIFT is
| > | > used elsewhere to figure out where to put miscellanous flags into the gfp
| > | > mask. This is pretty limited right now and so the patch does work.
| > | 
| > | hm, yes, there are seven bits left.
| > | 
| > | afaict bit 3 (0x08) is unused?
| > | 
| > | Is __GFP_PANIC very useful?  I expect it will permit a very small code
| > | saving at a relatively small number of callsites, all of which are
| > | __init anyway?
| > | 
| > 
| > Actually the issue with possible NULL deref already fixed in -tip
| > tree commit 9a8709d. There was rather an idea on what will be more
| > convenient -- call for __GFP_NOFAIL or use BUG_ON on allocation
| > failure or call kmalloc with __GFP_PANIC and forget about if it could
| > fail :). Since Christoph said that it's discommended to introduce
| > new flag -- I'm fine with that.
| > 
| 
| Well.  Allowing the caller to dereference the NULL pointer is a good
| solution.  It gives us the runtime behaviour we want, and requires no
| new code at all.  Usages of this technique should be commented so that
| people don't "fix" it.
| 
| 
| An alternative to __GFP_PANIC might be:
| 
| -	foo = kmalloc(size, GFP_KERNEL);
| +	foo = panic_if_null(kmalloc(size, GFP_KERNEL));
| 
| void *panic_if_null(void *p)
| {
| 	if (unlikely(p == NULL))
| 		panic("NULL pointer panic");
| 	return p;
| }
| 

Yes, it's simple and elegant but at this point I'm not
going to bring this one -- I could be just shot :)

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