[patch 38/38] x86_64: CPA, fix cache attribute inconsistency bug

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg KH
Date: Friday, February 22, 2008 - 5:31 pm

2.6.24-stable review patch.  If anyone has any objections, please let us
know.

------------------
From: Ingo Molnar <mingo@elte.hu>

(no matching git id as the upstream code is rewritten)

fix CPA cache attribute bug in v2.6.24. When phys_base is nonzero (when 
CONFIG_RELOCATABLE=y) then change_page_attr_addr() miscalculates the 
secondary alias address by -14 MB (depending on the configured offset).

The default 64-bit kernels of Fedora and Ubuntu are affected:

   $ grep RELOCA /boot/config-2.6.23.9-85.fc8
     CONFIG_RELOCATABLE=y

   $ grep RELOC /boot/config-2.6.22-14-generic
     CONFIG_RELOCATABLE=y

and probably on many other distros as well.

the bug affects all pages in the first 40 MB of physical RAM that
are allocated by some subsystem that does ioremap_nocache() on them:

       if (__pa(address) < KERNEL_TEXT_SIZE) {

Hence we might leave page table entries with inconsistent cache
attributes around (pages mapped at both UnCacheable and Write-Back),
and we can also set the wrong kernel text pages to UnCacheable.

the effects of this bug can be random slowdowns and other misbehavior.
If for example AGP allocates its aperture pages into the first 40 MB
of physical RAM, then the -14 MB bug might mark random kernel texto
pages as uncacheable, slowing down a random portion of the 64-bit
kernel until the AGP driver is unloaded.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/mm/pageattr_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/x86/mm/pageattr_64.c
+++ b/arch/x86/mm/pageattr_64.c
@@ -207,7 +207,7 @@ int change_page_attr_addr(unsigned long 
 		if (__pa(address) < KERNEL_TEXT_SIZE) {
 			unsigned long addr2;
 			pgprot_t prot2;
-			addr2 = __START_KERNEL_map + __pa(address);
+			addr2 = __START_KERNEL_map + __pa(address) - phys_base;
 			/* Make sure the kernel mappings stay executable */
 			prot2 = pte_pgprot(pte_mkexec(pfn_pte(0, prot)));
 			err = __change_page_attr(addr2, pfn, prot2,

-- 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 00/38] 2.6.24-stable review, Greg KH, (Fri Feb 22, 5:29 pm)
[patch 08/38] Fix dl2k constants, Greg KH, (Fri Feb 22, 5:30 pm)
[patch 11/38] TC: oops in em_meta, Greg KH, (Fri Feb 22, 5:30 pm)
[patch 32/38] USB: fix pm counter leak in usblp, Greg KH, (Fri Feb 22, 5:31 pm)
[patch 33/38] SCSI: gdth: scan for scsi devices, Greg KH, (Fri Feb 22, 5:31 pm)
[patch 38/38] x86_64: CPA, fix cache attribute inconsisten ..., Greg KH, (Fri Feb 22, 5:31 pm)
Re: [patch 34/38] kbuild: allow -fstack-protector to take ..., Arjan van de Ven, (Fri Feb 22, 5:46 pm)
Re: [patch 33/38] SCSI: gdth: scan for scsi devices, Boaz Harrosh, (Fri Feb 22, 8:02 pm)
Re: [patch 33/38] SCSI: gdth: scan for scsi devices, James Bottomley, (Fri Feb 22, 9:15 pm)
Re: [patch 00/38] 2.6.24-stable review, Chuck Ebbert, (Sat Feb 23, 9:56 am)
Re: [patch 00/38] 2.6.24-stable review, Uli Luckas, (Sun Feb 24, 7:55 am)