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

オープン
#877 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
cpp
領域
tooling

調査の方向性

Objects.qll で既存の storage-duration と ObjectIdentity のサポートを読むことから始め、次に malloc、tss_create()、tss_get() がどのようにモデル化されているかを調べます。提案されている Locatable のリファクタリングと、代替となる tss_t オブジェクト設計を比較します。完了の条件は、既存のオブジェクト処理を壊すことなく、tss_t 変数がキーを保持するオブジェクトとスレッドローカルなオブジェクト ID の両方を公開することです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
CodeQL
スター
227
フォーク
82
平均マージ
6日 7時間
マージ済み PR(30日)
9

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/codeql-coding-standards のほかの issue

github/codeql-coding-standards の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。