Vector35 / Vector35/binaryninja-api

tailcall analysis passes return_addr as first arg

Open
#3,832 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Effort: Low Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 3.2.3814
  • OS: Windows 10
  • OS Version: 22H2
  • CPU Architecture x64

Bug Description:
When analysing functions with tailcalls the HLIL adds the return address as first arg (makes sense, as it's the top of the stack, but is wrong). I've seen it with 0 args, but also when there are multiple args it will look like this

func1(void* arg1, void* arg2, void* arg3)
do_things
other_things
func2(return_addr, arg1, arg2)

even when the underlying ASM doesn't touch the stack frame

Steps To Reproduce:
I can find some more detailed ones if you like

Expected Behavior:
Tailcalls should not pass return_addr as arg1

Screenshots:

image (1)
image

Additional Information:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported x64 tailcall case in HLIL and compare the generated call arguments with the underlying assembly. The issue does not name source files or tests, so locate the tailcall analysis entry point and any related tests first. Done means tailcalls no longer include the return address as the first argument.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.