Vector35 / Vector35/binaryninja-api

Generic Intrinsic support

Open
#7,233 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

We've identified a need for a "generic intrinsics" These intrinsics would be identified through either lifting or pattern matching. Here are few examples are:

  • min/max
  • floor/ceiling/round
  • align/extract_bits/clear_bits
  • memcpy

The idea is that we would reserve space in the intrinsic identifier field (maybe by setting the top bit) and these would be for internal use only.

enum BNGenericIntrinsic : uint32_t {
   MIN_INTRINSIC = 0x80000000,
   MAX_INTRINSIC,
   FLOOR_INTRINSIC,
   ...
 };

We would likely want to convert the existing builtin_* synthetic builtins to this new, more extensible, system. This system would need to additionally support cross references. Our current cross reference system is based on a uint64_t which is insufficient for representing a cross reference to something that really doesn't exist within the address space. There are a couple of solutions to this:

  • Expand the representation of what our definition of 'memory' is to support these types of situations
  • Use a mechanism like relocations use which is essentially a symbolic cross reference. So rather than address-based cross references we'd have ones based on a symbol (+ addend)
  • The final not-good option would be to continue to use the synthetic_builtins section which has some unfortunate consequences in some cases.

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 reviewing the existing builtin_* synthetic builtins and the current uint64_t cross-reference system. Compare the proposed identifier scheme with the three cross-reference options; done requires a decided design for generic intrinsics, including the listed examples, cross references, and migration of existing synthetic builtins.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.