`CON34-C`: Implementation seems to check incorrect aspects of thread storage duration objects
Una pull request collegata è già stata integrata.
- #778 di @lcartey — integrata
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con l’implementazione di CON34-C e la relativa validazione esistente per i valori tss_t, quindi confrontala con gli esempi conformi e non conformi presenti in questa issue. La modifica è completata quando viene segnalata la violazione prevista del thread storage e i casi non correlati di valori non inizializzati non vengono attribuiti a CON34-C; convalida il risultato con i test disponibili per la regola.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Affected rules
CON34-C
Description
The documentation seems to describe the risk of passing a tss_t into a thread. The risk here is that the new thread will have no value.
In the "compliant" case it says the appropriate fix is to use tss_get() to get the value in the current thread, then pass that value into the new thread.
In our implementation, we check that any tss_t values are definitely given a value before retrieved and passed into a thread creation statement. This is not the intention of the rule, adds additional implementation complexity, and reveals no violations in MRVA.
Example
tss_t key;
void f1() {
// Should be marked non-compliant: new thread has no value for tss_get(key)
// Currently not reported
thrd_create(..., &key);
}
void f2() {
// While the following code is suspect, it is NOT the intention of the rule is not to disallow this:
tss_t localkey;
tss_set(localkey, malloc(...));
void* v = tss_get(localkey);
thrd_create(..., v);
// The fact that v is uninitialized has nothing to do with threads. For instance, this is also erroneous:
printf("%d", *v);
// Further, the above code has nothing to do with thread storage duration, and isn't necessarily invalid:
static void *shared_buf = malloc(...);
thrd_create(..., shared_buf); // Reasonable pattern
}
- Lingua principale
- CodeQL
- Stelle
- 227
- Fork
- 82
- Merge medio
- 6g 7h
- PR unite (30g)
- 9
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Apertafalse positive/false negative
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
github/codeql-coding-standards#1175 ·
Tutte le issue di github/codeql-coding-standards
Issue simili
-
ZCode 3.14.3 に対応する Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
supermomonga/zcode-acp#24 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
learningequality/ricecooker#747 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
KhronosGroup/glTF-Blender-IO#2769 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100