From 2cba8fd12799e5332f13621f2e4e96c4752fa35b Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 5 Mar 2010 09:24:02 +0000 Subject: [PATCH] SIMIX_network_copy_data() is a mess because it tries to allow passing arbitrary long memory chuncks in simix_network. It complicates stuff, and is hopeless anyway since it has not the full gras_datadesc power. So, let's stop trying that. When SIMIX_network_send(), don't pass a pointer's address (void**) as argument src_buf (which is declared void*). It was dereferenced twice in SIMIX_network_copy_data() anyway. The current situation is a bit more sane, even if further cleanups is needed: I guess that the data argument of SIMIX_network_send() become useless now, and I didn't cleanup my commit: that's full of useless FIXMEs. The motivation to this change was that ruby stacks may move to some other location in the memory on context switch (to extend it). So, trying to reuse a pointer to a variable living in the stack after a switch does not work. This commit kills a "invalid read". git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7199 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/msg/msg_mailbox.c | 2 +- src/simix/smx_network.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index a4ccc25670..c897b6a621 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -187,7 +187,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task, SIMIX_cond_signal(mailbox->cond); SIMIX_network_send(mailbox->rdv, t_simdata->message_size, t_simdata->rate, - timeout, &task, sizeof(void*), &t_simdata->comm, task); + timeout, task, sizeof(void*), &t_simdata->comm, task); } CATCH(e){ diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 38e22a0b8f..a1bb927fd1 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -350,11 +350,14 @@ void SIMIX_network_copy_data(smx_comm_t comm) comm->dst_proc->smx_host->name, comm->dst_buff, buff_size); #endif - if (buff_size == sizeof(void*)) { - *(void**)(comm->dst_buff) = *(void**)(comm->src_buff); - } else { + + xbt_assert1((buff_size == sizeof(void*)), "Cannot copy %d bytes: must be sizeof(void*)",buff_size); + //FIXME: cleanup +// if { + *(void**)(comm->dst_buff) = (comm->src_buff); +/* } else { memcpy(comm->dst_buff, comm->src_buff, buff_size); - } + }*/ } /** -- 2.20.1