Bug 207 - qsub segfault if malformed environment
: qsub segfault if malformed environment
Product: TORQUE
: 4.0.*
: All Linux
: P5 major
Assigned To: Ken Nielson
  Show dependency treegraph
Reported: 2012-07-21 10:38 MDT by Matt Ezell
Modified: 2012-07-23 12:23 MDT (History)
1 user (show)

See Also:

Proposed patch (621 bytes, patch)
2012-07-21 11:30 MDT, Matt Ezell
Details | Diff
Fixes segfault in qsub when bad environment variables are passed in. (1.82 KB, patch)
2012-07-23 12:23 MDT, Ken Nielson
Details | Diff


You need to log in before you can comment on or make changes to this bug.

Description Matt Ezell 2012-07-21 10:38:20 MDT
This was found in 4.1-fixes, but that's not a valid target in Bugzilla.

I've been having occasional segfaults when Moab is trying to 'qsub' a job as
the user.  Loading the core file in GDB, it appears that envp has strings that
don't contain an '=' sign.  This should never happen, but Moab is using
something like execve to manually set the environment.  I'm going to file a bug
with the Moab guys, but TORQUE should protect itself from this situation.

The attached patch simply ignores environment strings that don't have an '='
sign.  It compiles clean, but I haven't had a chance to fully test it yet. I
set the this situation to return PBSE_BAD_PARAMETER. Not sure if that's the
best code here, but it doesn't look like any calling functions actually use the
return code.
Comment 1 Matt Ezell 2012-07-21 11:30:13 MDT
Created an attachment (id=113) [details]
Proposed patch
Comment 2 Ken Nielson 2012-07-23 12:22:03 MDT
I have modified the patch submitted by Matt and attached it here.

If we get a bad environment variable qsub will exit and print an error with the
bad environment variable.

This has been checked into 4.0-fixes, 4.1-fixes and trunk.
Comment 3 Ken Nielson 2012-07-23 12:23:06 MDT
Created an attachment (id=114) [details]
Fixes segfault in qsub when bad environment variables are passed in.