lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 08 Oct 2009 17:37:45 +0800
From:	WANG Cong <xiyou.wangcong@...il.com>
To:	Gleb Natapov <gleb@...hat.com>
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	linux-api@...r.kernel.org
Subject: Re: [PATCH v3][RFC] add MAP_UNLOCKED mmap flag

Gleb Natapov <gleb@...hat.com> writes:

> On Thu, Oct 08, 2009 at 05:10:35PM +0800, WANG Cong wrote:
>> Gleb Natapov <gleb@...hat.com> writes:
>> 
>> > If application does mlockall(MCL_FUTURE) it is no longer possible to
>> > mmap file bigger than main memory or allocate big area of anonymous
>> > memory. Sometimes it is desirable to lock everything related to program
>> > execution into memory, but still be able to mmap big file or allocate
>> > huge amount of memory and allow OS to swap them on demand. MAP_UNLOCKED
>> > allows to do that.
>> >
>> > Signed-off-by: Gleb Natapov <gleb@...hat.com>
>> 
>> <snip>
>> 
>> > diff --git a/mm/mmap.c b/mm/mmap.c
>> > index 73f5e4b..ecc4471 100644
>> > --- a/mm/mmap.c
>> > +++ b/mm/mmap.c
>> > @@ -985,6 +985,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
>> >  		if (!can_do_mlock())
>> >  			return -EPERM;
>> >  
>> > +        if (flags & MAP_UNLOCKED)
>> > +                vm_flags &= ~VM_LOCKED;
>> > +
>> >  	/* mlock MCL_FUTURE? */
>> >  	if (vm_flags & VM_LOCKED) {
>> >  		unsigned long locked, lock_limit;
>> 
>> So, if I read it correctly, it is perfectly legal to set
>> both MAP_LOCKED and MAP_UNLOCKED at the same time? While
>> the behavior is still same as only setting MAP_UNLOCKED.
>> 
>> Is this what we expect?
>> 
> This is what code does currently. Should we return EINVAL in this case?
>

I suppose to get an EINVAL.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