Text   |  XML   |  ReML   |   Visible Warnings:

File System Race Condition  at mbox-sync.c:1384

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mbox_sync_update_index_header

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/mbox/mbox-sync.c)expand/collapse
Show more  
 1355  static int mbox_sync_update_index_header(struct mbox_sync_context *sync_ctx)
 1356  {
 1357          struct mail_index_view *view;
 1358          const struct stat *st;
 1359          uint32_t first_recent_uid, seq, seq2;
 1360   
 1361[+]         st = i_stream_stat(sync_ctx->file_input, FALSE);
 1362          if (st == NULL) {
 1363                  mbox_set_syscall_error(sync_ctx->mbox, "i_stream_stat()");
 1364                  return -1;
 1365          }
 1366   
 1367          if (sync_ctx->moved_offsets &&
 1368              ((uint64_t)st->st_size == sync_ctx->mbox->mbox_hdr.sync_size ||
 1369               (uint64_t)st->st_size == sync_ctx->orig_size)) {
 1370                  /* We moved messages inside the mbox file without changing 
 1371                     the file's size. If mtime doesn't change, another process
 1372                     not using the same index file as us can't know that the file
 1373                     was changed. So make sure the mtime changes. This should
 1374                     happen rarely enough that the sleeping doesn't become a
 1375                     performance problem.
 1376   
 1377                     Note that to do this perfectly safe we should do this wait 
 1378                     whenever mails are moved or expunged, regardless of whether 
 1379                     the file's size changed. That however could become a 
 1380                     performance problem and the consequences of being wrong are
 1381                     quite minimal (an extra logged error message). */
 1382                  while (sync_ctx->orig_mtime == st->st_mtime) {
 1383                          usleep(500000);
 1384                          if (utime(sync_ctx->mbox->path, NULL) < 0) {
 1385                                  mbox_set_syscall_error(sync_ctx->mbox,
 1386                                                         "utime()");
 1387                                  return -1;
 1388                          }
 1389   
 1390                          st = i_stream_stat(sync_ctx->file_input, FALSE);
 1391                          if (st == NULL) {
Show more  




Change Warning 7412.24887 : File System Race Condition

Priority:
State:
Finding:
Owner:
Note: