The patch titled Subject: mmu_gather: Use macro arguments more carefully has been added to the -mm mm-hotfixes-unstable branch. Its filename is mmu_gather-use-macro-arguments-more-carefully.patch
This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches...
This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days
------------------------------------------------------ From: Jann Horn jannh@google.com Subject: mmu_gather: Use macro arguments more carefully Date: Wed, 23 Nov 2022 17:56:50 +0100
Avoid breaking stuff when the tlb parameter is an expression like "&tlb". The following commit relies on this when calling pte_free_tlb().
(Going forward it would probably be a good idea to change macros like this into inline functions...)
Link: https://lkml.kernel.org/r/20221123165652.2204925-3-jannh@google.com Fixes: a6d60245d6d9 ("asm-generic/tlb: Track which levels of the page table= s have been cleared") Signed-off-by: Jann Horn jannh@google.com Cc: David Hildenbrand david@redhat.com Cc: John Hubbard jhubbard@nvidia.com Cc: Mike Kravetz mike.kravetz@oracle.com Cc: Peter Xu peterx@redhat.com Cc: Yang Shi shy828301@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org ---
include/asm-generic/tlb.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
--- a/include/asm-generic/tlb.h~mmu_gather-use-macro-arguments-more-carefully +++ a/include/asm-generic/tlb.h @@ -630,7 +630,7 @@ static inline void tlb_flush_p4d_range(s #define pte_free_tlb(tlb, ptep, address) \ do { \ tlb_flush_pmd_range(tlb, address, PAGE_SIZE); \ - tlb->freed_tables = 1; \ + (tlb)->freed_tables = 1; \ __pte_free_tlb(tlb, ptep, address); \ } while (0) #endif @@ -639,7 +639,7 @@ static inline void tlb_flush_p4d_range(s #define pmd_free_tlb(tlb, pmdp, address) \ do { \ tlb_flush_pud_range(tlb, address, PAGE_SIZE); \ - tlb->freed_tables = 1; \ + (tlb)->freed_tables = 1; \ __pmd_free_tlb(tlb, pmdp, address); \ } while (0) #endif @@ -648,7 +648,7 @@ static inline void tlb_flush_p4d_range(s #define pud_free_tlb(tlb, pudp, address) \ do { \ tlb_flush_p4d_range(tlb, address, PAGE_SIZE); \ - tlb->freed_tables = 1; \ + (tlb)->freed_tables = 1; \ __pud_free_tlb(tlb, pudp, address); \ } while (0) #endif @@ -657,7 +657,7 @@ static inline void tlb_flush_p4d_range(s #define p4d_free_tlb(tlb, pudp, address) \ do { \ __tlb_adjust_range(tlb, address, PAGE_SIZE); \ - tlb->freed_tables = 1; \ + (tlb)->freed_tables = 1; \ __p4d_free_tlb(tlb, pudp, address); \ } while (0) #endif _
Patches currently in -mm which might be from jannh@google.com are
mm-khugepaged-take-the-right-locks-for-page-table-retraction.patch mmu_gather-use-macro-arguments-more-carefully.patch mm-khugepaged-fix-gup-fast-interaction-by-freeing-ptes-via-mmu_gather.patch mm-khugepaged-invoke-mmu-notifiers-in-shmem-file-collapse-paths.patch