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] [day] [month] [year] [list]
Date:	Mon, 3 Mar 2008 11:21:56 +0100
From:	Fabio Checconi <fchecconi@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Arjan van de Ven <arjan@...ux.intel.com>,
	Gabriel C <nix.or.die@...glemail.com>,
	Laurent Riffard <laurent.riffard@...e.fr>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Stuart Bennett <sb476@....ac.uk>,
	Len Brown <lenb@...nel.org>, tglx@...utronix.de,
	mingo@...hat.com
Subject: Re: 2.6.25-rc2-mm1: WARNING at arch/x86/mm/ioremap.c:129

> From: Ingo Molnar <mingo@...e.hu>
> Date: Mon, Mar 03, 2008 09:46:11AM +0100
>
...
> Subject: x86: warn about RAM pages in ioremap()
> From: Ingo Molnar <mingo@...e.hu>
> Date: Mon Mar 03 09:37:41 CET 2008
> 
> Signed-off-by: Ingo Molnar <mingo@...e.hu>
> ---
>  arch/x86/mm/ioremap.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Index: linux-x86.q/arch/x86/mm/ioremap.c
> ===================================================================
> --- linux-x86.q.orig/arch/x86/mm/ioremap.c
> +++ linux-x86.q/arch/x86/mm/ioremap.c
> @@ -149,9 +149,11 @@ static void __iomem *__ioremap(unsigned 
>  	for (pfn = phys_addr >> PAGE_SHIFT;
>  				(pfn << PAGE_SHIFT) < last_addr; pfn++) {
>  
> -		if (page_is_ram(pfn) && pfn_valid(pfn) &&
> -		    !PageReserved(pfn_to_page(pfn)))
> +		int is_ram = page_is_ram(pfn);
> +
> +		if (is_ram && pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
>  			return NULL;
> +		WARN_ON_ONCE(is_ram);
>  	}
>  
>  	switch (mode) {

In this way we can emit the warning even for pages that will not
be mapped, if asked for more than one page (e.g., one page triggers
the warning, one of the following triggers the return NULL condition,)
I don't think that would be useful, as the caller will notice the
error anyway.

I don't know if it's so important, but while we're at it, please
consider that, if last_addr % PAGE_SIZE == 0 the for loop exits
without checking the last pfn, that will be mapped.

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