<dd id="sga4y"><optgroup id="sga4y"></optgroup></dd>
<nav id="sga4y"><code id="sga4y"></code></nav>
  • <optgroup id="sga4y"></optgroup>

    Code Correctness: Erroneous Synchronization

    ABSTRACT

    如果線程向其他線程發出信號后并未解除鎖定 mutex,則其他線程將保持鎖定并繼續等待 mutex。

    EXPLANATION

    在線程向其他等待 mutex 的線程發出信號后,它必須調用 pthread_mutex_unlock() 來解除鎖定 mutex,然后其他線程才能開始運行。如果發出信號的線程無法解除鎖定 mutex,則在第二個線程中調用 pthread_cond_wait() 函數時不會返回任何值,該線程也將無法執行。

    例 1:以下代碼通過調用 pthread_cond_signal() 向其他等待 mutex 的線程發出信號,但無法解除鎖定 mutex,而其他線程會繼續等待 mutex。


    ...
    pthread_mutex_lock(&count_mutex);

    // Signal waiting thread
    pthread_cond_signal(&count_threshold_cv);
    ...

    REFERENCES

    [1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A9 Application Denial of Service

    [2] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP6080 CAT II

    [3] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP6080 CAT II

    [4] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 373

    [5] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.9


    Copyright 2013 Fortify Software - All rights reserved.
    (Generated from version 2013.1.1.0008 of the Fortify Secure Coding Rulepacks)
    desc.structural.cpp.code_correctness_erroneous_synchronization

    97av