[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100113142357.GA4038@hack>
Date: Wed, 13 Jan 2010 22:23:57 +0800
From: Américo Wang <xiyou.wangcong@...il.com>
To: Wu Fengguang <fengguang.wu@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
Andi Kleen <andi@...stfloor.org>,
Pekka Enberg <penberg@...helsinki.fi>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Nick Piggin <npiggin@...e.de>,
Hugh Dickins <hugh.dickins@...cali.co.uk>,
Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [PATCH 8/8] hwpoison: prevent /dev/kcore from accessing
hwpoison pages
Your $subject, I think you mean /proc/kcore...
On Wed, Jan 13, 2010 at 09:53:13PM +0800, Wu Fengguang wrote:
>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@...e.hu>
>CC: Andi Kleen <andi@...stfloor.org>
>CC: Pekka Enberg <penberg@...helsinki.fi>
>Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
This patch looks fine for me.
Reviewed-by: WANG Cong <xiyou.wangcong@...il.com>
>---
> 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@...r.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
--
Live like a child, think like the god.
--
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