Messages in this thread | | | Date | Thu, 5 Oct 2017 18:33:20 +0200 | From | Oleg Nesterov <> | Subject | Re: MAP_FIXED for ELF mappings |
| |
On 10/04, Michal Hocko wrote: > > On Wed 04-10-17 23:12:38, Baoquan He wrote: > > if (total_size) { > > total_size = ELF_PAGEALIGN(total_size); > > - map_addr = vm_mmap(filep, addr, total_size, prot, flags, off); > > - if (!BAD_ADDR(map_addr)) > > - vm_munmap(map_addr+size, total_size-size); > > - } else > > - map_addr = vm_mmap(filep, addr, size, prot, flags, off); > > + addr = get_unmapped_area(file, addr, total_size, off, flags); > > So how does this prevent clobbering an existing VMA when flags contains > MAP_FIXED?
I got lost...
this is just cleanup, it should not change the behaviour, with or without MAP_FIXED. It just avoids the mmap(total_size) + munmap(extra_size).
Oleg.
| |