Skip to content

MCA parameter file parsing of env vars is broken #1375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hjelmn opened this issue Feb 17, 2016 · 1 comment · Fixed by open-mpi/ompi-release#973
Closed

MCA parameter file parsing of env vars is broken #1375

hjelmn opened this issue Feb 17, 2016 · 1 comment · Fixed by open-mpi/ompi-release#973
Assignees
Labels
Milestone

Comments

@hjelmn
Copy link
Member

hjelmn commented Feb 17, 2016

Specifying environment variables using the:

-x FOO=bar

syntax in MCA files is currently broken in master and v2.x. Specifying a line like above can lead to memory corruption, incorrect behavior, or just cause mpirun to abort.

I have opened #1374 to fix the issue on master but it will also need to be fixed on 2.x.

@hjelmn hjelmn added the bug label Feb 17, 2016
@hjelmn hjelmn self-assigned this Feb 17, 2016
@hjelmn hjelmn added this to the v2.0.1 milestone Feb 17, 2016
hjelmn added a commit to hjelmn/ompi-release that referenced this issue Feb 18, 2016
This commit fixes a memory corruption bug when parsing lines of the
form:

-x FOO=bar

The code was making changes to the size of the buffer allocated for
key_buffer without making the appropriate changes to
key_buffer_len. This was causing subsequent calls to save_param_name
to write to invalid memory.

This commit makes the following changes:

  - Fix the above bug by modifying trim_name to move the string within
    the buffer instead of re-allocating space for the trimmed string.

  - Cleaned up both trim_name and save_param_name. Both functions took
    a prefix and suffix to trim. Problem was the prefix was not
    treated like a prefix. Instead the "prefix" was located inside the
    string using strstr then the trimmed value started after the
    substring (even in the middle of the string). To allow trimming
    both -x and --x (as well as -mca and --mca) trim_name is now
    called with each prefix.

Signed-off-by: Nathan Hjelm <[email protected]>

(cherry picked from commit open-mpi/ompi@3223673)

Fixes open-mpi/ompi#1375

Signed-off-by: Nathan Hjelm <[email protected]>
@jsquyres jsquyres modified the milestones: v2.0.1, v2.0.2 Sep 2, 2016
hjelmn pushed a commit to hjelmn/ompi that referenced this issue Sep 13, 2016
libompitrace: Use VERSION file to set .so version
@jsquyres jsquyres modified the milestones: v2.0.2, v2.0.3 Oct 25, 2016
@rhc54
Copy link
Contributor

rhc54 commented May 29, 2017

As noted, has been fixed but won't be backported.

@rhc54 rhc54 closed this as completed May 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants