How can mprotect be used soundly?

Đang mở
#580 8 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ệ
c, rust

Hướng nghiên cứu

Start by reading the Miri native-lib/FFI handling described in the issue, including its mprotect and ptrace mechanisms. Investigate the soundness constraints around compiler reordering and Rust-visible memory access; done means reaching a documented, agreed account of which mprotect uses are sound.

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

Mô tả

A-missing

Miri now contains some quite cursed hacks in native-lib / FFI mode where it will mprotect(PROT_NONE) a bunch of memory before invoking native C code, and some cursed ptrace magic then kicks in when the program actually accesses those pages. That got me to wonder, which ways of using mprotect are actually sound?

What Miri does could be sound because the cursed ptrace logic conspires to make all memory accesses still work as normal. We just run some extra code on each access. So even if LLVM decided to move some memory accesses around the mprotect calls, that would just confuse our tracing, but the accesses should work as excpected.

Is that the only way mprotect can be used soundly? Just taking away memory that Rust thinks it can access cannot work in general, so it seems quite tricky to use mprotect correctly.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
760
Fork
68
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 rust-lang/unsafe-code-guidelines

Tất cả issue của rust-lang/unsafe-code-guidelines

Issue tương tự

Thêm issue về Compilers

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.