[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171005164248.h3brmuj4opq2ql4e@dhcp22.suse.cz>
Date: Thu, 5 Oct 2017 18:42:48 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
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 Thu 05-10-17 18:33:20, Oleg Nesterov wrote:
> 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).
OK, I have clearly misunderstood the intention then.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists