Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper return register selection for x86 xmm0 #5908

Open
whitequark opened this issue Sep 6, 2024 · 6 comments
Open

Improper return register selection for x86 xmm0 #5908

whitequark opened this issue Sep 6, 2024 · 6 comments
Labels
Component: Core Issue needs changes to the core Core: HLIL Issue involves High Level IL Effort: Medium Issue should take < 1 month Impact: Medium Issue is impactful with a bad, or no, workaround Type: Bug Issue is a non-crashing bug with repro steps

Comments

@whitequark
Copy link
Contributor

whitequark commented Sep 6, 2024

Version and Platform (required):

  • Binary Ninja Version: 4.2.6039-dev Personal (d2968e13)

Bug Description:
This basic block seems to be decompiled wrong, with temp[0] being introduced and going nowhere:

Screenshot_20240906_234317
Screenshot_20240906_234517

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. Open libDly_DelayCalculator.so
  2. Go to 0x00074ed2
  3. Rotate through views

Expected Behavior:
An arithmetic expression is assembled from LLIL fragments and returned.

Binary:
libDly_DelayCalculator.so.zip

@whitequark
Copy link
Contributor Author

For context, the function should be computing something like this:

image

(with added fluff around it)

@xusheng6 xusheng6 added Type: Bug Issue is a non-crashing bug with repro steps Component: Core Issue needs changes to the core Core: HLIL Issue involves High Level IL Impact: High Issue adds or blocks important functionality Effort: Medium Issue should take < 1 month State: Awaiting Triage Issue is waiting for more in-depth triage from a developer labels Sep 9, 2024
@xusheng6 xusheng6 changed the title LLIL to MLIL transformation goes wrong on function using XMM regs MLIL to HLIL transformation goes wrong on function using XMM regs Sep 9, 2024
@xusheng6
Copy link
Member

xusheng6 commented Sep 9, 2024

I have renamed the issue title because it seems to be happening during MLIL->HLIL translation. Though I do not yet know what is causing it. Will need someone else to look into it

@whitequark
Copy link
Contributor Author

Ah, I've made some invalid assumptions then. Thanks for triaging this!

@emesare
Copy link
Contributor

emesare commented Sep 9, 2024

This is an issue with return register selection. The function returns with zmm0 but the selected return register was rax.

Until this is fixed, setting the return type to a double, or adjusting the return register in "Edit Function Properties" will fix the HLIL.

Screenshot 2024-09-09 at 11 26 54 AM

@emesare emesare removed the State: Awaiting Triage Issue is waiting for more in-depth triage from a developer label Sep 9, 2024
@whitequark
Copy link
Contributor Author

Thanks!

@emesare emesare changed the title MLIL to HLIL transformation goes wrong on function using XMM regs Improper return register selection for x86 xmm0 Sep 9, 2024
@plafosse plafosse added Impact: Medium Issue is impactful with a bad, or no, workaround and removed Impact: High Issue adds or blocks important functionality labels Sep 24, 2024
@plafosse
Copy link
Member

In many cases is almost impossible to tell if the return value should be in rax or xmm0 however in this case as there are no uses of rax the correct choice should be obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Issue needs changes to the core Core: HLIL Issue involves High Level IL Effort: Medium Issue should take < 1 month Impact: Medium Issue is impactful with a bad, or no, workaround Type: Bug Issue is a non-crashing bug with repro steps
Projects
None yet
Development

No branches or pull requests

4 participants