Setting a calling convention doesn't trigger argument locations to be redetermined

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

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
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
reverse-engineering

Hướng nghiên cứu

Start with the calling-convention update path and inspect how current_function.type.parameters[0].location relates to bv.arch.get_reg_name(current_function.parameter_vars[0].storage). Reproduce the sequence of removing an explicit location and changing the calling convention; done means parameters using the default location move to the new convention's default location.

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

Mô tả

Component: Core Effort: Low Impact: Low

Version and Platform (required):

  • Binary Ninja Version: 3.5.4390-dev
  • OS: macOS
  • OS Version: 13.5
  • CPU Architecture: arm64

Bug Description:
Created a custom calling convention that took the first argument at x20 (this in Swift) and applied it, but it didn't work:

image

Explicit argument locations do work, however:

image

It turns out this is a little more complicated than 'it doesn't work', though. What appears to be happening is that:

  1. If you have the argument location at x20 first
  2. ...and then edit the signature to remove the explicit argument location
  3. ...and then change the calling convention
  4. ...the argument won't be at x20 because the calling convention updates the type, but doesn't update the actual variables

Removing the explicit location changes the argument to the "default location" (x0, in this case) and then the update does not change the variable location even though the calling convention has changed in the type of the function. The variable in the type is still at "default location" but the variable in the analysis has not been changed to the "default location" of the new calling convention. Check current_function.type.parameters[0].location is None vs bv.arch.get_reg_name(current_function.parameter_vars[0].storage) to see that this is the case.

Expected Behavior:
Any time the calling convention has changed, it should update the parameter variable locations if they are set to the default location. It should update to use the default location in the new calling convention.

Additional Information:
Lots of thanks to @CouleeApps for figuring out what was actually happening here, since it appeared to be working non-deterministically before.

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

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.