-
Notifications
You must be signed in to change notification settings - Fork 68
Fix parsing of envvars in MCA files #973
Conversation
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]>
|
:bot🏷️bug @hppritcha If this is too much for v2.0.0 please go ahead and bump to v2.0.1. This is a new feature in v2.x and it is currently broken. |
|
Test PASSed. |
|
Should probably mention that all Mellanox Jenkins tests should be failing without this. I ran their Jenkins script on a TLCC2 system and the -tune tests abort due to memory corruption. Valgrind identified the exact source of the error. |
|
|
||
| /* trim spaces at the beginning */ | ||
| while (' ' == *pchr || '\t' == *pchr) { | ||
| while (isspace (*pchr)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize that this is the way it was before you fixed it -- but shouldn't the prefix check come after the beginning-of-string white space trim?
I ask because the suffix check comes after the end-of-string white space trim.
|
works for me now with srun/alps/mpirun 👍 |
|
sorry wrong PR. |
|
removed the reviewed label since that was accidentally generated by my erroneous comment. |
|
sure. |
This commit fixes a bug in the opal key value parser that might cause the filename parser to go past the beginning of the string. Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from open-mpi/ompi@63bac9a) Signed-off-by: Nathan Hjelm <[email protected]>
|
Test PASSed. |
|
@hjelmn Squash into one commit, and we're good. |
Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from open-mpi/ompi@607be72) Signed-off-by: Nathan Hjelm <[email protected]>
|
Oh, these are master commits -- so we can't squash. Ok. |
|
👍 |
|
@hppritcha Good to go |
|
Test PASSed. |
Fix parsing of envvars in MCA files
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:
the buffer instead of re-allocating space for the trimmed string.
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]