From: Hubertus Franke <frankeh@watson.ibm.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] recognize MAP_LOCKED in mmap() call
Date: Wed, 18 Sep 2002 12:07:26 -0400 [thread overview]
Message-ID: <200209181207.26655.frankeh@watson.ibm.com> (raw)
In-Reply-To: <20020913213042.GD3530@holomorphy.com>
[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]
Andrew, at the current time an mmap() ignores a MAP_LOCKED passed to it.
The only way we can get VM_LOCKED associated with the newly created VMA
is to have previously called mlockall() on the process which sets the
mm->def_flags != VM_LOCKED or subsequently call mlock() on the
newly created VMA.
The attached patch checks for MAP_LOCKED being passed and if so checks
the capabilities of the process. Limit checks were already in place.
--
-- Hubertus Franke (frankeh@watson.ibm.com)
--------------------------------< PATCH >------------------------------
--- linux-2.5.35/mm/mmap.c Wed Sep 18 11:12:13 2002
+++ linux-2.5.35-fix/mm/mmap.c Wed Sep 18 11:44:32 2002
@@ -461,6 +461,11 @@
*/
vm_flags = calc_vm_flags(prot,flags) | mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
+ if (flags & MAP_LOCKED) {
+ if (!capable(CAP_IPC_LOCK))
+ return -EPERM;
+ vm_flags |= VM_LOCKED;
+ }
/* mlock MCL_FUTURE? */
if (vm_flags & VM_LOCKED) {
unsigned long locked = mm->locked_vm << PAGE_SHIFT;
[-- Attachment #2: patch.2.5.35.mmap_locked --]
[-- Type: text/x-diff, Size: 452 bytes --]
--- linux-2.5.35/mm/mmap.c Wed Sep 18 11:12:13 2002
+++ linux-2.5.35-fix/mm/mmap.c Wed Sep 18 11:44:32 2002
@@ -461,6 +461,11 @@
*/
vm_flags = calc_vm_flags(prot,flags) | mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
+ if (flags & MAP_LOCKED) {
+ if (!capable(CAP_IPC_LOCK))
+ return -EPERM;
+ vm_flags |= VM_LOCKED;
+ }
/* mlock MCL_FUTURE? */
if (vm_flags & VM_LOCKED) {
unsigned long locked = mm->locked_vm << PAGE_SHIFT;
next prev parent reply other threads:[~2002-09-18 16:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-13 3:33 [PATCH] per-zone kswapd process Dave Hansen
2002-09-13 4:06 ` Andrew Morton
2002-09-13 4:59 ` William Lee Irwin III
2002-09-13 5:10 ` Martin J. Bligh
[not found] ` <3D8232DE.9090000@us.ibm.com>
[not found] ` <3D823702.8E29AB4F@digeo.com>
[not found] ` <3D8251D6.3060704@us.ibm.com>
[not found] ` <3D82566B.EB2939D5@digeo.com>
2002-09-13 22:52 ` [PATCH] per-zone^Wnode " Dave Hansen
2002-09-13 23:24 ` Matthew Dobson
2002-09-13 23:29 ` Matthew Dobson
2002-09-13 23:46 ` William Lee Irwin III
2002-09-14 0:02 ` Andrew Morton
2002-09-14 0:12 ` William Lee Irwin III
2002-09-14 1:19 ` Andrew Morton
2002-09-13 5:46 ` [PATCH] per-zone " Andrew Morton
2002-09-13 5:38 ` Martin J. Bligh
2002-09-13 6:03 ` Andrew Morton
2002-09-13 13:05 ` Alan Cox
2002-09-13 21:30 ` William Lee Irwin III
2002-09-18 16:07 ` Hubertus Franke [this message]
2002-09-18 16:29 ` [PATCH] recognize MAP_LOCKED in mmap() call Andrew Morton
2002-09-16 5:44 ` [PATCH] per-zone kswapd process Daniel Phillips
2002-09-16 7:46 ` William Lee Irwin III
2002-09-16 15:12 ` Rik van Riel
2002-09-18 19:18 [PATCH] recognize MAP_LOCKED in mmap() call Mark_H_Johnson
2002-09-18 19:39 ` Rik van Riel
2002-09-18 19:54 ` Andrew Morton
2002-09-25 15:42 ` Hubertus Franke
2002-09-25 16:35 ` Andrew Morton
2002-09-25 15:36 ` Hubertus Franke
2002-09-25 16:57 Mark_H_Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200209181207.26655.frankeh@watson.ibm.com \
--to=frankeh@watson.ibm.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).