Add support for `tss_t` thread local objects in Objects.qll

Offen
#877 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
cpp
Bereich
tooling

Rechercherichtung

Beginne in Objects.qll damit, die vorhandene Unterstützung für storage-duration und ObjectIdentity zu lesen, und untersuche dann, wie malloc, tss_create() und tss_get() modelliert werden. Vergleiche das vorgeschlagene Refactoring für Locatable mit dem alternativen tss_t-Objektdesign. Als erledigt gilt die Aufgabe, wenn Variablen vom Typ tss_t sowohl das schlüsselhaltende Objekt als auch die thread-lokale Objektidentität offenlegen, ohne die bestehende Objektbehandlung zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Difficulty-Medium Impact-Low Standard-MISRA-C

Objects.qll has support for identifying objects with different storage durations (static, thread local, allocated, and automatic). However, its thread local object support is limited to _Thread_local variables.

Ideally, a tss_t variable would be recognizable as two objects:

  • One object representing the variable holding the tss_t key. Usually this is an object with static lifetime.
  • Another object identity for the thread local behind the tss_t.

Unfortunately, tss_t currently extends Element, which means that it can't have two implementations of the ObjectIdentity class. Alternatively, calls to tss_get() could be considered ObjectIdentitys, however, that doesn't match the intention of the ObjectIdentity class/library, as the threadlocal is really identified by the tss_t.

The threadlocal object could be identified by the tss_create call (similarly to how we identify dynamic memory via malloc calls). But it probably makes more sense to have ObjectIdentity extend Locatable and then have a tss_t variable produce two ObjectIdentys.

Otherwise the tss_t object class will closely match the malloc object class, since malloc returns a pointer to the dynamic memory just like tss_get() returns a pointer to the thread local. Additional refactoring to share code here will be required.

Vorherrschende Sprache
CodeQL
Sterne
227
Forks
82
Ø Merge
6 T. 7 Std.
Gemergte PRs (30 T.)
9

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus github/codeql-coding-standards

Alle Issues in github/codeql-coding-standards

Ähnliche Issues

Weitere Issues zu DevTools

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.