Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : File System Race Condition  at pvmd.c:5572

Categories: IO.RACE CWE:367
Warning ID: 22074.28903
Procedure: slave_config
Trace: view
Modified: Thu Nov 26 11:28:27 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /kat0/fletcher/SATE/2010/pvm3/src/pvmd.c
   Enter slave_config
 5449 slave_config(hn, argc, argv) 
 5450         char *hn;
 5451         int argc;
 5452         char **argv;
 5453 {
 5454         int lh;                 /* local host index */ 
 5455         int mh;                 /* master host index */ 
 5456         struct hostd *hp;
 5457         int i, j;
 5458         int ac;
 5459         int ms = 0;             /* manual (humanoid) startup */ 
 5460 #ifndef WIN32 
 5461         int dof = 1;            /* fork, exit parent (default) */ 
 5462 #else 
 5463         int dof = 0; 
 5464 #endif 
 5465         int bad = 0;
 5466         char *p;
 5467         char *s;
 5468  
 5469         for (i = j = ac = 1; i < argc; i++) {
 5470                 if (argv[i][0] == '-') {
 5471                         switch (argv[i][1]) {
 5472  
 5473                         case 'S': 
 5474                                 ms = 1;
 5475                                 break;
 5476  
 5477                         case 'f': 
 5478                                 dof = 0;
 5479                                 break;
 5480  
 5481                         default: 
 5482                                 pvmlogprintf("slave_config() unknown switch: %s\n", argv[i]);
 5483                                 bad++;
 5484                         }
 5485  
 5486                 } else {
 5487                         argv[j++] = argv[i];
 5488                         ac++;
 5489                 }
 5490         }
 5491         argc = ac;
 5492  
 5493         if (bad || argc != 6) {
 5494                 pvmlogerror("slave_config: bad args\n");
 5495                 pvmbailout(0);
 5496         }
 5497  
 5498         mh = atoi(argv[1]);
 5499         lh = atoi(argv[4]);
 5500         hosts = ht_new(1);
 5501         hosts->ht_serial = 1;
 5502         hosts->ht_master = mh;
 5503         hosts->ht_cons = mh;
 5504         hosts->ht_local = lh;
 5505  
 5506         hp = hd_new(mh);
 5507         hp->hd_name = STRALLOC("?");   /* Null Pointer Dereference (ID: 262.28915) */
 5508         hex_inadport(argv[2], &hp->hd_sad);
 5509         hp->hd_mtu = atoi(argv[3]);
 5510         ht_insert(hosts, hp);
 5511         hd_unref(hp);
 5512  
 5513         hp = hd_new(0);
 5514         hp->hd_name = STRALLOC("pvmd'");   /* Null Pointer Dereference (ID: 261.28913) */
 5515         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 260.28911) */
 5516         hp->hd_mtu = pvmudpmtu;
 5517         hp->hd_dsig = pvmmydsig;
 5518         hex_inadport(argv[5], &hp->hd_sad);
 5519         ht_insert(hosts, hp);
 5520         hd_unref(hp);
 5521  
 5522         hp = hd_new(lh);
 5523         hp->hd_name = STRALLOC(hn);   /* Null Pointer Dereference (ID: 259.28909) */
 5524         hp->hd_arch = STRALLOC(myarchname);   /* Null Pointer Dereference (ID: 260.28908) */
 5525         hp->hd_mtu = pvmudpmtu;
 5526         hp->hd_dsig = pvmmydsig;
 5527         hex_inadport(argv[5], &hp->hd_sad);
 5528         ht_insert(hosts, hp);
 5529         hd_unref(hp);
 5530  
 5531         if (i = mksocs()) {
 5532                 if (i == 2) {
 5533                         printf("PvmDupHost\n");
 5534                         fflush(stdout);
 5535                 }
 5536                 pvmbailout(0);
 5537         }
 5538  
 5539         printf("ddpro<%d> arch<%s> ip<%s> mtu<%d> dsig<%d>\n",
 5540                 DDPROTOCOL,
 5541                 myarchname,
 5542                 inadport_hex(&hp->hd_sad),
 5543                 pvmudpmtu,
 5544                 pvmmydsig);
 5545         fflush(stdout);
 5546  
 5547 #ifndef WIN32 
 5548  
 5549 #if !defined(IMA_OS2) && !defined(CYGWIN)
 5550         if (!ms)
 5551                 (void)read(0, (char*)&i, 1);
 5552 #endif 
 5553  
 5554         if (dof) {
 5555                 if (i = fork()) {
 5556                         if (i == -1)
 5557                                 pvmlogperror("slave_config() fork");
 5558                         exit(0);
 5559                 }
 5560  
 5561         /* close everything but our sockets */ 
 5562  
 5563                 for (i = getdtablesize(); --i >= 0; )
 5564 /* XXX don't like this - hard to maintain */ 
 5565                         if (i != netsock && i != loclsock && i != log_fd)
 5566                                 (void)close(i);
 5567         }
 5568  
 5569         /* reopen 0, 1, 2*/ 
 5570  
