Silently fill buffer with zeros when encounter hwpoison pages (accessing the hwpoison page content is deadly). This patch does not cover X86_32 - which has a dumb kern_addr_valid(). It is unlikely anyone run a 32bit kernel will care about the hwpoison feature - its usable memory is limited. CC: Ingo Molnar <mingo@xxxxxxx> CC: Andi Kleen <andi@xxxxxxxxxxxxxx> CC: Pekka Enberg <penberg@xxxxxxxxxxxxxx> Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx> --- arch/x86/mm/init_64.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) --- linux-mm.orig/arch/x86/mm/init_64.c 2010-01-13 21:23:04.000000000 +0800 +++ linux-mm/arch/x86/mm/init_64.c 2010-01-13 21:25:32.000000000 +0800 @@ -825,6 +825,7 @@ int __init reserve_bootmem_generic(unsig int kern_addr_valid(unsigned long addr) { unsigned long above = ((long)addr) >> __VIRTUAL_MASK_SHIFT; + unsigned long pfn; pgd_t *pgd; pud_t *pud; pmd_t *pmd; @@ -845,14 +846,23 @@ int kern_addr_valid(unsigned long addr) if (pmd_none(*pmd)) return 0; - if (pmd_large(*pmd)) - return pfn_valid(pmd_pfn(*pmd)); + if (pmd_large(*pmd)) { + pfn = pmd_pfn(*pmd); + pfn += pte_index(addr); + goto check_pfn; + } pte = pte_offset_kernel(pmd, addr); if (pte_none(*pte)) return 0; - return pfn_valid(pte_pfn(*pte)); + pfn = pte_pfn(*pte); +check_pfn: + if (!pfn_valid(pfn)) + return 0; + if (PageHWPoison(pfn_to_page(pfn))) + return 0; + return 1; } /* -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>