Reimplement old functionality of vm_munmap to vm_munmap_mm
Subsystems (3)
PATCH 1/1 Reimplement old functionality of vm_munmap to vm_munmap_mm
Commit bfce281c287a427d0841fadf5d59242757b4e620 killed the mm parameter to vm_munmap. Although the mm parameter was not used in any in-tree kernel modules, it is used by some out-of-tree modules.
We create a new function vm_munmap_mm that has the same functionality as vm_munmap, whereas vm_munmap uses current->mm, vm_munmap_mm takes the mm as a paramter.
Since this is a newly exported symbol it is marked EXPORT_SYMBOL_GPL.
--- include/linux/mm.h | 1 + mm/mmap.c | 9 +++++++-- mm/nommu.c | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-)
include/linux/mm.h +1 -0
@@ -1724,6 +1724,7 @@ static inline void mm_populate(unsigned long addr, unsigned long len) {}/* These take the mm semaphore themselves */ extern unsigned long vm_brk (unsigned long ,unsigned long );extern int vm_munmap (unsigned long ,size_t ); +extern int vm_munmap_mm (struct mm_struct *,unsigned long ,size_t );extern unsigned long vm_mmap (struct file *,unsigned long ,unsigned long ,unsigned long ,unsigned long ,unsigned long );
mm/mmap.c +7 -2
@@ -2539,16 +2539,21 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)return 0 ; } -int vm_munmap (unsigned long start,size_t len) +int vm_munmap_mm (struct mm_struct *mm,unsigned long start,size_t len) {int ret; -struct mm_struct *mm = current->mm;down_write (&mm->mmap_sem); ret =do_munmap (mm, start, len);up_write (&mm->mmap_sem);return ret; } +EXPORT_SYMBOL_GPL (vm_munmap_mm); + +int vm_munmap (unsigned long start,size_t len) +{ +return vm_munmap_mm (current->mm, start, len); +}EXPORT_SYMBOL (vm_munmap); SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
mm/nommu.c +7 -2
@@ -1717,9 +1717,8 @@ erase_whole_vma: }EXPORT_SYMBOL (do_munmap); -int vm_munmap (unsigned long addr,size_t len) +int vm_munmap_mm (struct mm_struct *mm,unsigned long addr,size_t len) { -struct mm_struct *mm = current->mm;int ret;down_write (&mm->mmap_sem);
@@ -1727,6 +1726,12 @@ int vm_munmap(unsigned long addr, size_t len)up_write (&mm->mmap_sem);return ret; } +EXPORT_SYMBOL_GPL (vm_munmap_mm); + +int vm_munmap (unsigned long addr,size_t len) +{ +return vm_munmap_mm (current->mm, addr, len); +}EXPORT_SYMBOL (vm_munmap); SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
Signature · 1 line
1.8.2.1
Quoted 3 lines · James Custer
Commit
bfce281c287a427d0841fadf5d59242757b4e620killed the mm parameter tovm_munmap. Although the mm parameter was not used in any in-tree kernel modules, it is used by some out-of-tree modules.
Which doesn't matter at all.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · James Custer
Commit
bfce281c287a427d0841fadf5d59242757b4e620killed the mm parameter tovm_munmap. Although the mm parameter was not used in any in-tree kernel modules, it is used by some out-of-tree modules.We create a new function
vm_munmap_mmthat has the same functionality asvm_munmap, whereasvm_munmapusescurrent->mm,vm_munmap_mmtakes the mm as a paramter.Since this is a newly exported symbol it is marked
EXPORT_SYMBOL_GPL.
Which modules and what are they doing with it? More to the point, what prevents races with e.g. dumping core? And that's not an idle question - for example, fs/aio.c used to contain very unpleasant races of that kind exactly because it was playing games with modifying ->mm other than current->mm.
In other words, NAK.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>