powerpc/mm: Comment arch_unmap()
PATCH 1/1 powerpc/mm: Comment arch_unmap()
During a different patch review, the check in arch_munmap() was found spucious due the lake of explanation.
Adding a comment to clarify the test.
Suggested-by Thomas Gleixner <[email protected]>
Cc Michael Ellerman <[email protected]>
Signed-off-by Laurent Dufour <[email protected]>
--- arch/powerpc/include/asm/mmu_context.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/powerpc/include/asm/mmu_context.h +11 -0
@@ -240,6 +240,17 @@ static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long start, unsigned long end) { +/* +* There are 2 assumptions here: +* 1. the VDSO is one page size (guaranteed by vdso_data_store) +* 2. 'start' and 'end' are page aligned (guaranteed by the caller) +* The test is wrote in a way to handle unmap operation surrounding the +* VDSO area like: +* | VDSO | +* ^ start ^ end +* The test also covers the munmap() operation done to the exact VDSO's +* boundaries. +*/ if (start <= mm->context.vdso_base && mm->context.vdso_base < end) mm->context.vdso_base =0 ; }
Signature · 1 line
2.21.0
Le 23/04/2019 à 17:17, Laurent Dufour a écrit :
Quoted 17 lines
During a different patch review, the check in
arch_munmap()was found spucious due the lake of explanation.Adding a comment to clarify the test.
Suggested-by Thomas Gleixner <[email protected]>Cc Michael Ellerman <[email protected]>Signed-off-by Laurent Dufour <[email protected]>--- arch/powerpc/include/asm/mmu_context.h | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/powerpc/include/asm/mmu_context.h +0
-0
arch/powerpc/include/asm/mmu_context.h static inline void arch_unmap(struct mm_struct *mm, · line 245
Quoted 6 lines
arch/powerpc/include/asm/mmu_context.h +3
-0@@ -240,6 +240,17 @@ static inline void arch_unmap(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long start, unsigned long end) { +/* +* There are 2 assumptions here: +* 1. the VDSO is one page size (guaranteed by vdso_data_store)
Indeed this is not true, only the descriptor is one page size.
This makes that test not handling all the cases, especially if a upper part of the VDSO is unmap (start > mm->context.vdso_base).
I'll sent a new fix asap.
Quoted 12 lines
arch/powerpc/include/asm/mmu_context.h +8
-0+* 2. 'start' and 'end' are page aligned (guaranteed by the caller) +* The test is wrote in a way to handle unmap operation surrounding the +* VDSO area like: +* | VDSO | +* ^ start ^ end +* The test also covers the munmap() operation done to the exact VDSO's +* boundaries. +*/ if (start <= mm->context.vdso_base && mm->context.vdso_base < end) mm->context.vdso_base =0 ; }