Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

x86: bt/bts/btr/btc lift the carry flag with an unmasked bit index

Đang mở
#8,375 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp
Lĩnh vực
reverse-engineering

Hướng nghiên cứu

Start from the x86 lifter paths for register-indexed bt, bts, btr, and btc, comparing the carry-flag test with the existing masked write index. Use the supplied byte sequence and LLIL to reproduce the mismatch, then verify that the carry flag uses the reduced index and matches the hardware results for all four instructions.

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

Mô tả

For bt/bts/btr/btc with a register bit index, the lifter masks the index
on the memory/register write but not on the carry flag, so the two halves of the
same instruction disagree when the index is >= the operand size.

Intel SDM: for a register destination, the bit offset is taken modulo the operand
size, so bts eax, ecx with ecx = 33 operates on bit 1.

Repro
b802000000 b921000000 0fabc8 c3
mov eax, 2
mov ecx, 33
bts eax, ecx
ret

LLIL:

eax = 2
ecx = 0x21
flag:c = test_bit(eax, ecx)              <-- raw index 33
eax = eax | 1 << modu.d(ecx, 0x20)       <-- index correctly reduced to 1
Expected vs actual

Hardware (executed on x86-64), all with eax = 2, ecx = 33:

instruction CF eax
bt eax, ecx 1 0x2
bts eax, ecx 1 0x2
btr eax, ecx 1 0x0
btc eax, ecx 1 0x0

Binary Ninja reports CF = 0, because test_bit(eax, 33) reads bit 33 of 2
rather than bit 1. The write side is correct. Dataflow constant-folds the wrong
flag value accordingly.

Ngôn ngữ chính
C++
Star
1.3k
Fork
298
Merge trung bình
4 ngày 13 giờ
Pull request đã merge (30 ngày)
20

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 Vector35/binaryninja-api

Tất cả issue của Vector35/binaryninja-api

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.