]> git.dujemihanovic.xyz Git - linux.git/commit
s390/mm: fix pxd_bad with folded page tables
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 24 Apr 2019 10:49:44 +0000 (12:49 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 24 Apr 2019 11:28:50 +0000 (13:28 +0200)
commitc9f621524e70774688db3cec60d85fa4c7de52e3
treeb465574070c6b0085a17f8f0b846b39fd33acac5
parent01eb42afb45719cb41bb32c278e068073738899d
s390/mm: fix pxd_bad with folded page tables

With git commit d1874a0c2805fcfa9162c972d6b7541e57adb542
"s390/mm: make the pxd_offset functions more robust" and a 2-level page
table it can now happen that pgd_bad() gets asked to verify a large
segment table entry. If the entry is marked as dirty pgd_bad() will
incorrectly return true.

Change the pgd_bad(), p4d_bad(), pud_bad() and pmd_bad() functions to
first verify the table type, return false if the table level is lower
than what the function is suppossed to check, return true if the table
level is too high, and otherwise check the relevant region and segment
table bits. pmd_bad() has to check against ~SEGMENT_ENTRY_BITS for
normal page table pointers or ~SEGMENT_ENTRY_BITS_LARGE for large
segment table entries. Same for pud_bad() which has to check against
~_REGION_ENTRY_BITS or ~_REGION_ENTRY_BITS_LARGE.

Fixes: d1874a0c2805 ("s390/mm: make the pxd_offset functions more robust")
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/pgtable.h