[CRIU] [crtools-bot for Kinsbursky Stanislav ] IPC: message dumping updated due to mainstream STEAL logic changes

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 27 10:53:41 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 5990b6bfa6264857439e60cc09839185d977c86b
Author: Kinsbursky Stanislav <skinsbursky at openvz.org>
Date:   Wed Feb 22 16:18:24 2012 +0300

    IPC: message dumping updated due to mainstream STEAL logic changes
    
    Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
 ipc_ns.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ipc_ns.c b/ipc_ns.c
index ecc3084..61bedec 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -38,7 +38,7 @@
 /* message buffer for msgrcv in case of array calls */
 struct msgbuf_a {
 	long mtype;         /* type of message */
-	size_t msize;       /* size of message */
+	int msize;       /* size of message */
 	char mtext[0];      /* message text */
 };
 #endif
@@ -184,7 +184,11 @@ static int dump_ipc_msg_queue_messages(int fd, const struct ipc_msg_entry *entry
 	size_t array_size;
 	int ret, msg_nr = 0;
 
-	array_size = entry->qnum * sizeof(struct msgbuf_a) + cbytes;
+	/*
+	 * Here we allocate memory for struct msgbuf_a twice becase messages in
+	 * array will be aligned by struct msgbuf_a.
+	 */
+	array_size = entry->qnum * sizeof(struct msgbuf_a) * 2 + cbytes;
 	msg_array = ptr = xmalloc(array_size);
 	if (msg_array == NULL) {
 		pr_err("Failed to allocate memory for IPC messages\n");
@@ -217,7 +221,7 @@ static int dump_ipc_msg_queue_messages(int fd, const struct ipc_msg_entry *entry
 			break;
 		}
 		msg_nr++;
-		ptr += sizeof(struct msgbuf_a) + data->msize;
+		ptr += round_up(data->msize + sizeof(struct msgbuf_a), sizeof(struct msgbuf_a));
 	}
 	ret = 0;
 err:


More information about the CRIU mailing list