From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Petr Vandrovec <vandrove@vc.cvut.cz>,
Helge Hafting <helgehaf@aitel.hist.no>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] vm_area_struct slab corruption
Date: Thu, 6 Mar 2003 12:29:14 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.44.0303061208470.2196-100000@localhost.localdomain> (raw)
Fix vm_area_struct slab corruption due to mremap's move_vma mistaking
(okay, okay, _my_ mistaking) how do_munmap splits vmas in one case.
This patch fits do_munmap to move_vma's expectation: you may well feel
that's the wrong way round to fix it (and not the way I promised a few
days ago), but at present I'm more comfortable with this simpler fix;
and it does seem preferable for do_munmap to reuse the existing vma.
Hugh
--- 2.5.64/mm/mmap.c Wed Mar 5 07:26:34 2003
+++ linux/mm/mmap.c Thu Mar 6 11:47:44 2003
@@ -1258,20 +1258,24 @@
/*
* If we need to split any vma, do it now to save pain later.
+ *
+ * Note: mremap's move_vma VM_ACCOUNT handling assumes a partially
+ * unmapped vm_area_struct will remain in use: so lower split_vma
+ * places tmp vma above, and higher split_vma places tmp vma below.
*/
if (start > mpnt->vm_start) {
if (split_vma(mm, mpnt, start, 0))
return -ENOMEM;
prev = mpnt;
- mpnt = mpnt->vm_next;
}
/* Does it split the last one? */
last = find_vma(mm, end);
if (last && end > last->vm_start) {
- if (split_vma(mm, last, end, 0))
+ if (split_vma(mm, last, end, 1))
return -ENOMEM;
}
+ mpnt = prev? prev->vm_next: mm->mmap;
/*
* Remove the vma's, and unmap the actual pages
next reply other threads:[~2003-03-06 12:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-06 12:29 Hugh Dickins [this message]
2003-03-06 22:52 ` [PATCH] vm_area_struct slab corruption Andrew Morton
2003-03-07 5:27 ` Hugh Dickins
2003-03-07 6:00 ` Andrew Morton
2003-03-07 12:59 ` Alan Cox
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=Pine.LNX.4.44.0303061208470.2196-100000@localhost.localdomain \
--to=hugh@veritas.com \
--cc=akpm@digeo.com \
--cc=helgehaf@aitel.hist.no \
--cc=linux-kernel@vger.kernel.org \
--cc=vandrove@vc.cvut.cz \
/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).