public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	torvalds@osdl.org, akpm@osdl.org,
	"alan@lxorguk.ukuu.org.uk Siddha,
	Suresh B"  <suresh.b.siddha@intel.com>, Andi Kleen <ak@suse.de>
Subject: [04/13] x86_64 memleak from malicious 32bit elf program
Date: Tue, 2 Aug 2005 23:52:20 -0700	[thread overview]
Message-ID: <20050803065220.GS7762@shell0.pdx.osdl.net> (raw)
In-Reply-To: <20050803064439.GO7762@shell0.pdx.osdl.net>

-stable review patch.  If anyone has any objections, please let us know.

------------------

malicious 32bit app can have an elf section at 0xffffe000.  During
exec of this app, we will have a memory leak as insert_vm_struct() is
not checking for return value in syscall32_setup_pages() and thus not
freeing the vma allocated for the vsyscall page.

Check the return value and free the vma incase of failure.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 arch/x86_64/ia32/syscall32.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)

--- linux-2.6.12.3.orig/arch/x86_64/ia32/syscall32.c	2005-07-28 11:17:01.000000000 -0700
+++ linux-2.6.12.3/arch/x86_64/ia32/syscall32.c	2005-07-28 11:17:11.000000000 -0700
@@ -57,6 +57,7 @@
 	int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT;
 	struct vm_area_struct *vma;
 	struct mm_struct *mm = current->mm;
+	int ret;
 
 	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
 	if (!vma)
@@ -78,7 +79,11 @@
 	vma->vm_mm = mm;
 
 	down_write(&mm->mmap_sem);
-	insert_vm_struct(mm, vma);
+	if ((ret = insert_vm_struct(mm, vma))) {
+		up_write(&mm->mmap_sem);
+		kmem_cache_free(vm_area_cachep, vma);
+		return ret;
+	}
 	mm->total_vm += npages;
 	up_write(&mm->mmap_sem);
 	return 0;

  parent reply	other threads:[~2005-08-03  6:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-03  6:44 [00/13] -stable review Chris Wright
2005-08-03  6:47 ` [01/13] kbuild: build TAGS problem with O= Chris Wright
2005-08-03 17:37   ` Sam Ravnborg
2005-08-03  6:48 ` [02/13] qla2xxx: Correct handling of fc_remote_port_add() failure case Chris Wright
2005-08-03  6:50 ` [03/13] rocket.c: Fix ldisc ref count handling Chris Wright
2005-08-03  6:52 ` Chris Wright [this message]
2005-08-03  8:46   ` [04/13] x86_64 memleak from malicious 32bit elf program Andi Kleen
2005-08-03  6:53 ` [05/13] [NET]: Fix signedness issues in net/core/filter.c Chris Wright
2005-08-03  6:55 ` [06/13] [NETFILTER]: Fix deadlock in ip6_queue Chris Wright
2005-08-03  6:57 ` [07/13] [NETFILTER]: Fix potential memory corruption in NAT code (aka memory NAT) Chris Wright
2005-08-03  6:59 ` [08/13] [NETFILTER]: Wait until all references to ip_conntrack_untracked are dropped on unload Chris Wright
2005-08-03  7:01 ` [09/13] [XFRM]: Fix possible overflow of sock->sk_policy Chris Wright
2005-08-03  7:03 ` [10/13] [PATCH] bio_clone fix Chris Wright
2005-08-03  7:13   ` Jens Axboe
2005-08-03  7:04 ` [11/13] sys_get_thread_area does not clear the returned argument Chris Wright
2005-08-03  7:06 ` [12/13] [VLAN]: Fix early vlan adding leads to not functional device Chris Wright
2005-08-03  7:07 ` [13/13] Fix powernow oops on dual-core athlon Chris Wright

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=20050803065220.GS7762@shell0.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=chuckw@quantumlinux.com \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=stable@kernel.org \
    --cc=suresh.b.siddha@intel.com \
    --cc=torvalds@osdl.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /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