linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM64: mm: Correct show_pte behaviour.
@ 2013-04-19 14:49 Steve Capper
  2013-04-25 13:51 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Capper @ 2013-04-19 14:49 UTC (permalink / raw)
  To: linux-arm-kernel

show_pte makes use of the *_none_or_clear_bad style functions. If a
pgd, pud or pmd is identified as being bad, it will then be cleared.

As show_pte appears to be called from either the user or kernel
fault handlers this side effect can lead to unpredictable behaviour;
especially as TLB entries are not invalidated.

This patch removes the page table sanitisation from show_pte. If a
bad pgd, pud or pmd is encountered it is left unmodified.

Signed-off-by: Steve Capper <steve.capper@linaro.org>
---
 arch/arm64/mm/fault.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index afadae6..5263817 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -57,16 +57,16 @@ void show_pte(struct mm_struct *mm, unsigned long addr)
 		pmd_t *pmd;
 		pte_t *pte;
 
-		if (pgd_none_or_clear_bad(pgd))
+		if (pgd_none(*pgd) || pgd_bad(*pgd))
 			break;
 
 		pud = pud_offset(pgd, addr);
-		if (pud_none_or_clear_bad(pud))
+		if (pud_none(*pud) || pud_bad(*pud))
 			break;
 
 		pmd = pmd_offset(pud, addr);
 		printk(", *pmd=%016llx", pmd_val(*pmd));
-		if (pmd_none_or_clear_bad(pmd))
+		if (pmd_none(*pmd) || pmd_bad(*pmd))
 			break;
 
 		pte = pte_offset_map(pmd, addr);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ARM64: mm: Correct show_pte behaviour.
  2013-04-19 14:49 [PATCH] ARM64: mm: Correct show_pte behaviour Steve Capper
@ 2013-04-25 13:51 ` Catalin Marinas
  2013-04-25 15:45   ` Steve Capper
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2013-04-25 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 19, 2013 at 03:49:31PM +0100, Steve Capper wrote:
> show_pte makes use of the *_none_or_clear_bad style functions. If a
> pgd, pud or pmd is identified as being bad, it will then be cleared.
> 
> As show_pte appears to be called from either the user or kernel
> fault handlers this side effect can lead to unpredictable behaviour;
> especially as TLB entries are not invalidated.
> 
> This patch removes the page table sanitisation from show_pte. If a
> bad pgd, pud or pmd is encountered it is left unmodified.
> 
> Signed-off-by: Steve Capper <steve.capper@linaro.org>

Thanks. Applied.

-- 
Catalin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] ARM64: mm: Correct show_pte behaviour.
  2013-04-25 13:51 ` Catalin Marinas
@ 2013-04-25 15:45   ` Steve Capper
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Capper @ 2013-04-25 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 25, 2013 at 02:51:06PM +0100, Catalin Marinas wrote:
> Thanks. Applied.
> 
> -- 
> Catalin

Cheers!
-- 
Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-25 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19 14:49 [PATCH] ARM64: mm: Correct show_pte behaviour Steve Capper
2013-04-25 13:51 ` Catalin Marinas
2013-04-25 15:45   ` Steve Capper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).