x86 lifting issues

Đang mở
#8,620 1 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
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp

Hướng nghiên cứu

Start by reading core/flagsresolver.cpp around line 1855 and arch/x86/il.cpp around line 5263, then inspect the supplied kat-i386.o instructions at 0x10fa4 and 0x1236b. Verify that optimized LLIL branches on the original ECX value and that bsr exposes its scan result and zero flag semantics. Done means both cases produce the expected LLIL behavior.

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

Mô tả

Binary files and instruction addresses (ZIP available for upload separately):

  • kat-i386.o: 0x10fa4, 0x1236b; SHA-256 e5c0a966aa75166edbb37d3130274e543b4dbf3a90718c197cc25f5d90965f8b

1: add ecx, -1; jae has an inverted condition

Binary instruction: kat-i386.o / signed_division at 0x10fa4; bytes 83c1ff 732b.

Disassembly: add ecx, 0xffffffff; jae 0x10fd4.

Current lifted LLIL (relevant lines):

ecx = add.d{*}(ecx, -1)
if (ge {u>=, x87comi.f>=, vcomi.f>=}) then 0x10fd4 else 0x10fa9

Current optimized LLIL (relevant lines):

temp0.d = ecx
ecx = ecx - 1
if (temp0.d u>= 1) then 0x10fd4 else 0x10fa9

Expected LLIL (semantic sketch):

old_ecx = ecx
ecx = add.d{*}(old_ecx, -1)
if (old_ecx == 0) then 0x10fd4 else 0x10fa9

Adding 0xffffffff sets the carry flag when the original ecx is nonzero. Since jae branches when carry is clear, it should branch only when the original ecx is zero; the optimized old_ecx u>= 1 condition branches in the opposite case. The lifted LLIL retains the flags correctly; the incorrect condition appears in optimized LLIL from the core flag resolver.

Code: core/flagsresolver.cpp:1855

2: x86 bsr / bsf

Binary instruction: kat-i386.o / bitcount_probe at 0x1236b; bytes 0fbdcf.

Disassembly: bsr ecx, edi.

Current lifted LLIL (relevant lines):

ecx, eflags = _bit_scan_reverse(edi)

Expected LLIL (semantic sketch):

ecx = 31 - clz.d(edi) for nonzero edi; ZF = (edi == 0)

The opaque form has no executable scan or ZF semantics in LLIL.

Code: arch/x86/il.cpp:5263

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

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 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.