VirtualBox

Changeset 90573 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Aug 7, 2021 1:32:25 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146179
Message:

VMM/PDMCritSectRw: Added message and LogRel to pdmCritSectRwCorrupted. bugref:6695

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp

    r90571 r90573  
    9393
    9494
    95 DECL_NO_INLINE(static, int) pdmCritSectRwCorrupted(PPDMCRITSECTRW pThis)
     95DECL_NO_INLINE(static, int) pdmCritSectRwCorrupted(PPDMCRITSECTRW pThis, const char *pszMsg)
    9696{
    9797    ASMAtomicWriteU32(&pThis->s.Core.u32Magic, PDMCRITSECTRW_MAGIC_CORRUPT);
     98    LogRel(("PDMCritSect: %s pCritSect=%p\n", pszMsg, pThis));
    9899    return VERR_PDM_CRITSECTRW_IPE;
    99100}
     
    333334                                u64OldState = u64State = ASMAtomicReadU64(&pThis->s.Core.u64State);
    334335                                c = (u64State & RTCSRW_CNT_RD_MASK) >> RTCSRW_CNT_RD_SHIFT;
    335                                 AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis));
     336                                AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis, "Invalid read count on bailout"));
    336337                                c--;
    337338                                cWait = (u64State & RTCSRW_WAIT_CNT_RD_MASK) >> RTCSRW_WAIT_CNT_RD_SHIFT;
    338                                 AssertReturn(cWait > 0, pdmCritSectRwCorrupted(pThis));
     339                                AssertReturn(cWait > 0, pdmCritSectRwCorrupted(pThis, "Invalid waiting read count on bailout"));
    339340                                cWait--;
    340341                                u64State &= ~(RTCSRW_CNT_RD_MASK | RTCSRW_WAIT_CNT_RD_MASK);
     
    359360
    360361                        cWait = (u64State & RTCSRW_WAIT_CNT_RD_MASK) >> RTCSRW_WAIT_CNT_RD_SHIFT;
    361                         AssertReturn(cWait > 0, pdmCritSectRwCorrupted(pThis));
     362                        AssertReturn(cWait > 0, pdmCritSectRwCorrupted(pThis, "Invalid waiting read count"));
    362363                        cWait--;
    363364                        u64State &= ~RTCSRW_WAIT_CNT_RD_MASK;
     
    657658                                                     == ((uintptr_t)pThis & PAGE_OFFSET_MASK),
    658659                                                  ("%p vs %p\n", pVCpu->pdm.s.apQueuedCritSectRwShrdLeaves[i], pThis),
    659                                                   pdmCritSectRwCorrupted(pThis));
     660                                                  pdmCritSectRwCorrupted(pThis, "Invalid self pointer"));
    660661                    VMCPU_FF_SET(pVCpu, VMCPU_FF_PDM_CRITSECT);
    661662                    VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
     
    693694#endif
    694695        uint32_t cDepth = ASMAtomicDecU32(&pThis->s.Core.cWriterReads);
    695         AssertReturn(cDepth < PDM_CRITSECTRW_MAX_RECURSIONS, pdmCritSectRwCorrupted(pThis));
     696        AssertReturn(cDepth < PDM_CRITSECTRW_MAX_RECURSIONS, pdmCritSectRwCorrupted(pThis, "too many writer-read recursions"));
    696697    }
    697698
     
    923924                        u64OldState = u64State = ASMAtomicReadU64(&pThis->s.Core.u64State);
    924925                        uint64_t c = (u64State & RTCSRW_CNT_WR_MASK) >> RTCSRW_CNT_WR_SHIFT;
    925                         AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis));
     926                        AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis, "Invalid write count on bailout"));
    926927                        c--;
    927928                        u64State &= ~RTCSRW_CNT_WR_MASK;
     
    958959                u64OldState = u64State = ASMAtomicReadU64(&pThis->s.Core.u64State);
    959960                uint64_t c = (u64State & RTCSRW_CNT_WR_MASK) >> RTCSRW_CNT_WR_SHIFT;
    960                 AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis));
     961                AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis, "Invalid write count on bailout"));
    961962                c--;
    962963                u64State &= ~RTCSRW_CNT_WR_MASK;
     
    12081209
    12091210                uint64_t c = (u64State & RTCSRW_CNT_WR_MASK) >> RTCSRW_CNT_WR_SHIFT;
    1210                 AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis));
     1211                AssertReturn(c > 0, pdmCritSectRwCorrupted(pThis, "Invalid write count on leave"));
    12111212                c--;
    12121213
     
    12681269                                             == ((uintptr_t)pThis & PAGE_OFFSET_MASK),
    12691270                                          ("%p vs %p\n", pVCpu->pdm.s.apQueuedCritSectRwExclLeaves[i], pThis),
    1270                                           pdmCritSectRwCorrupted(pThis));
     1271                                          pdmCritSectRwCorrupted(pThis, "Invalid self pointer on queue (excl)"));
    12711272            VMCPU_FF_SET(pVCpu, VMCPU_FF_PDM_CRITSECT);
    12721273            VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
     
    12921293#endif
    12931294        uint32_t const cDepth = ASMAtomicDecU32(&pThis->s.Core.cWriteRecursions);
    1294         AssertReturn(cDepth != 0 && cDepth < UINT32_MAX, pdmCritSectRwCorrupted(pThis));
     1295        AssertReturn(cDepth != 0 && cDepth < UINT32_MAX, pdmCritSectRwCorrupted(pThis, "Invalid write recursion value on leave"));
    12951296    }
    12961297
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette