diff for duplicates of <1531944882.10738.1.camel@intel.com> diff --git a/a/content_digest b/N1/content_digest index b8f0228..e788c50 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -30,7 +30,10 @@ Mike Kravetz <mike.kravetz@oracle.com> Nadav Amit <nadav.amit@gmail.com> Oleg Nesterov <oleg@redhat.com> - " Pavel Machek <pavel@ucw.cz>Peter\0" + Pavel Machek <pavel@ucw.cz> + Peter Zijlstra <peterz@infradead.org> + Ravi V. Shankar <ravi.v.shankar@intel.com> + " Vedvyas Shanbhogue <vedvyas.shanbhogue@intel.com>\0" "\00:1\0" "b\0" "On Tue, 2018-07-17 at 16:15 -0700, Dave Hansen wrote:\n" @@ -169,4 +172,4 @@ "\302\240\t/* Avoid dumping huge zero page */\n" -- -c21492365e8604f87e93abd0a2f2a113087835b34b08639faf30e94ed676c799 +b8e0cd1145f71854c5fc4b02bff8d231bd44dbae056792ecd6d94640e9b521ce
diff --git a/a/1.txt b/N2/1.txt index 701d71b..351399a 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -132,4 +132,8 @@ index 7f3e11d3b64a..822a563678b5 100644 goto out; /* Avoid dumping huge zero page */ +-- -- +To unsubscribe from this list: send the line "unsubscribe linux-doc" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/a/content_digest b/N2/content_digest index b8f0228..bae3605 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -30,7 +30,10 @@ Mike Kravetz <mike.kravetz@oracle.com> Nadav Amit <nadav.amit@gmail.com> Oleg Nesterov <oleg@redhat.com> - " Pavel Machek <pavel@ucw.cz>Peter\0" + Pavel Machek <pavel@ucw.cz> + Peter Zijlstra <peterz@infradead.org> + Ravi V. Shankar <ravi.v.shankar@intel.com> + " Vedvyas Shanbhogue <vedvyas.shanbhogue@intel.com>\0" "\00:1\0" "b\0" "On Tue, 2018-07-17 at 16:15 -0700, Dave Hansen wrote:\n" @@ -167,6 +170,10 @@ "\302\240\t\tgoto out;\n" "\302\240\n" "\302\240\t/* Avoid dumping huge zero page */\n" - -- + "--\302\240\n" + "--\n" + "To unsubscribe from this list: send the line \"unsubscribe linux-doc\" in\n" + "the body of a message to majordomo@vger.kernel.org\n" + More majordomo info at http://vger.kernel.org/majordomo-info.html -c21492365e8604f87e93abd0a2f2a113087835b34b08639faf30e94ed676c799 +c23048b89e2349f0140d73a34940cf13de1cb84d68f5b61a1abf2ab0d83ba027
diff --git a/a/1.txt b/N3/1.txt index 701d71b..ee8f1e0 100644 --- a/a/1.txt +++ b/N3/1.txt @@ -20,8 +20,8 @@ verify a non-sharing RO page still exists after a broken COW. However, a shadow stack PTE is always RO & DIRTY; it can be: - RO & DIRTY_HW - is_shstk_pte(pte) is true; or - RO & DIRTY_SW - the page is being shared. +A RO & DIRTY_HW - is_shstk_pte(pte) is true; or +A RO & DIRTY_SW - the page is being shared. Update these functions to check a non-sharing shadow stack page still exists after the COW. @@ -32,45 +32,45 @@ make their meaning clear; i.e. "Can we write to the page?", not Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> --- - mm/gup.c | 38 ++++++++++++++++++++++++++++++++++---- - mm/huge_memory.c | 19 ++++++++++++++----- - 2 files changed, 48 insertions(+), 9 deletions(-) +A mm/gup.cA A A A A A A A A | 38 ++++++++++++++++++++++++++++++++++---- +A mm/huge_memory.c | 19 ++++++++++++++----- +A 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index fc5f98069f4e..316967996232 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -63,11 +63,41 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, - /* - * FOLL_FORCE can write to even unwritable pte's, but only - * after we've gone through a COW cycle and they are dirty. +A /* +A * FOLL_FORCE can write to even unwritable pte's, but only +A * after we've gone through a COW cycle and they are dirty. + * + * Background: + * + * When we force-write to a read-only page, the page fault + * handler copies the page and sets the new page's PTE to -+ * RO & DIRTY. This routine tells ++ * RO & DIRTY.A A This routine tells + * -+ * "Can we write to the page?" ++ *A A A A A "Can we write to the page?" + * + * by checking: + * -+ * (1) The page has been copied, i.e. FOLL_COW is set; -+ * (2) The copy still exists and its PTE is RO & DIRTY. ++ *A A A A A (1) The page has been copied, i.e. FOLL_COW is set; ++ *A A A A A (2) The copy still exists and its PTE is RO & DIRTY. + * + * However, a shadow stack PTE is always RO & DIRTY; it can + * be: + * -+ * RO & DIRTY_HW: when is_shstk_pte(pte) is true; or -+ * RO & DIRTY_SW: when the page is being shared. ++ *A A A A A RO & DIRTY_HW: when is_shstk_pte(pte) is true; or ++ *A A A A A RO & DIRTY_SW: when the page is being shared. + * + * To test a shadow stack's non-sharing page still exists, + * we verify that the new page's PTE is_shstk_pte(pte). - */ +A */ -static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) +static inline bool can_follow_write(pte_t pte, unsigned int flags, -+ struct vm_area_struct *vma) - { ++ A A A A struct vm_area_struct *vma) +A { - return pte_write(pte) || - ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); + if (!is_shstk_mapping(vma->vm_flags)) { @@ -82,34 +82,34 @@ index fc5f98069f4e..316967996232 100644 + return ((flags & FOLL_FORCE) && (flags & FOLL_COW) && + is_shstk_pte(pte)); + } - } - - static struct page *follow_page_pte(struct vm_area_struct *vma, +A } +A +A static struct page *follow_page_pte(struct vm_area_struct *vma, @@ -105,7 +135,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma, - } - if ((flags & FOLL_NUMA) && pte_protnone(pte)) - goto no_page; +A } +A if ((flags & FOLL_NUMA) && pte_protnone(pte)) +A goto no_page; - if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) { + if ((flags & FOLL_WRITE) && !can_follow_write(pte, flags, vma)) { - pte_unmap_unlock(ptep, ptl); - return NULL; - } +A pte_unmap_unlock(ptep, ptl); +A return NULL; +A } diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 7f3e11d3b64a..822a563678b5 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1388,11 +1388,20 @@ int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd) - /* - * FOLL_FORCE can write to even unwritable pmd's, but only - * after we've gone through a COW cycle and they are dirty. +A /* +A * FOLL_FORCE can write to even unwritable pmd's, but only +A * after we've gone through a COW cycle and they are dirty. + * See comments in mm/gup.c, can_follow_write(). - */ +A */ -static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags) -{ - return pmd_write(pmd) || -- ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd)); +- A A A A A A A ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd)); +static inline bool can_follow_write(pmd_t pmd, unsigned int flags, -+ struct vm_area_struct *vma) ++ A A A A struct vm_area_struct *vma) +{ + if (!is_shstk_mapping(vma->vm_flags)) { + if (pmd_write(pmd)) @@ -120,16 +120,16 @@ index 7f3e11d3b64a..822a563678b5 100644 + return ((flags & FOLL_FORCE) && (flags & FOLL_COW) && + is_shstk_pmd(pmd)); + } - } - - struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, +A } +A +A struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, @@ -1405,7 +1414,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, - - assert_spin_locked(pmd_lockptr(mm, pmd)); - +A +A assert_spin_locked(pmd_lockptr(mm, pmd)); +A - if (flags & FOLL_WRITE && !can_follow_write_pmd(*pmd, flags)) + if (flags & FOLL_WRITE && !can_follow_write(*pmd, flags, vma)) - goto out; - - /* Avoid dumping huge zero page */ --- +A goto out; +A +A /* Avoid dumping huge zero page */ +--A diff --git a/a/content_digest b/N3/content_digest index b8f0228..3e55e36 100644 --- a/a/content_digest +++ b/N3/content_digest @@ -30,7 +30,10 @@ Mike Kravetz <mike.kravetz@oracle.com> Nadav Amit <nadav.amit@gmail.com> Oleg Nesterov <oleg@redhat.com> - " Pavel Machek <pavel@ucw.cz>Peter\0" + Pavel Machek <pavel@ucw.cz> + Peter Zijlstra <peterz@infradead.org> + Ravi V. Shankar <ravi.v.shankar@intel.com> + " Vedvyas Shanbhogue <vedvyas.shanbhogue@intel.com>\0" "\00:1\0" "b\0" "On Tue, 2018-07-17 at 16:15 -0700, Dave Hansen wrote:\n" @@ -55,8 +58,8 @@ "\n" "However, a shadow stack PTE is always RO & DIRTY; it can be:\n" "\n" - "\302\240 RO & DIRTY_HW - is_shstk_pte(pte) is true; or\n" - "\302\240 RO & DIRTY_SW - the page is being shared.\n" + "A RO & DIRTY_HW - is_shstk_pte(pte) is true; or\n" + "A RO & DIRTY_SW - the page is being shared.\n" "\n" "Update these functions to check a non-sharing shadow stack page\n" "still exists after the COW.\n" @@ -67,45 +70,45 @@ "\n" "Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>\n" "---\n" - "\302\240mm/gup.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240| 38 ++++++++++++++++++++++++++++++++++----\n" - "\302\240mm/huge_memory.c | 19 ++++++++++++++-----\n" - "\302\2402 files changed, 48 insertions(+), 9 deletions(-)\n" + "A mm/gup.cA A A A A A A A A | 38 ++++++++++++++++++++++++++++++++++----\n" + "A mm/huge_memory.c | 19 ++++++++++++++-----\n" + "A 2 files changed, 48 insertions(+), 9 deletions(-)\n" "\n" "diff --git a/mm/gup.c b/mm/gup.c\n" "index fc5f98069f4e..316967996232 100644\n" "--- a/mm/gup.c\n" "+++ b/mm/gup.c\n" "@@ -63,11 +63,41 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address,\n" - "\302\240/*\n" - "\302\240 * FOLL_FORCE can write to even unwritable pte's, but only\n" - "\302\240 * after we've gone through a COW cycle and they are dirty.\n" + "A /*\n" + "A * FOLL_FORCE can write to even unwritable pte's, but only\n" + "A * after we've gone through a COW cycle and they are dirty.\n" "+ *\n" "+ * Background:\n" "+ *\n" "+ * When we force-write to a read-only page, the page fault\n" "+ * handler copies the page and sets the new page's PTE to\n" - "+ * RO & DIRTY.\302\240\302\240This routine tells\n" + "+ * RO & DIRTY.A A This routine tells\n" "+ *\n" - "+ *\302\240\302\240\302\240\302\240\302\240\"Can we write to the page?\"\n" + "+ *A A A A A \"Can we write to the page?\"\n" "+ *\n" "+ * by checking:\n" "+ *\n" - "+ *\302\240\302\240\302\240\302\240\302\240(1) The page has been copied, i.e. FOLL_COW is set;\n" - "+ *\302\240\302\240\302\240\302\240\302\240(2) The copy still exists and its PTE is RO & DIRTY.\n" + "+ *A A A A A (1) The page has been copied, i.e. FOLL_COW is set;\n" + "+ *A A A A A (2) The copy still exists and its PTE is RO & DIRTY.\n" "+ *\n" "+ * However, a shadow stack PTE is always RO & DIRTY; it can\n" "+ * be:\n" "+ *\n" - "+ *\302\240\302\240\302\240\302\240\302\240RO & DIRTY_HW: when is_shstk_pte(pte) is true; or\n" - "+ *\302\240\302\240\302\240\302\240\302\240RO & DIRTY_SW: when the page is being shared.\n" + "+ *A A A A A RO & DIRTY_HW: when is_shstk_pte(pte) is true; or\n" + "+ *A A A A A RO & DIRTY_SW: when the page is being shared.\n" "+ *\n" "+ * To test a shadow stack's non-sharing page still exists,\n" "+ * we verify that the new page's PTE is_shstk_pte(pte).\n" - "\302\240 */\n" + "A */\n" "-static inline bool can_follow_write_pte(pte_t pte, unsigned int flags)\n" "+static inline bool can_follow_write(pte_t pte, unsigned int flags,\n" - "+\t\t\t\t\302\240\302\240\302\240\302\240struct vm_area_struct *vma)\n" - "\302\240{\n" + "+\t\t\t\tA A A A struct vm_area_struct *vma)\n" + "A {\n" "-\treturn pte_write(pte) ||\n" "-\t\t((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte));\n" "+\tif (!is_shstk_mapping(vma->vm_flags)) {\n" @@ -117,34 +120,34 @@ "+\t\treturn ((flags & FOLL_FORCE) && (flags & FOLL_COW) &&\n" "+\t\t\tis_shstk_pte(pte));\n" "+\t}\n" - "\302\240}\n" - "\302\240\n" - "\302\240static struct page *follow_page_pte(struct vm_area_struct *vma,\n" + "A }\n" + "A \n" + "A static struct page *follow_page_pte(struct vm_area_struct *vma,\n" "@@ -105,7 +135,7 @@ static struct page *follow_page_pte(struct vm_area_struct *vma,\n" - "\302\240\t}\n" - "\302\240\tif ((flags & FOLL_NUMA) && pte_protnone(pte))\n" - "\302\240\t\tgoto no_page;\n" + "A \t}\n" + "A \tif ((flags & FOLL_NUMA) && pte_protnone(pte))\n" + "A \t\tgoto no_page;\n" "-\tif ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) {\n" "+\tif ((flags & FOLL_WRITE) && !can_follow_write(pte, flags, vma)) {\n" - "\302\240\t\tpte_unmap_unlock(ptep, ptl);\n" - "\302\240\t\treturn NULL;\n" - "\302\240\t}\n" + "A \t\tpte_unmap_unlock(ptep, ptl);\n" + "A \t\treturn NULL;\n" + "A \t}\n" "diff --git a/mm/huge_memory.c b/mm/huge_memory.c\n" "index 7f3e11d3b64a..822a563678b5 100644\n" "--- a/mm/huge_memory.c\n" "+++ b/mm/huge_memory.c\n" "@@ -1388,11 +1388,20 @@ int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd)\n" - "\302\240/*\n" - "\302\240 * FOLL_FORCE can write to even unwritable pmd's, but only\n" - "\302\240 * after we've gone through a COW cycle and they are dirty.\n" + "A /*\n" + "A * FOLL_FORCE can write to even unwritable pmd's, but only\n" + "A * after we've gone through a COW cycle and they are dirty.\n" "+ * See comments in mm/gup.c, can_follow_write().\n" - "\302\240 */\n" + "A */\n" "-static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags)\n" "-{\n" "-\treturn pmd_write(pmd) ||\n" - "-\t\302\240\302\240\302\240\302\240\302\240\302\240\302\240((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd));\n" + "-\tA A A A A A A ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd));\n" "+static inline bool can_follow_write(pmd_t pmd, unsigned int flags,\n" - "+\t\t\t\t\302\240\302\240\302\240\302\240struct vm_area_struct *vma)\n" + "+\t\t\t\tA A A A struct vm_area_struct *vma)\n" "+{\n" "+\tif (!is_shstk_mapping(vma->vm_flags)) {\n" "+\t\tif (pmd_write(pmd))\n" @@ -155,18 +158,18 @@ "+\t\treturn ((flags & FOLL_FORCE) && (flags & FOLL_COW) &&\n" "+\t\t\tis_shstk_pmd(pmd));\n" "+\t}\n" - "\302\240}\n" - "\302\240\n" - "\302\240struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,\n" + "A }\n" + "A \n" + "A struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,\n" "@@ -1405,7 +1414,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,\n" - "\302\240\n" - "\302\240\tassert_spin_locked(pmd_lockptr(mm, pmd));\n" - "\302\240\n" + "A \n" + "A \tassert_spin_locked(pmd_lockptr(mm, pmd));\n" + "A \n" "-\tif (flags & FOLL_WRITE && !can_follow_write_pmd(*pmd, flags))\n" "+\tif (flags & FOLL_WRITE && !can_follow_write(*pmd, flags, vma))\n" - "\302\240\t\tgoto out;\n" - "\302\240\n" - "\302\240\t/* Avoid dumping huge zero page */\n" - -- + "A \t\tgoto out;\n" + "A \n" + "A \t/* Avoid dumping huge zero page */\n" + --A -c21492365e8604f87e93abd0a2f2a113087835b34b08639faf30e94ed676c799 +33f54f257913a6abc6c6ab8f90a44985610b574a4159961ff531474e603c7f9f
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.