Comments (4)
It does not jump to instruction 834, but rather from that instruction. The target IP/PC is in the next line.
0 [0000000000000000, 0000000400000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000200001000] 230885: lddw r1, 0x1001c2f38
1 [0000000000000000, 00000001001C2F38, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000200001000] 230887: call function_805
2 [0000000000000000, 00000001001C2F38, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000200003000] 834: callx r1
3 [0000000000000000, 00000001001C2F38, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000000000000, 0000000200005000] 230880: lddw r1, 0x1002e2210
Text section vaddr: 0x100000120
Jump from: 0x100001928
Jump target: 0x1001C2F38
(0x1001C2F38 - 0x100000120) / 8 = 230851 (displayed as 230880)
Looks fine to me. You might be wondering why we still offset addresses before we display them. That is completely outdated (see https://github.com/solana-labs/rbpf/blame/main/src/ebpf.rs#L42) and we can probably remove it.
from rbpf.
For this .so file I have the following disassembly
00000000001c2f38 <coretests::main>:
230887: 18 01 00 00 10 22 2e 00 00 00 00 00 00 00 00 00 r1 = 0x2e2210 ll
230889: b7 02 00 00 f8 05 00 00 r2 = 0x5f8
230890: 85 10 00 00 f6 9b 00 00 call 0x9bf6
call 0x9bf6 should jump to instruction 270817 which is test::test_main_static
0000000000210f08 <test::test_main_static>:
270817: bf 14 00 00 00 00 00 00 r4 = r1
How does it end up on 834?
from rbpf.
The offsets are wrong, your disassembler and the one of RBPF are not aligned. They are shifted by text_section.vaddr
and ELF_INSN_DUMP_OFFSET
.
from rbpf.
i believe llvm-objdump offsets are correct and less concerned about offset shift. With coretests::main being the entrypoint I donβt see where and how rbpf takes the sequence of insns that it executes
from rbpf.
Related Issues (20)
- The new ELF parser should use checked instead of saturating arithmetic
- elf: retrieve all dynamic metadata from the `.dynamic` table instead of requiring section headers
- JitCompiler::new() uses unwrap()
- Read only sections can overlap with the stack
- eBPF Standardization HOT 2
- Call target labels are not resolved in v0.2.38 HOT 4
- 32bit target support HOT 2
- ExceededMaxInstructions error message is confusing HOT 1
- Only require winapi on Windows
- git clone and cargo build gives error HOT 3
- elf_parser fails loading a valid ELF file HOT 8
- RBPF is killed by the OS while running a program HOT 2
- make btf instruction class an enum
- Attempt to negate with overflow in disassembler
- Warnings when compiling on macOS Arm
- Removing check SHIFT immediate number from verifier HOT 2
- assembler: register inconsistency HOT 3
- Interpreter LD_DW_IMM: add `!sbpf_version.disable_lddw()` checking
- type casting of rbpf HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbpf.