]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-proc-clear_refs-do-not-clear-reserved-pages.patch
linux-ti33x-psp 3.2: update to 3.2.21, add libertas fixes
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.2 / 0123-proc-clear_refs-do-not-clear-reserved-pages.patch
1 From 8077f2d3611dd0c75c64f018c7e01dc2a4948a27 Mon Sep 17 00:00:00 2001
2 From: Will Deacon <will.deacon@arm.com>
3 Date: Fri, 20 Jan 2012 14:34:09 -0800
4 Subject: [PATCH 123/129] proc: clear_refs: do not clear reserved pages
6 commit 85e72aa5384b1a614563ad63257ded0e91d1a620 upstream.
8 /proc/pid/clear_refs is used to clear the Referenced and YOUNG bits for
9 pages and corresponding page table entries of the task with PID pid, which
10 includes any special mappings inserted into the page tables in order to
11 provide things like vDSOs and user helper functions.
13 On ARM this causes a problem because the vectors page is mapped as a
14 global mapping and since ec706dab ("ARM: add a vma entry for the user
15 accessible vector page"), a VMA is also inserted into each task for this
16 page to aid unwinding through signals and syscall restarts.  Since the
17 vectors page is required for handling faults, clearing the YOUNG bit (and
18 subsequently writing a faulting pte) means that we lose the vectors page
19 *globally* and cannot fault it back in.  This results in a system deadlock
20 on the next exception.
22 To see this problem in action, just run:
24         $ echo 1 > /proc/self/clear_refs
26 on an ARM platform (as any user) and watch your system hang.  I think this
27 has been the case since 2.6.37
29 This patch avoids clearing the aforementioned bits for reserved pages,
30 therefore leaving the vectors page intact on ARM.  Since reserved pages
31 are not candidates for swap, this change should not have any impact on the
32 usefulness of clear_refs.
34 Signed-off-by: Will Deacon <will.deacon@arm.com>
35 Reported-by: Moussa Ba <moussaba@micron.com>
36 Acked-by: Hugh Dickins <hughd@google.com>
37 Cc: David Rientjes <rientjes@google.com>
38 Cc: Russell King <rmk@arm.linux.org.uk>
39 Acked-by: Nicolas Pitre <nico@linaro.org>
40 Cc: Matt Mackall <mpm@selenic.com>
41 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
42 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
43 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
44 ---
45  fs/proc/task_mmu.c |    3 +++
46  1 file changed, 3 insertions(+)
48 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
49 index e418c5a..7dcd2a2 100644
50 --- a/fs/proc/task_mmu.c
51 +++ b/fs/proc/task_mmu.c
52 @@ -518,6 +518,9 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
53                 if (!page)
54                         continue;
55  
56 +               if (PageReserved(page))
57 +                       continue;
58 +
59                 /* Clear accessed and referenced bits. */
60                 ptep_test_and_clear_young(vma, addr, pte);
61                 ClearPageReferenced(page);
62 -- 
63 1.7.9.5