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:	Fri, 02 Sep 2011 10:18:56 +0800
From:	Zhang Rui <rui.zhang@...el.com>
To:	Matt Fleming <matt@...sole-pimps.org>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Matthew Garrett <mjg59@...f.ucam.org>
Subject: Re: [PATCH] EFI: Do not use __pa() to get the physical address of
 an ioremapped memory range

On Thu, 2011-09-01 at 20:28 +0800, Matt Fleming wrote:
> On Thu, 2011-09-01 at 16:14 +0800, Zhang Rui wrote:
> > On Thu, 2011-09-01 at 14:55 +0800, Zhang, Rui wrote: 
> > > From: Zhang Rui <rui.zhang@...el.com>
> > > Date: Wed, 31 Aug 2011 09:59:01 +0800
> > > Subject: Do not use __pa() to get the physical address of an ioremapped memory range.
> > > 
> > > set_memory_uc uses __pa() to translate the virtual address to the physical address.
> > > This breaks a EFI_MEMORY_MAPPED_IO memory region in my case as it was ioremapped first.
> > > 
> > oops, wrong patch was attached.
> > 
> > here is the correct patch.
> > 
> > From: Zhang Rui <rui.zhang@...el.com>
> > Date: Wed, 31 Aug 2011 09:59:01 +0800
> > Subject: Do not use __pa() to get the physical address of an ioremapped memory range.
> > 
> > set_memory_uc uses __pa() to translate the virtual address to the physical address.
> > This breaks a EFI_MEMORY_MAPPED_IO memory region in my case as it was ioremapped first.
> 
> Hmm.. does anyone know why we ioremap_cache() the memory on
> CONFIG_X86_32 instead of ioremap_nocache()? 

Perhaps this is because not all the memory range need ioremap_nocache(),
e.g. EFI_BOOT_SERVICES_CODE, EFI_BOOT_SERVICES_DATA, etc?

So the current logic is to use ioremap_cache for all of them first, and
then set all the non-write-back memory ranges to uncacheable.

> In the case of
> EFI_MEMORY_MAPPED_IO the memory really needs to be uncached. Then if
> we've ioremap'd the memory we should skip set_memory_uc() altogether,
> no?
> 
In the beginning, I tried to fix efi_ioremap, i.e. use ioremap_nocache
for EFI_MEMORY_MAPPED_IO and ioremap_cache for others.
But I'm not sure if that is the right FIX, as I don't know if there
might be other memory ranges that also need to be set to uncached.

thanks,
rui

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