Description of problem: coredump when incomplete gluster CLI command. all with brick-name command has this issue, such like add-brick, remove-brick Version-Release number of selected component (if applicable): 3.6.9 and mainline How reproducible: Steps to Reproduce: 1. gluster volume add-brick export replica 2 force 2. 3. Actual results: coredump Expected results: prompt wrong parameter used. Additional info:
suggest fix on function cli_cmd_bricks_parse in cli-cmd-parser.c GF_ASSERT (brick_index > 0); + if(strcmp(words[brick_index],"force") == 0) + { + cli_err ("Wrong brick name used."); + ret = -1; + goto out; + } GF_ASSERT (brick_index < wordcount);
Sorry, the last fix is not work. Now we have fix it on 3.6.9 version, main branch should also have the same issue. the changes patch on 3.6.9 FYI: --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -544,6 +544,12 @@ brick_index = index; + if (strcmp (words[brick_index], "force") == 0) { + cli_err ("Wrong brick name."); + ret = -1; + goto out; + } + if (strcmp (words[wordcount - 1], "force") == 0) { is_force = _gf_true; wc = wordcount - 1; @@ -1301,6 +1307,12 @@ brick_index = index; parse_bricks: + + if (strcmp (words[brick_index], "force") == 0) { + cli_err ("Wrong brick name."); + ret = -1; + goto out; + } if (strcmp (words[wordcount - 1], "force") == 0) { is_force = _gf_true;
REVIEW: http://review.gluster.org/15874 (cli: error out incomplete CLI commands) posted (#1) for review on master by Atin Mukherjee (amukherj)
(In reply to George from comment #1) > suggest fix on function cli_cmd_bricks_parse in cli-cmd-parser.c > > GF_ASSERT (brick_index > 0); > + if(strcmp(words[brick_index],"force") == 0) > + { > + cli_err ("Wrong brick name used."); > + ret = -1; > + goto out; > + } > GF_ASSERT (brick_index < wordcount); Why wouldn't it work? I just sent a patch and tested the same?
Sorry, it could work. but because bric_index == wordcount in this case, this strcmp statement somehow is confused and maybe has risk. I would like suggest use the second fix. though this fix also work for this defect.
REVIEW: https://review.gluster.org/15874 (cli: error out incomplete CLI commands) posted (#2) for review on master by Atin Mukherjee (amukherj)
REVIEW: https://review.gluster.org/15874 (cli: error out incomplete CLI commands) posted (#3) for review on master by Atin Mukherjee (amukherj)
REVIEW: https://review.gluster.org/17870 (cli: error out incomplete CLI commands) posted (#1) for review on master by Atin Mukherjee (amukherj)
COMMIT: https://review.gluster.org/17870 committed in master by Jeff Darcy (jeff.us) ------ commit c136024613c697fec87aaff3a070862b92c57977 Author: Atin Mukherjee <amukherj> Date: Wed Jul 26 12:46:42 2017 +0530 cli: error out incomplete CLI commands cli_cmd_bricks_parse () & cli_cmd_volume_remove_brick_parse () were not handling the the error cases where the command is incomplete with missing brick details which could lead to glusterd crashes. Credit : george.lian Change-Id: Ia6303457a2aa279465aa75d4e1cfcc948893d5de BUG: 1396327 Signed-off-by: Atin Mukherjee <amukherj> Reviewed-on: https://review.gluster.org/17870 Smoke: Gluster Build System <jenkins.org> CentOS-regression: Gluster Build System <jenkins.org> Reviewed-by: Jeff Darcy <jeff.us>
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-3.13.0, please open a new bug report. glusterfs-3.13.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] http://lists.gluster.org/pipermail/announce/2017-December/000087.html [2] https://www.gluster.org/pipermail/gluster-users/