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

Đang mở
#877 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu trong Objects.qll bằng cách đọc phần hỗ trợ hiện có cho storage-duration và ObjectIdentity, sau đó kiểm tra cách malloc, tss_create() và tss_get() được mô hình hóa. So sánh việc tái cấu trúc Locatable được đề xuất với thiết kế đối tượng tss_t thay thế. Được xem là hoàn tất khi các biến tss_t cung cấp cả đối tượng giữ khóa lẫn danh tính đối tượng cục bộ theo luồng, mà không làm hỏng cách xử lý đối tượng hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
CodeQL
Star
227
Fork
82
Merge trung bình
6 ngày 7 giờ
Pull request đã merge (30 ngày)
9

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/codeql-coding-standards

Tất cả issue của github/codeql-coding-standards

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.