riscv: Add pte bit to distinguish swap from invalid
authorStefan O'Rear <sorear2@gmail.com>
Sun, 16 Dec 2018 18:03:36 +0000 (13:03 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Feb 2019 09:25:46 +0000 (10:25 +0100)
commit2ab1483852b3502235c3496c09ecbc5808bdecf8
tree936d32da3108796a1527b016a10d06f26e8ca0ec
parent22d6e72bb566880b37058587f504a7884ea4192f
riscv: Add pte bit to distinguish swap from invalid

commit e3613bb8afc2a9474c9214d65c8326c5ac02135e upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/include/asm/pgtable-bits.h
arch/riscv/include/asm/pgtable.h