public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@openvz.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	Chris Wright <chrisw@osdl.org>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	devel@openvz.org
Subject: [PATCH] IPC: access to unmapped vmalloc area in grow_ary()
Date: Mon, 17 Apr 2006 15:39:23 +0400	[thread overview]
Message-ID: <44437E6B.9060605@openvz.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

grow_ary() should not copy struct ipc_id_ary (it copies new->p, not 
new). Due to this, memcpy() src pointer could hit unmapped vmalloc page 
when near page boundary.

Found during OpenVZ stress testing

Signed-Off-By: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Signed-Off-By: Kirill Korotaev <dev@openvz.org>

[-- Attachment #2: diff-ipc-memcpy-bug-20060413 --]
[-- Type: text/plain, Size: 567 bytes --]

diff -urp ../git/linux-2.6.16-workgpl/ipc/util.c linux-2.6.16/ipc/util.c
--- ../git/linux-2.6.16-workgpl/ipc/util.c	2006-04-13 16:01:47.000000000 +0400
+++ linux-2.6.16/ipc/util.c	2006-04-13 16:01:05.000000000 +0400
@@ -187,8 +187,7 @@ static int grow_ary(struct ipc_ids* ids,
 	if(new == NULL)
 		return size;
 	new->size = newsize;
-	memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size +
-					sizeof(struct ipc_id_ary));
+	memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size);
 	for(i=size;i<newsize;i++) {
 		new->p[i] = NULL;
 	}

                 reply	other threads:[~2006-04-17 11:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=44437E6B.9060605@openvz.org \
    --to=dev@openvz.org \
    --cc=akpm@osdl.org \
    --cc=chrisw@osdl.org \
    --cc=devel@openvz.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --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