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: <4C03932F.8000303@cesarb.net>
Date:	Mon, 31 May 2010 07:45:03 -0300
From:	Cesar Eduardo Barros <cesarb@...arb.net>
To:	Rusty Russell <rusty@...tcorp.com.au>
CC:	Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Russell King <linux@....linux.org.uk>,
	Ralf Baechle <ralf@...ux-mips.org>,
	David Howells <dhowells@...hat.com>,
	Koichi Yasutake <yasutake.koichi@...panasonic.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Paul Mackerras <paulus@...ba.org>,
	"David S. Miller" <davem@...emloft.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] Make kunmap_atomic() harder to misuse

Em 31-05-2010 07:15, Rusty Russell escreveu:
> On Sun, 30 May 2010 01:12:56 pm Andrew Morton wrote:
>> On Fri, 28 May 2010 07:53:13 -0300 Cesar Eduardo Barros<cesarb@...arb.net>  wrote:
>>> +/* Prevent people trying to call kunmap_atomic() as if it were kunmap() */
>>> +struct __kunmap_atomic_dummy {};
>>> +#define kunmap_atomic(addr, idx) do { \
>>> +		BUILD_BUG_ON( \
>>> +			__builtin_types_compatible_p(typeof(addr), struct page *)&&  \
>>> +			!__builtin_types_compatible_p(typeof(addr), struct __kunmap_atomic_dummy *)); \
>>> +		kunmap_atomic_notypecheck((addr), (idx)); \
>>> +	} while (0)
>>
>> We have a little __same_type() helper for this.  __must_be_array()
>> should be using it, too.
>
> Yep... but I think BUILD_BUG_ON(__same_type((addr), struct page *)); is
> sufficient; void * is not compatible in my quick tests here.

That is what I get for only reading the manual instead of testing :(

(I only tested the completed patch, not each step along the way.)

I will try it later today and make a new patch if it works as expected.

-- 
Cesar Eduardo Barros
cesarb@...arb.net
cesar.barros@...il.com
--
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