public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: catalin.marinas@arm•com (Catalin Marinas)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH] ARM64: Kernel managed pages are only flushed
Date: Wed, 12 Mar 2014 16:03:40 +0000	[thread overview]
Message-ID: <20140312160340.GI17083@arm.com> (raw)
In-Reply-To: <20140312145653.GA9691@mudshark.cambridge.arm.com>

On Wed, Mar 12, 2014 at 02:56:53PM +0000, Will Deacon wrote:
> On Wed, Mar 12, 2014 at 02:41:31PM +0000, Bharat.Bhushan at freescale.com wrote:
> > Did you get the chance to look into this? What is your take for this patch
> > or you want to suggest some other solution?
> 
> See my reply to Laura here:
> 
>   http://lists.infradead.org/pipermail/linux-arm-kernel/2014-March/238510.html
> 
> We *really* don't want executable device mappings.

/dev/mem mapping use pgprot_noncached() but I think we could generalise
any of the writecombine and dmacoherent mappings to XN like in the patch
below:

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index b524dcd17243..2d3cede62709 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -286,11 +286,11 @@ static inline int has_transparent_hugepage(void)
  * Mark the prot value as uncacheable and unbufferable.
  */
 #define pgprot_noncached(prot) \
-	__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE))
+	__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN)
 #define pgprot_writecombine(prot) \
-	__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC))
+	__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
 #define pgprot_dmacoherent(prot) \
-	__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC))
+	__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
 #define __HAVE_PHYS_MEM_ACCESS_PROT
 struct file;
 extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,

-- 
Catalin

  reply	other threads:[~2014-03-12 16:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 11:20 [PATCH] ARM64: Kernel managed pages are only flushed Bharat Bhushan
2014-03-06  6:53 ` Catalin Marinas
2014-03-06  9:33   ` Bharat.Bhushan at freescale.com
2014-03-12 14:41   ` Bharat.Bhushan at freescale.com
2014-03-12 14:56     ` Will Deacon
2014-03-12 16:03       ` Catalin Marinas [this message]
2014-03-12 17:26         ` Catalin Marinas
2014-03-12 20:12           ` Laura Abbott
2014-03-13 11:00           ` Bharat.Bhushan at freescale.com
2014-03-26  3:16           ` Bharat.Bhushan at freescale.com
2014-03-27 10:55             ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140312160340.GI17083@arm.com \
    --to=catalin.marinas@arm$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox