VM: add "vm_mmap()" helper function
This continues the theme started with vm_brk() and vm_munmap(): vm_mmap() does the same thing as do_mmap(), but additionally does the required VM locking. This uninlines (and rewrites it to be clearer) do_mmap(), which sadly duplicates it in mm/mmap.c and mm/nommu.c. But that way we don't have to export our internal do_mmap_pgoff() function. Some day we hopefully don't have to export do_mmap() either, if all modular users can become the simpler vm_mmap() instead. We're actually very close to that already, with the notable exception of the (broken) use in i810, and a couple of stragglers in binfmt_elf. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs)
|
||||
}
|
||||
|
||||
/* allocate a cache line of writable, executable memory */
|
||||
down_write(¤t->mm->mmap_sem);
|
||||
buffer = (void __user *) do_mmap(NULL, 0, 64,
|
||||
buffer = (void __user *) vm_mmap(NULL, 0, 64,
|
||||
PROT_EXEC | PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS,
|
||||
0);
|
||||
up_write(¤t->mm->mmap_sem);
|
||||
|
||||
if (IS_ERR((void __force *)buffer)) {
|
||||
kfree(state);
|
||||
|
Reference in New Issue
Block a user