From 5a63e4c828a17654df36aa4c27a67eaf3f63ca5a Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Wed, 8 Feb 2017 12:20:55 +0530 Subject: [PATCH 363/369] glusterd: glusterd is crashed at the time of stop volume Problem: glusterd is crashed at the time of stop volume due to overflow of pidfile array after build rpm with default options. Solution: To avoid the crash update the pidfile array size. Test: To test the patch followed below procedure 1) Setup 1*2 environment and start the volume 2) Stop the volume Before apply the patch glusterd is crashed. Note: The crash is happened only after build rpm with rpmbuild -ba because _FORTIFY_SOURCE is enabled. This option tries to figure out possible overflow scenarios like the bug here and crash the process. >Reviewed-on: https://review.gluster.org/16560 >NetBSD-regression: NetBSD Build System >Smoke: Gluster Build System >Reviewed-by: N Balachandran >Reviewed-by: Atin Mukherjee >CentOS-regression: Gluster Build System BUG: 1437957 Change-Id: I58a006bc0727843a7ed02a10b4ebd5dca39eae67 Signed-off-by: Mohit Agrawal Reviewed-on: https://code.engineering.redhat.com/gerrit/102294 Reviewed-by: Atin Mukherjee Tested-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index b07fa30..98ae7b6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -6076,7 +6076,7 @@ glusterd_bricks_select_stop_volume (dict_t *dict, char **op_errstr, glusterd_brickinfo_t *brickinfo = NULL; glusterd_pending_node_t *pending_node = NULL; glusterd_conf_t *conf = THIS->private; - char pidfile[1024]; + char pidfile[PATH_MAX] = {0,}; ret = glusterd_op_stop_volume_args_get (dict, &volname, &flags); if (ret) @@ -6140,7 +6140,7 @@ glusterd_bricks_select_remove_brick (dict_t *dict, char **op_errstr, int32_t command = 0; int32_t force = 0; glusterd_conf_t *conf = THIS->private; - char pidfile[1024]; + char pidfile[PATH_MAX] = {0,}; ret = dict_get_str (dict, "volname", &volname); -- 1.8.3.1