Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-6325

Boolean member Executor::commandExecutor not always properly initialized

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • agent

    Description

      The constructor of Executor in src/slave/slave does not make sure that the member variable commandExecutor is always set. The following logic is used to determine its value,

      Result<string> executorPath =
        os::realpath(path::join(slave->flags.launcher_dir, MESOS_EXECUTOR));
      
      if (executorPath.isSome()) {
        commandExecutor =
          strings::contains(info.command().value(), executorPath.get());
      }
      

      Should we fail to determine the realpath of the mesos executor, commandExecutor will not be set. Since commandExecutor is a scalar field, no default initialization happens and its value will be random memory (which might often evaluate to true).

      We need to make sure the member variable is set on all branches. Looking at the code it seems we might be able to just explicitly assert some executorPath.

      This was pointed out by coverity, https://scan5.coverity.com/reports.htm#v10074/p10429/fileInstanceId=100298128&defectInstanceId=28784922&mergedDefectId=1373526.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bbannier Benjamin Bannier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: