]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Mar 2014 18:56:21 +0000 (10:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Mar 2014 18:56:21 +0000 (10:56 -0800)
added patches:
arm64-mm-add-double-logical-invert-to-pte-accessors.patch

queue-3.4/arm64-mm-add-double-logical-invert-to-pte-accessors.patch [new file with mode: 0644]
queue-3.4/series

diff --git a/queue-3.4/arm64-mm-add-double-logical-invert-to-pte-accessors.patch b/queue-3.4/arm64-mm-add-double-logical-invert-to-pte-accessors.patch
new file mode 100644 (file)
index 0000000..759e42d
--- /dev/null
@@ -0,0 +1,46 @@
+From 84fe6826c28f69d8708bd575faed7f75e6b6f57f Mon Sep 17 00:00:00 2001
+From: Steve Capper <steve.capper@linaro.org>
+Date: Tue, 25 Feb 2014 11:38:53 +0000
+Subject: arm64: mm: Add double logical invert to pte accessors
+
+From: Steve Capper <steve.capper@linaro.org>
+
+commit 84fe6826c28f69d8708bd575faed7f75e6b6f57f upstream.
+
+Page table entries on ARM64 are 64 bits, and some pte functions such as
+pte_dirty return a bitwise-and of a flag with the pte value. If the
+flag to be tested resides in the upper 32 bits of the pte, then we run
+into the danger of the result being dropped if downcast.
+
+For example:
+       gather_stats(page, md, pte_dirty(*pte), 1);
+where pte_dirty(*pte) is downcast to an int.
+
+This patch adds a double logical invert to all the pte_ accessors to
+ensure predictable downcasting.
+
+Signed-off-by: Steve Capper <steve.capper@linaro.org>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
+index b524dcd17243..aa3917c8b623 100644
+--- a/arch/arm64/include/asm/pgtable.h
++++ b/arch/arm64/include/asm/pgtable.h
+@@ -136,11 +136,11 @@ extern struct page *empty_zero_page;
+ /*
+  * The following only work if pte_present(). Undefined behaviour otherwise.
+  */
+-#define pte_present(pte)      (pte_val(pte) & (PTE_VALID | PTE_PROT_NONE))
+-#define pte_dirty(pte)                (pte_val(pte) & PTE_DIRTY)
+-#define pte_young(pte)                (pte_val(pte) & PTE_AF)
+-#define pte_special(pte)      (pte_val(pte) & PTE_SPECIAL)
+-#define pte_write(pte)                (pte_val(pte) & PTE_WRITE)
++#define pte_present(pte)      (!!(pte_val(pte) & (PTE_VALID | PTE_PROT_NONE)))
++#define pte_dirty(pte)                (!!(pte_val(pte) & PTE_DIRTY))
++#define pte_young(pte)                (!!(pte_val(pte) & PTE_AF))
++#define pte_special(pte)      (!!(pte_val(pte) & PTE_SPECIAL))
++#define pte_write(pte)                (!!(pte_val(pte) & PTE_WRITE))
+ #define pte_exec(pte)         (!(pte_val(pte) & PTE_UXN))
+ #define pte_valid_user(pte) \
index 7e76dbf6e3f1a81deeee9b68f3ce8b9dd88212dd..81ac3eb6182ee013f53a102c79bd3ba7e8f0e67e 100644 (file)
@@ -38,3 +38,4 @@ workqueue-ensure-task-is-valid-across-kthread_stop.patch
 perf-fix-hotplug-splat.patch
 selinux-bigendian-problems-with-filename-trans-rules.patch
 quota-fix-race-between-dqput-and-dquot_scan_active.patch
+arm64-mm-add-double-logical-invert-to-pte-accessors.patch