Vector35 / Vector35/binaryninja-api

Awkward lifting for AArch64 system register writes

Open
#6,037 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Take the following assembly:

msr     daifset, #0x2

This writes 0x2 to the DAIFSet system register.

This gets rendered in LLIL and higher) as:

daifset = _WriteStatusReg(2)

This is misleading since daifset is not a local variable—it is a system register—and it looks identical to other (actual) variables in HLIL. Furthermore, representing this as an assignment implies that _WriteStatusReg returns a value (which it does not).

A better rendering would simply be:

_WriteStatusReg(daifset, 2)

As this does not create the false impression that the result of this expression is stored, and is also simply easier to read.

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

Reproduce the AArch64 msr daifset, #0x2 example and trace how it is rendered from LLIL into HLIL. Done means the output represents _WriteStatusReg(daifset, 2) as a call without assigning its result to a local-looking daifset variable.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.