The large stack size in cpg_dispatch, resulting from the message buffer, is causing a segmentation fault in environments with a constrained stack size, namely, when calling into cpg_dispatch from Java using JNI (i.e. for http://github.com/jopereira/jgcs/tree/master/jgcs-corosync). --- lib/cpg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/cpg.c b/lib/cpg.c
index b96df4e..f3b2bff 100644
--- a/lib/cpg.c
+++ b/lib/cpg.c
@@ -346,7 +346,7 @@ cs_error_t cpg_dispatch (
struct cpg_ring_id ring_id;
uint32_t totem_member_list[CPG_MEMBERS_MAX];
int32_t errno_res;
- char dispatch_buf[IPC_DISPATCH_SIZE];
+ char* dispatch_buf;
error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle,
(void *)&cpg_inst));
if (error != CS_OK) {
@@ -361,6 +361,7 @@ cs_error_t cpg_dispatch (
timeout = 0;
}
+ dispatch_buf = malloc(IPC_DISPATCH_SIZE);
dispatch_data = (struct qb_ipc_response_header *)dispatch_buf;
do {
errno_res = qb_ipcc_event_recv (
@@ -504,6 +505,7 @@ cs_error_t cpg_dispatch (
error_put:
hdb_handle_put (&cpg_handle_t_db, handle);
+ free(dispatch_buf);
return (error);
}
--
1.8.1.4
--
Jose Orlando Pereira
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ discuss mailing list [email protected] http://lists.corosync.org/mailman/listinfo/discuss
