From: Chris Wright <chrisw@osdl.org>
To: akpm@osdl.org, torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] setup_arg_pages can insert overlapping vma
Date: Tue, 16 Nov 2004 15:19:37 -0800 [thread overview]
Message-ID: <20041116151937.E2357@build.pdx.osdl.net> (raw)
Florian Heinz built an a.out binary that could map bss from 0x0 to
0xc0000000, and setup_arg_pages() would BUG() in insert_vma_struct
because the arg pages overlapped. This just checks before inserting,
and bails out if it would overlap.
Signed-off-by: Chris Wright <chrisw@osdl.org>
===== fs/exec.c 1.143 vs edited =====
--- 1.143/fs/exec.c 2004-10-28 00:40:03 -07:00
+++ edited/fs/exec.c 2004-11-11 19:24:54 -08:00
@@ -413,6 +413,7 @@
down_write(&mm->mmap_sem);
{
+ struct vm_area_struct *vma;
mpnt->vm_mm = mm;
#ifdef CONFIG_STACK_GROWSUP
mpnt->vm_start = stack_base;
@@ -433,6 +434,12 @@
mpnt->vm_flags = VM_STACK_FLAGS;
mpnt->vm_flags |= mm->def_flags;
mpnt->vm_page_prot = protection_map[mpnt->vm_flags & 0x7];
+ vma = find_vma(mm, mpnt->vm_start);
+ if (vma) {
+ up_write(&mm->mmap_sem);
+ kmem_cache_free(vm_area_cachep, mpnt);
+ return -ENOMEM;
+ }
insert_vm_struct(mm, mpnt);
mm->stack_vm = mm->total_vm = vma_pages(mpnt);
}
next reply other threads:[~2004-11-16 23:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-16 23:19 Chris Wright [this message]
2004-11-16 23:23 ` [PATCH 2/2] a.out: error check on set_brk Chris Wright
2004-11-18 17:39 ` [PATCH 1/2] setup_arg_pages can insert overlapping vma Hugh Dickins
2004-11-18 18:55 ` Chris Wright
2004-11-18 19:41 ` Hugh Dickins
2004-11-18 20:07 ` Chris Wright
2004-11-24 1:04 Zou, Nanhai
2004-11-24 1:23 ` Andrew Morton
2004-11-24 10:45 ` Andi Kleen
2004-11-24 16:30 ` Hugh Dickins
2004-11-24 20:38 ` Chris Wright
[not found] <20041124152250.GA4797@mschwid3.boeblingen.de.ibm.com>
2004-11-24 16:41 ` Hugh Dickins
2004-11-24 17:51 Luck, Tony
2004-11-25 0:44 Zou, Nanhai
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=20041116151937.E2357@build.pdx.osdl.net \
--to=chrisw@osdl.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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).