`RULE-25-21`, others: Consider something like a library TracesToExplicit<T>

Đang mở
#848 0 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
devtools

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra phần triển khai và các bài kiểm thử cho RULE-25-21 cũng như cách xử lý các thao tác atomic_*_explicit. Xác định các trường hợp truy vết ngược được hỗ trợ cho phép gán, tham số và lệnh gọi hoặc giá trị trả về của hàm, sau đó xác định cách báo cáo các đường dẫn không hợp lệ. Công việc được xem là hoàn tất khi thư viện tracing được đề xuất xử lý các gốc hợp lệ và từ chối các giá trị không thể truy vết đến memory_order_seq_cst.

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

Mô tả

Difficulty-Low enhancement Impact-Low
Affected rules
  • RULE-25-21
  • Likely others, haven't researched
Description

Rule 25-21 requires that the atomic_*_explicit operations use the memory order memory_order_seq_cst.

It would probably be overly restrictive to require an explicit inline written memory_order_seq_cst at the call site. However, it's probably too accepting to merely allow any dynamically computed value. Ideally, we can support basic indirection like variable assignment, parameter values, function calls/returns, and report cases that don't trace back to an acceptable root.

Doing this as a typical flow analysis is backwards. We can easily track flow from memory_order_seq_cst exprs to atomic_*_explicit calls, but the existence of such a flow doesn't preclude that invalid values also flow to the call. Alternatively, there are potential performance issues if we consider all exprs which are not memory_order_seq_cst to be sources in the flow analysis.

Wouldn't be terribly hard to write a library such as TracesToExplicit<T> that is a very simple global flow analysis made for this purpose, starting from sinks and doing only very obvious backwards tracking of values through function calls and variable assignments. If that doesn't track back to an acceptable value, we can report it. Ideally we can report it as a path-problem though this makes such a library more complex to implement.

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.