[ofa-general] Re: [openSM+lash] *** glibc detected *** free(): invalid next size (fast)
Sasha Khapyorsky
sashak at voltaire.com
Fri Dec 7 14:00:12 PST 2007
On 11:22 Fri 07 Dec , Keshetti Mahesh wrote:
> > Could you send me output of ibnetdiscover, so I will be able to rerun
> > with lash in simulator.
>
> Please find the topology file I have used while testing openSM with LASH
> in the attachments. Same problem is coming with the simulator too. Also
> I have observed one more thing. That is, first time you run openSM with LASH
> it gets aborted because of a glibc invalid free error and in the next run of
> openSM with LASH it successfully reaches the SUBNET UP stage but while
> closing openSM same error (glibc invalid next free size) appears.
Yes, there is obvious bug in the lash code. There is the fix.
Sasha
>From ef1cfcd47c05f8cf293201e7d8f47f6ab3527fbb Mon Sep 17 00:00:00 2001
From: Sasha Khapyorsky <sashak at voltaire.com>
Date: Sat, 8 Dec 2007 00:29:41 +0200
Subject: [PATCH] opensm/lash: fix wrong allocation size
LASH uses virtual_physical_port_table and phys_connections arrays for
each switch to store map of its local connections. Obviously size of
this allocations should be number of port on a switch and not number of
switches in a fabric.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
opensm/opensm/osm_ucast_lash.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/opensm/opensm/osm_ucast_lash.c b/opensm/opensm/osm_ucast_lash.c
index 5e7716e..3c93457 100644
--- a/opensm/opensm/osm_ucast_lash.c
+++ b/opensm/opensm/osm_ucast_lash.c
@@ -786,6 +786,7 @@ static void balance_virtual_lanes(lash_t * p_lash, unsigned lanes_needed)
static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw)
{
unsigned num_switches = p_lash->num_switches;
+ unsigned num_ports = p_sw->num_ports;
switch_t *sw;
unsigned int i;
@@ -802,15 +803,14 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw
return NULL;
}
- sw->virtual_physical_port_table = malloc(num_switches * sizeof(int));
+ sw->virtual_physical_port_table = malloc(num_ports * sizeof(int));
if (!sw->virtual_physical_port_table) {
free(sw->dij_channels);
free(sw);
return NULL;
}
- sw->phys_connections = malloc(num_switches * sizeof(int));
-
+ sw->phys_connections = malloc(num_ports * sizeof(int));
if (!sw->phys_connections) {
free(sw->virtual_physical_port_table);
free(sw->dij_channels);
@@ -819,7 +819,6 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw
}
sw->routing_table = malloc(num_switches * sizeof(sw->routing_table[0]));
-
if (!sw->routing_table) {
free(sw->phys_connections);
free(sw->virtual_physical_port_table);
@@ -831,9 +830,11 @@ static switch_t *switch_create(lash_t * p_lash, unsigned id, osm_switch_t * p_sw
for (i = 0; i < num_switches; i++) {
sw->routing_table[i].out_link = NONE;
sw->routing_table[i].lane = NONE;
+ }
+
+ for (i = 0; i < num_ports; i++) {
sw->virtual_physical_port_table[i] = -1;
- if (i < num_switches - 1)
- sw->phys_connections[i] = NONE;
+ sw->phys_connections[i] = NONE;
}
sw->p_sw = p_sw;
--
1.5.3.4.206.g58ba4
More information about the general
mailing list