[AArch64] A stub’s adrp page address becomes a data variable that truncates an unrelated jump table
メンテナーはふだん 2 日以内に返信
@bpotchik がすでに取り組んでいます。
2026年10月21日 から。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
調査の方向性
Start by inspecting the attached repro.s, control.s, and check.py, then trace the AArch64 adrp analysis that creates the variable at 0x100003000 and the jump-table analysis at 0x100002f6c. Reproduce the difference with python3 check.py repro and python3 check.py control. Done means the repro’s table and branch include all 91 cases and the stub’s page address does not truncate the table.
索引モデルが issue の本文から書いたものです。
説明
The following issue was identified, triaged and written by Claude Opus 5.5, I have read through it to make sure the information is coherent and useful.
Version and Platform (required):
- Binary Ninja Version: 6.1.10957-dev (build 2899315201)
- Edition: Ultimate
- OS: macOS
- OS Version: 26.6.2 (25G83)
- CPU Architecture: Apple M2 Ultra
Bug Description:
When a data variable starts inside a jump table, Binary Ninja ends the table at that variable. The table ends there even when the bounds check on the switch index allows more entries. Binary Ninja's own analysis can define such a variable inside a table.
A stub of the form adrp x16, target@PAGE; add x16, x16, target@PAGEOFF; br x16 loads a page address with adrp. Binary Ninja defines an auto void data variable at that address. The stub uses the page address only to compute the branch target. When the page address falls inside a jump table elsewhere in __text, Binary Ninja ends the table at the variable. Binary Ninja's analysis of the switch then misses the remaining cases. The linear sweep makes a function out of each missed case.
In the attached repro, _main has a 91-case switch:
cmp w16, #0x5a
b.hi default
adrp x17, table@PAGE
add x17, x17, table@PAGEOFF
ldrsw x16, [x17, x16, lsl #2]
adr x17, base
add x16, x17, x16
br x16
Its table runs from 0x100002f6c to 0x1000030d8, across the page boundary at 0x100003000. _target_stub at 0x100001000 branches to _target at 0x1000030d8, whose page is 0x100003000.
Binary Ninja then:
- defines a
voiddata variable at0x100003000, whose only code reference is the stub'sadrpat0x100001000; - types the table at
0x100002f6casuint32_t[0x25], which is 37 entries ending at that variable; - gives the
br x16at0x10000202c37 of its 91 targets; - makes 54 functions out of the missed cases,
sub_1000021ectosub_100002468.
control is built from the same source without _target_stub. Its table is uint32_t[0x5b], the br has all 91 targets, and no other function starts inside _main. repro gave the same result on three runs.
Steps To Reproduce:
- Unzip the attachment and open
reproin Binary Ninja with default settings. Wait for analysis to finish. - Go to
0x100003000. Avoiddata variable is defined there, with one code reference, from_target_stubat0x100001000. - Go to
0x100002f6c. The jump table is typeduint32_t[0x25]. - Go to the
br x16at0x10000202cin_main. It has 37 targets. The functionssub_1000021ectosub_100002468start inside_main's case code. - Open
controlthe same way. Its table isuint32_t[0x5b], and thebrhas 91 targets.
check.py prints the same facts headless: python3 check.py repro, then python3 check.py control.
Expected Behavior:
cmp w16, #0x5a; b.hi limits the table at 0x100002f6c to 91 entries. Binary Ninja should read all 91, and the br x16 in _main should have all 91 targets, as it does in control.
The stub uses the page address 0x100003000 only to compute _target's address. Binary Ninja should not define a data variable there.
Screenshots/Video Recording:
N/A
Binary:
quick space launches inferentially
The sources repro.s and control.s, the binaries built from them with clang -arch arm64 <file>.s -o <file>, and check.py.
Additional Information:
- Measured headless with default settings and user plugins disabled (
BN_DISABLE_USER_PLUGINS=1). - Two changes would each give
reprothe resultcontrolgets: reading as many entries as the bounds check allows, or not defining a variable at the stub's page address. The code states the table's size, and a variable inside the table should not shorten the table. - Workaround: define a data variable, auto or user, over the whole table before analysis. With
int32_t[91]defined at0x100002f6cfirst, Binary Ninja does not define a variable at0x100003000, thebrhas 91 targets, and no function starts inside_main. - Only the
adrp/add/brstub pattern was tested.
- 主要言語
- C++
- スター
- 1.3k
- フォーク
- 304
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Vector35/binaryninja-api のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
Vector35/binaryninja-api#8715 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Vector35/binaryninja-api#8714 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
Vector35/binaryninja-api#8713 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Vector35/binaryninja-api#8689 ·
メンテナーはふだん 2 日以内に返信
-
Component: Python API
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Vector35/binaryninja-api#8649 ·
メンテナーはふだん 2 日以内に返信
Vector35/binaryninja-api の issue をすべて見る
似ている issue
-
Bug Core VIF
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ESPresense/ESPresense#2680 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 75/100
stew675/llama-cpp-rdna-boosts#348 ·
メンテナーはふだん 1 日以内に返信
-
Documentation: Add comprehensive newcomer onboarding guide, project structure, and local usage to README対応中かも @Ash-Blanc が今日担当しました。 オープンarea/other status/bot-triaged status/need-triage
難易度 2/5 半日 初心者へのやさしさ 85/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信