From: "Mark F. Haigh" <Mark.Haigh@spirentcom.com>
To: chrisw@osdl.org
Cc: linux-security-module@wirex.com, linux-kernel@vger.kernel.org
Subject: [PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5)
Date: Tue, 08 Feb 2005 19:48:34 -0800 [thread overview]
Message-ID: <42098812.9010409@spirentcom.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
Unless I'm missing something, in kernel/fork.c, dup_mmap():
if (security_vm_enough_memory(len))
goto fail_nomem;
/* ... */
fail_nomem:
retval = -ENOMEM;
vm_unacct_memory(charge);
/* ... */
If security_vm_enough_memory() fails there, then we vm_unacct_memory()
that we never accounted (if security_vm_enough_memory() fails, no memory
is accounted).
If it is in fact a bug, a simple but largely untested patch (against
2.6.11-rc3-bk5) is included.
Mark F. Haigh
Mark.Haigh@spirentcom.com
[-- Attachment #2: fork-patch --]
[-- Type: text/plain, Size: 526 bytes --]
--- linux-2.6.11-rc3-bk5/kernel/fork.c.orig 2005-02-08 19:12:26.254589504 -0800
+++ linux-2.6.11-rc3-bk5/kernel/fork.c 2005-02-08 19:16:30.756419576 -0800
@@ -193,8 +193,10 @@
charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
- if (security_vm_enough_memory(len))
- goto fail_nomem;
+ if (security_vm_enough_memory(len)) {
+ retval = -ENOMEM;
+ goto out;
+ }
charge = len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
next reply other threads:[~2005-02-09 3:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-09 3:48 Mark F. Haigh [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-02-09 3:51 [PATCH] kernel/fork.c: VM accounting bugfix (2.6.11-rc3-bk5) Mark F. Haigh
2005-02-09 7:04 ` Chris Wright
2005-02-09 12:30 ` Hugh Dickins
2005-02-09 19:28 ` Chris Wright
2005-02-09 19:46 ` Hugh Dickins
2005-02-09 20:04 ` Mark F. Haigh
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=42098812.9010409@spirentcom.com \
--to=mark.haigh@spirentcom.com \
--cc=chrisw@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@wirex.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.