[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 10 Oct 2010 18:46:46 +0200
From: Andi Kleen <andi@...stfloor.org>
To: Marco Stornelli <marco.stornelli@...il.com>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
Linux Embedded <linux-embedded@...r.kernel.org>,
Linux FS Devel <linux-fsdevel@...r.kernel.org>,
Tim Bird <tim.bird@...sony.com>, linux-mm@...ck.org
Subject: Re: [PATCH 14(16] pramfs: memory protection
Marco Stornelli <marco.stornelli@...il.com> writes:
> +
> + do {
> + pgd = pgd_offset(&init_mm, address);
> + if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
> + goto out;
> +
> + pud = pud_offset(pgd, address);
> + if (pud_none(*pud) || unlikely(pud_bad(*pud)))
> + goto out;
> +
> + pmd = pmd_offset(pud, address);
> + if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
> + goto out;
> +
> + ptep = pte_offset_kernel(pmd, addr);
> + pte = *ptep;
> + if (pte_present(pte)) {
This won't work at all on x86 because you don't handle large
pages.
And it doesn't work on x86-64 because the first 2GB are double
mapped (direct and kernel text mapping)
Thirdly I expect it won't either on architectures that map
the direct mapping with special registers (like IA64 or MIPS)
I'm not sure this is very useful anyways. It doesn't protect
against stray DMA and it doesn't protect against writes through
broken user PTEs.
-Andi
--
ak@...ux.intel.com -- Speaking for myself only.
--
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