Hi,
I have run into what appears to be a bug in the popen()/pclose() implementation
in dmtcp 1.2.6. It can be seen with a simple program like:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{
FILE *f;
int c;
f = popen("ls -l", "r");
while ((c = fgetc(f)) != EOF) putchar(c);
pclose(f);
f = popen("ls -l", "r");
while ((c = fgetc(f)) != EOF) putchar(c);
pclose(f);
}
In my case the second popen will fail with a "double free" error. It looks
like dmtcp is trying to track file handles opened by popen() and after spawning
the child process, close any file handles in the child which were opened by
previous popen calls. The problem is that the pclose() function does not
remove any file handles from the list of open file handles being tracked. A
subsequent call to popen() will cause a problem because it tries to close a
file handle which is not open. In my case a simple fix was to erase the file
handle from _dmtcpPopenPidMap() in pclose().
Thanks,
John Fredine
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Dmtcp-forum mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dmtcp-forum