[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171005163320.GA20848@redhat.com>
Date: Thu, 5 Oct 2017 18:33:20 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Michal Hocko <mhocko@...nel.org>
Cc: Baoquan He <bhe@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Jiri Kosina <jkosina@...e.cz>,
Al Viro <viro@...iv.linux.org.uk>, Ingo Molnar <mingo@...e.hu>,
LKML <linux-kernel@...r.kernel.org>
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.
Powered by blists - more mailing lists