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:	Sun, 27 Nov 2011 10:34:06 -0200
From:	Cesar Eduardo Barros <cesarb@...arb.net>
To:	Cong Wang <amwang@...hat.com>
CC:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	Nick Bowler <nbowler@...iptictech.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Christoph Lameter <cl@...ux.com>, Tejun Heo <tj@...nel.org>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 01/62] highmem: mark k[un]map_atomic() with two arguments
 as deprecated

Em 27-11-2011 03:26, Cong Wang escreveu:
>   /*
>    * Prevent people trying to call kunmap_atomic() as if it were kunmap()
>    * kunmap_atomic() should get the return value of kmap_atomic, not the page.
>    */
> -#define kunmap_atomic(addr, args...)				\
> -do {								\
> -	BUILD_BUG_ON(__same_type((addr), struct page *));	\
> -	__kunmap_atomic(addr);					\
> -} while (0)
> +static inline void kunmap_atomic(void *addr)
> +{
> +	BUILD_BUG_ON(__same_type((addr), struct page *));
> +	__kunmap_atomic(addr);
> +}
> +
> +static inline void __deprecated kunmap_atomic_deprecated(void *addr,
> +							enum km_type km)
> +{
> +	BUILD_BUG_ON(__same_type((addr), struct page *));
> +	__kunmap_atomic(addr);
> +}

This will break the misuse detection of kunmap_atomic (see commit 
597781f3e51f48ef8e67be772196d9e9673752c4).

kunmap_atomic() _must_ be a macro, so the __same_type can see the type 
the caller used. If you use an inline function, all it will see is a 
void *, even if the caller confused it with kunmap() and passed a struct 
page *.

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