mm, mpx: add "vm_flags_t vm_flags" arg to do_mmap_pgoff()
Add the additional "vm_flags_t vm_flags" argument to do_mmap_pgoff(), rename it to do_mmap(), and re-introduce do_mmap_pgoff() as a simple wrapper on top of do_mmap(). Perhaps we should update the callers of do_mmap_pgoff() and kill it later. This way mpx_mmap() can simply call do_mmap(vm_flags => VM_MPX) and do not play with vm internals. After this change mmap_region() has a single user outside of mmap.c, arch/tile/mm/elf.c:arch_setup_additional_pages(). It would be nice to change arch/tile/ and unexport mmap_region(). [kirill@shutemov.name: fix build] [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Dave Hansen <dave.hansen@linux.intel.com> Tested-by: Dave Hansen <dave.hansen@linux.intel.com> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Minchan Kim <minchan@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Este commit está contenido en:

cometido por
Linus Torvalds

padre
7cbea8dc01
commit
1fcfd8db7f
10
mm/mmap.c
10
mm/mmap.c
@@ -1260,14 +1260,12 @@ static inline int mlock_future_check(struct mm_struct *mm,
|
||||
/*
|
||||
* The caller must hold down_write(¤t->mm->mmap_sem).
|
||||
*/
|
||||
|
||||
unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
|
||||
unsigned long do_mmap(struct file *file, unsigned long addr,
|
||||
unsigned long len, unsigned long prot,
|
||||
unsigned long flags, unsigned long pgoff,
|
||||
unsigned long *populate)
|
||||
unsigned long flags, vm_flags_t vm_flags,
|
||||
unsigned long pgoff, unsigned long *populate)
|
||||
{
|
||||
struct mm_struct *mm = current->mm;
|
||||
vm_flags_t vm_flags;
|
||||
|
||||
*populate = 0;
|
||||
|
||||
@@ -1311,7 +1309,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
|
||||
* to. we assume access permissions have been handled by the open
|
||||
* of the memory object, so we don't do any here.
|
||||
*/
|
||||
vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags) |
|
||||
vm_flags |= calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags) |
|
||||
mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
|
||||
|
||||
if (flags & MAP_LOCKED)
|
||||
|
19
mm/nommu.c
19
mm/nommu.c
@@ -1233,18 +1233,19 @@ enomem:
|
||||
/*
|
||||
* handle mapping creation for uClinux
|
||||
*/
|
||||
unsigned long do_mmap_pgoff(struct file *file,
|
||||
unsigned long addr,
|
||||
unsigned long len,
|
||||
unsigned long prot,
|
||||
unsigned long flags,
|
||||
unsigned long pgoff,
|
||||
unsigned long *populate)
|
||||
unsigned long do_mmap(struct file *file,
|
||||
unsigned long addr,
|
||||
unsigned long len,
|
||||
unsigned long prot,
|
||||
unsigned long flags,
|
||||
vm_flags_t vm_flags,
|
||||
unsigned long pgoff,
|
||||
unsigned long *populate)
|
||||
{
|
||||
struct vm_area_struct *vma;
|
||||
struct vm_region *region;
|
||||
struct rb_node *rb;
|
||||
unsigned long capabilities, vm_flags, result;
|
||||
unsigned long capabilities, result;
|
||||
int ret;
|
||||
|
||||
*populate = 0;
|
||||
@@ -1262,7 +1263,7 @@ unsigned long do_mmap_pgoff(struct file *file,
|
||||
|
||||
/* we've determined that we can make the mapping, now translate what we
|
||||
* now know into VMA flags */
|
||||
vm_flags = determine_vm_flags(file, prot, flags, capabilities);
|
||||
vm_flags |= determine_vm_flags(file, prot, flags, capabilities);
|
||||
|
||||
/* we're going to need to record the mapping */
|
||||
region = kmem_cache_zalloc(vm_region_jar, GFP_KERNEL);
|
||||
|
Referencia en una nueva incidencia
Block a user