true5571         (void)open("/dev/null", O_RDONLY, 0);
#string1[0] is accessed by path name5572         (void)open("/dev/null", O_WRONLY, 0);     /* File System Race Condition */
Preconditions
argc >= 3
&$unknown_729319 != 0
*argv[5] != 58
((char*)&$heap_132626)[96] >= 0
((char*)&$heap_132626)[12] >= 0
((char*)&$heap_132638)[20] != 0
((char*)&$heap_132638)[96] >= 0
Postconditions
((char*)$heap_132638)[20]' is freed
*stdout' is allocated by fopen
bytes_before(stdout)' = 0
ac' = 6
argc' = 6
bad' = 0
strlen(&buf[0])' = 17
buf[17]' = 0
dof' = &$unknown_729319
$heap_132621' = 1
bytes_after(&$heap_132621)' = 32
$heap_132621' is allocated by malloc
$heap_132621' is allocated
bytes_before(&$heap_132621)' = 0
((char*)&$heap_132621)[16]' = $input_12
((char*)&$heap_132621)[20]' = $input_87172
((char*)&$heap_132621)[8]' = ((char*)&$heap_132621)[8] + 1
((char*)&$heap_132621)[12]' = $input_12
bytes_after(&$heap_132623)' = 120
$heap_132623' is allocated by malloc
bytes_before(&$heap_132623)' = 0
((char*)&$heap_132623)[16]' = 0
((char*)&$heap_132623)[20]' = 0
((char*)&$heap_132623)[116]' = 0
bytes_after(&$heap_132624)' = 120
$heap_132624' is allocated by malloc
bytes_before(&$heap_132624)' = 0
((char*)&$heap_132624)[8]' = 0
((char*)&$heap_132624)[116]' = 0
bytes_after(&$heap_132625)' = 20
$heap_132625' is allocated by malloc
bytes_before(&$heap_132625)' = 0
((char*)&$heap_132625)[16]' = 0
((char*)&$heap_132625)[8]' = 0
((char*)&$heap_132625)[12]' = 0
$heap_132626' = 0
bytes_after(&$heap_132626)' = 124
$heap_132626' is allocated by malloc
$heap_132626' is freed
bytes_before(&$heap_132626)' = 0
((char*)&$heap_132626)[52]' = $input_87180
((char*)&$heap_132626)[56]' = 2
((char*)&$heap_132626)[72]' = 1
((char*)&$heap_132626)[76]' = 1
((char*)&$heap_132626)[80]' = &$heap_132624
((char*)&$heap_132626)[8]' = &$heap_132628
((char*)&$heap_132626)[84]' = &$heap_132627
((char*)&$heap_132626)[92]' = &$heap_132623
((char*)&$heap_132626)[100]' = 1
((char*)&$heap_132626)[108]' = 1000
((char*)&$heap_132626)[112]' = &$heap_132625
bytes_after(&$heap_132627)' = 120
$heap_132627' is allocated by malloc
bytes_before(&$heap_132627)' = 0
((char*)&$heap_132627)[16]' = 0
((char*)&$heap_132627)[4]' = &$heap_132627
$heap_132628' = 63
bytes_after(&$heap_132628)' = 2
$heap_132628' is allocated by malloc
bytes_before(&$heap_132628)' = 0
strlen(&$heap_132628)' = 1
tocttou($heap_132628)' = tocttou(#string176)
$heap_132629' = &$heap_132629
bytes_after(&$heap_132629)' = 120
$heap_132629' is allocated by malloc
$heap_132629' is allocated
bytes_before(&$heap_132629)' = 0
((char*)&$heap_132629)[16]' = 0
((char*)&$heap_132629)[20]' = 0
((char*)&$heap_132629)[4]' = &$heap_132629
((char*)&$heap_132629)[8]' = 0
((char*)&$heap_132629)[116]' = 0
((char*)&$heap_132629)[12]' = 0
$heap_132630' = 1
bytes_after(&$heap_132630)' = 124
$heap_132630' is allocated by malloc
bytes_before(&$heap_132630)' = 0
((char*)&$heap_132630)[44]' = pvmmydsig
((char*)&$heap_132630)[52]' = pvmudpmtu
((char*)&$heap_132630)[56]' = 2
((char*)&$heap_132630)[72]' = 1
((char*)&$heap_132630)[76]' = 1
((char*)&$heap_132630)[80]' = &$heap_132629
((char*)&$heap_132630)[8]' = &$heap_132633
((char*)&$heap_132630)[84]' = &$heap_132631
((char*)&$heap_132630)[92]' = &$heap_132632
((char*)&$heap_132630)[100]' = 1
((char*)&$heap_132630)[108]' = 1000
((char*)&$heap_132630)[112]' = 0
((char*)&$heap_132630)[12]' = &$heap_132634
$heap_132631' = &$heap_132631
bytes_after(&$heap_132631)' = 120
$heap_132631' is allocated by malloc
$heap_132631' is allocated
bytes_before(&$heap_132631)' = 0
((char*)&$heap_132631)[16]' = 0
((char*)&$heap_132631)[20]' = 0
((char*)&$heap_132631)[4]' = &$heap_132631
((char*)&$heap_132631)[8]' = 0
((char*)&$heap_132631)[116]' = 0
((char*)&$heap_132631)[12]' = 0
bytes_after(&$heap_132632)' = 120
$heap_132632' is allocated by malloc
$heap_132632' is allocated
bytes_before(&$heap_132632)' = 0
((char*)&$heap_132632)[16]' = 0
((char*)&$heap_132632)[20]' = 0
((char*)&$heap_132632)[8]' = 0
((char*)&$heap_132632)[116]' = 0
((char*)&$heap_132632)[12]' = 0
$heap_132633' = 112
bytes_after(&$heap_132633)' = 6
$heap_132633' is allocated by malloc
$heap_132633' is allocated
bytes_before(&$heap_132633)' = 0
strlen(&$heap_132633)' = 5
tocttou($heap_132633)' = tocttou(#string167)
$heap_132634' = *myarchname
bytes_after(&$heap_132634)' = strlen(myarchname) + 1
$heap_132634' is allocated by malloc
$heap_132634' is allocated
bytes_before(&$heap_132634)' = 0
strlen(&$heap_132634)' = strlen(myarchname)
tocttou($heap_132634)' = tocttou(*myarchname)
bytes_after(&$heap_132635)' = 120
$heap_132635' is allocated by malloc
bytes_before(&$heap_132635)' = 0
((char*)&$heap_132635)[16]' = 0
((char*)&$heap_132635)[20]' = 0
((char*)&$heap_132635)[116]' = 0
bytes_after(&$heap_132636)' = 120
$heap_132636' is allocated by malloc
bytes_before(&$heap_132636)' = 0
bytes_after(&$heap_132637)' = 120
$heap_132637' is allocated by malloc
bytes_before(&$heap_132637)' = 0
((char*)&$heap_132637)[16]' = 0
((char*)&$heap_132637)[20]' = 0
((char*)&$heap_132637)[116]' = 0
$heap_132638' = 0
bytes_after(&$heap_132638)' = 124
$heap_132638' is allocated by malloc
$heap_132638' is freed
bytes_before(&$heap_132638)' = 0
((char*)&$heap_132638)[44]' = pvmmydsig
((char*)&$heap_132638)[52]' = pvmudpmtu
((char*)&$heap_132638)[56]' = 2
((char*)&$heap_132638)[72]' = 1
((char*)&$heap_132638)[76]' = 1
((char*)&$heap_132638)[80]' = &$heap_132636
((char*)&$heap_132638)[8]' = &$heap_132640
((char*)&$heap_132638)[84]' = &$heap_132637
((char*)&$heap_132638)[92]' = &$heap_132635
((char*)&$heap_132638)[100]' = 1
((char*)&$heap_132638)[108]' = 1000
((char*)&$heap_132638)[112]' = &$heap_132639
((char*)&$heap_132638)[12]' = &$heap_132641
bytes_after(&$heap_132639)' = 20
$heap_132639' is allocated by malloc
bytes_before(&$heap_132639)' = 0
((char*)&$heap_132639)[16]' = 0
((char*)&$heap_132639)[8]' = 0
((char*)&$heap_132639)[12]' = 0
$heap_132640' = *hn
bytes_after(&$heap_132640)' = strlen(hn) + 1
$heap_132640' is allocated by malloc
bytes_before(&$heap_132640)' = 0
strlen(&$heap_132640)' = strlen(hn)
tocttou($heap_132640)' = tocttou(*hn)
$heap_132641' = *myarchname
bytes_after(&$heap_132641)' = strlen(myarchname) + 1
$heap_132641' is allocated by malloc
bytes_before(&$heap_132641)' = 0
strlen(&$heap_132641)' = strlen(myarchname)
tocttou($heap_132641)' = tocttou(*myarchname)
$heap_132642' is allocated by open
$heap_132642' is allocated
hosts' = &$heap_132621
hp' = &$heap_132638
i' = -1
lh' = $input_87172
mh' = $input_12
ms' = 0




Change Warning 22074.28903 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: