Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-17895

lnetctl import segfault on junk input

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.16.0
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      cassini-hosta:/home/hornc/lustre-wc-rel/lustre/tests # cat t.yaml
      show:
      -     net:
      cassini-hosta:/home/hornc/lustre-wc-rel/lustre/tests # lnetctl import t.yaml
      Segmentation fault (core dumped)
      cassini-hosta:/home/hornc/lustre-wc-rel/lustre/tests #
      

      It is trying to interpret "show" as a global parameter:

      static int jt_import(int argc, char **argv)
      {
      ...
              const char *msg = NULL;
      ...
                      } else if (op == LNET_CMD_UNSPEC) {
                              struct cYAML *err_rc = NULL;
                              long int value;
                              char *key;
      
                              key = strdup((char *)event.data.scalar.value);
                              rc = yaml_parser_parse(&setup, &event);
                              if (rc == 0)
                                      goto free_reply;
                              rc = parse_long((char *)event.data.scalar.value,
                                              &value);
                              if (rc != 0)
                                      goto free_reply;
      ...
      free_reply:
              if (rc == 0) {
                      yaml_lnet_print_error(flags, "import", msg);
                      rc = -EINVAL;
              }
      

      And it is hitting segfault in the call to parse_long(). Another issue is that "msg" will be NULL for both of those goto's, and this will result in another segfault in yaml_lnet_print_error()

      Attachments

        Issue Links

          Activity

            [LU-17895] lnetctl import segfault on junk input
            pjones Peter Jones added a comment -

            Merged for 2.16

            pjones Peter Jones added a comment - Merged for 2.16

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/55340/
            Subject: LU-17895 lnet: Validate input for lnetctl import
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: a197c77470772b0159c983a150b0f60d26c5bcc9

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/55340/ Subject: LU-17895 lnet: Validate input for lnetctl import Project: fs/lustre-release Branch: master Current Patch Set: Commit: a197c77470772b0159c983a150b0f60d26c5bcc9

            "Chris Horn <chris.horn@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/55340
            Subject: LU-17895 lnet: Validate input for lnetctl import
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 8456f9a37a0a601effa5e4e2804c06352d74cb2f

            gerrit Gerrit Updater added a comment - "Chris Horn <chris.horn@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/55340 Subject: LU-17895 lnet: Validate input for lnetctl import Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 8456f9a37a0a601effa5e4e2804c06352d74cb2f

            People

              hornc Chris Horn
              hornc Chris Horn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: