This fixes the same bug as b43790eedd31 ("mm: softdirty: don't forget to save file map softdiry bit on unmap") and 9aed8614af5a ("mm/memory.c: don't forget to set softdirty on file mapped fault") where the return value of pte_*mksoft_dirty was being ignored. To be sure that no other pte/pmd "mk" function return values were being ignored, I annotated the functions in arch/x86/include/asm/pgtable.h with __must_check and rebuilt. The userspace effect of this bug is that the softdirty mark might be lost if a file mapped pte get zapped.
Unified · Split
| @@ -1127,7 +1127,7 @@ again: · 1126 unmodified lines | |||
| 1127 | addr) != page->index) { | 1127 | addr) != page->index) { |
| 1128 | pte_t ptfile = pgoff_to_pte(page->index); | 1128 | pte_t ptfile = pgoff_to_pte(page->index); |
| 1129 | if (pte_soft_dirty(ptent)) | 1129 | if (pte_soft_dirty(ptent)) |
| 1130 | pte_file_mksoft_dirty(ptfile); | 1130 | ptfile = pte_file_mksoft_dirty(ptfile); |
| 1131 | set_pte_at(mm, addr, pte, ptfile); | 1131 | set_pte_at(mm, addr, pte, ptfile); |
| 1132 | } | 1132 | } |
| 1133 | if (PageAnon(page)) | 1133 | if (PageAnon(page)) |