mprotect changes a whole range instead of stopping at the first failing mapping

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

Maintainer thường phản hồi trong vòng 2 ngày

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, linux
Lĩnh vực
operating-systems

Hướng nghiên cứu

Start by reading sys_mprotect and the range handling around guest_region_range_has_ro_shared_backing; the issue does not name their source files or tests. Trace how mappings are processed in address order, including holes and RLIMIT_DATA refusals. Done means processing stops at the first failing mapping while earlier changes remain, matching the Linux behavior described in the issue.

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

Mô tả

bug

sys_mprotect changes a whole range at once, where Linux's mprotect_fixup takes the mappings in address order and stops at the first one that fails, leaving the mappings below it changed.

On 170b5df, mapping three read-only pages, unmapping the middle one, then mprotect(p, 3 pages, PROT_READ | PROT_WRITE) returns 0 and makes the first and third pages writable. Linux 6.12 returns ENOMEM at the hole, with the first page writable and the third unchanged.

The same whole-range step shows up in the RLIMIT_DATA check from #485: the part of a range below the mapping the limit refuses is changed with one sys_mprotect, so guest_region_range_has_ro_shared_backing refuses that whole part with EACCES before any mapping below the shared one changes, and a hole inside it gets page tables and the new permissions.

A fix would walk the range in address order and stop at the first hole, refused mapping or RLIMIT_DATA refusal.

Ngôn ngữ chính
C
Star
287
Fork
33
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
18

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

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 sysprog21/elfuse

Tất cả issue của sysprog21/elfuse

Issue tương tự

Thêm issue về C

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.