[ofa-general] Weird problem with calling libibverbs from another .SO
Mike Heinz
michael.heinz at qlogic.com
Tue Mar 17 09:07:24 PDT 2009
I'm working on some sample programs and I've run into a weird problem with libibverbs. If I have a simple program linked with libibverbs, things worked smoothly, but if I more those functions into a shared library which then calls libibverbs, I core dump, with what appears to be a corrupted call stack.
Are there special flags I need to use when creating an SO that works with libibverbs?
Here's what I mean:
hca = open_device(argv[optind]); // value of hca is 0x5054a0.
if (!hca) {
fprintf(stderr, "Could not open HCA.\n");
return -1;
}
{
struct ibv_device_attr attr;
ibv_query_device(hca,&attr); // this call completes successfully.
fprintf(stderr,"MHEINZ: Firmware = %s\n",
attr.fw_ver);
}
err = my_shared_func(hca);
...
int my_shared_func(struct ibv_context *hca)
{
struct ibv_device_attr attr;
hca_context->ops.query_device(hca_context, &attr); // This works!
ibv_query_device(hca_context,&attr); // core dump here.
fprintf(stderr,"MHEINZ: Firmware = %s\n",
attr.fw_ver);
return 0;
}
First, note that calling the device query directly, by using the function pointers in hca_context, works - so I know that the value of hca_context is correct. On the other hand, at the point of the core dump, gdb reports that inside ibv_query_device, the value of hca_context has changed from 0x5044a0 to 0x2b46392fb310!
--
Michael Heinz
Principal Engineer, Qlogic Corporation
King of Prussia, Pennsylvania
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20090317/49e0c686/attachment.html>
More information about the general
mailing list