summaryrefslogtreecommitdiffstats
path: root/arch/riscv/include/asm/pgtable-bits.h
diff options
context:
space:
mode:
authorStefan O'Rear <sorear2@gmail.com>2018-12-16 13:03:36 -0500
committerPalmer Dabbelt <palmer@sifive.com>2019-02-11 15:24:45 -0800
commite3613bb8afc2a9474c9214d65c8326c5ac02135e (patch)
tree0d6154dd8b888012626472436e12cc33da1565d9 /arch/riscv/include/asm/pgtable-bits.h
parentd13937116f1e82bf508a6325111b322c30c85eb9 (diff)
downloadlinux-0-day-e3613bb8afc2a9474c9214d65c8326c5ac02135e.tar.gz
linux-0-day-e3613bb8afc2a9474c9214d65c8326c5ac02135e.tar.xz
riscv: Add pte bit to distinguish swap from invalid
Previously, invalid PTEs and swap PTEs had the same binary representation, causing errors when attempting to unmap PROT_NONE mappings, including implicit unmap on exit. Typical error: swap_info_get: Bad swap file entry 40000000007a9879 BUG: Bad page map in process a.out pte:3d4c3cc0 pmd:3e521401 Cc: stable@vger.kernel.org Signed-off-by: Stefan O'Rear <sorear2@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch/riscv/include/asm/pgtable-bits.h')
-rw-r--r--arch/riscv/include/asm/pgtable-bits.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/pgtable-bits.h b/arch/riscv/include/asm/pgtable-bits.h
index 2fa2942be221e..470755cb75584 100644
--- a/arch/riscv/include/asm/pgtable-bits.h
+++ b/arch/riscv/include/asm/pgtable-bits.h
@@ -35,6 +35,12 @@
#define _PAGE_SPECIAL _PAGE_SOFT
#define _PAGE_TABLE _PAGE_PRESENT
+/*
+ * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to
+ * distinguish them from swapped out pages
+ */
+#define _PAGE_PROT_NONE _PAGE_READ
+
#define _PAGE_PFN_SHIFT 10
/* Set of bits to preserve across pte_modify() */