Bug 1619423

Summary: cli: Command `gluster volume statedump <volname>` dumps core
Product: [Community] GlusterFS Reporter: Shyamsundar <srangana>
Component: cliAssignee: bugs <bugs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-5.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-23 15:17:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shyamsundar 2018-08-20 19:54:14 UTC
Description of problem:
Invoking the command as in subject dumps core, generated by the gluster CLI.

The core is due to wordcount in function cli_cmd_volume_statedump_options_parse being 3 in the case above, and this leads to option_str in the function to be a NULL string, and hence referencing the same in strstr within the same function leads to a segmentation fault.

This happens always.

Comment 1 Worker Ant 2018-08-20 20:05:17 UTC
REVIEW: https://review.gluster.org/20867 (cli: Fix invalid access of option_str variable) posted (#1) for review on master by Shyamsundar Ranganathan

Comment 2 Worker Ant 2018-08-21 02:41:48 UTC
COMMIT: https://review.gluster.org/20867 committed in master by "Shyamsundar Ranganathan" <srangana> with a commit message- cli: Fix invalid access of option_str variable

In function cli_cmd_volume_statedump_options_parse if
the wordcount of arguments is exactly 3, then option_str
would remain NULL, and hence the function will generate
a segmentation fault on the strstr check in its body.

This can be triggered when we run the command,
`gluster volume statedump <volname>`

The fix is to check if option_str is non-NULL before use
and also to pass in a duplicated empty string to the dict
key "options" when this is NULL.

Fixes: bz#1619423
Change-Id: Ic029ab60b64890d92c7a0876a638929495d3aa59
Signed-off-by: ShyamsundarR <srangana>

Comment 3 Shyamsundar 2018-10-23 15:17:29 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-5.0, please open a new bug report.

glusterfs-5.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] https://lists.gluster.org/pipermail/announce/2018-October/000115.html
[2] https://www.gluster.org/pipermail/gluster-users/